Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17.0 l10n ke edi oscu dako #162196

Draft
wants to merge 2 commits into
base: 17.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
202 changes: 101 additions & 101 deletions addons/l10n_ke/data/template/account.tax-ke.csv
Original file line number Diff line number Diff line change
@@ -1,101 +1,101 @@
"id","description","invoice_label","type_tax_use","name","amount_type","amount","tax_group_id","l10n_ke_item_code_id","repartition_line_ids/repartition_type","repartition_line_ids/document_type","repartition_line_ids/tag_ids","repartition_line_ids/factor_percent","repartition_line_ids/account_id"
"ST16","Sales VAT (16%)","Sales VAT (16%)","sale","16%","percent","16.0","tax_group_16","","base","invoice","+16% Sales Base","",""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would not be bad to have it in the commit msg as well that we are changing the invoice_label

"","","","","","","","","","tax","invoice","+16% Sales Tax","100","ke2200"
"","","","","","","","","","base","refund","-16% Sales Base","",""
"","","","","","","","","","tax","refund","-16% Sales Tax","100","ke2200"
"ST8","Sales VAT (8%)","Sales VAT (8%)","sale","8%","percent","8.0","tax_group_8","","base","invoice","+8% Sales Base","",""
"","","","","","","","","","tax","invoice","+8% Sales Tax","100","ke2200"
"","","","","","","","","","base","refund","-8% Sales Base","",""
"","","","","","","","","","tax","refund","-8% Sales Tax","100","ke2200"
"ST0","Sales VAT Zero Rated","Sales VAT Zero Rated","sale","0%","percent","0.0","tax_group_0","","base","invoice","+Zero Rated Sales Base","",""
"","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","base","refund","-Zero Rated Sales Base","",""
"","","","","","","","","","tax","refund","","100",""
"STEX","Sales VAT Exempt","Sales VAT Exempt","sale","0% EXEMPT","percent","0.0","tax_group_0","","base","invoice","+Exempt Sales Base","",""
"","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","base","refund","-Exempt Sales Base","",""
"","","","","","","","","","tax","refund","","100",""
"SWT3","3% WH","3%","sale","3% WH","percent","-3.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"SWT5","5% WH","5%","sale","5% WH","percent","-5.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"SWT10","10% WH","10%","sale","10% WH","percent","-10.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"SWT12","12% WH","12%","sale","12% WH","percent","-12.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"SWT15","15% WH","15%","sale","15% WH","percent","-15.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"SWT20","20% WH","20%","sale","20% WH","percent","-20.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"SWT25","25% WH","25%","sale","25% WH","percent","-25.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"SWT30","30% WH","30%","sale","30% WH","percent","-30.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke1120"
"PT16","Purchases VAT (16%)","Purchases VAT (16%)","purchase","16%","percent","16.0","tax_group_16","","base","invoice","+16% Purchases Base","",""
"","","","","","","","","","tax","invoice","+16% Purchases Tax","100","ke1110"
"","","","","","","","","","base","refund","-16% Purchases Base","",""
"","","","","","","","","","tax","refund","-16% Purchases Tax","100","ke1110"
"PT8","Purchases VAT (8%)","Purchases VAT (8%)","purchase","8%","percent","8.0","tax_group_8","","base","invoice","+8% purchases Base","",""
"","","","","","","","","","tax","invoice","+8% Purchases Tax","100","ke1110"
"","","","","","","","","","base","refund","-8% purchases Base","",""
"","","","","","","","","","tax","refund","-8% Purchases Tax","100","ke1110"
"PT0","Purchases VAT Zero rated (0%)","Purchases VAT Zero rated","purchase","0%","percent","0.0","tax_group_0","","base","invoice","+Zero Rated Purchases Base","",""
"","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","base","refund","-Zero Rated Purchases Base","",""
"","","","","","","","","","tax","refund","","100",""
"PTEX","Purchase VAT Exempt","Purchase VAT Exempt","purchase","0% EXEMPT","percent","0.0","tax_group_0","","base","invoice","+Exempt Purchases Base","",""
"","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","base","refund","-Exempt Purchases Base","",""
"","","","","","","","","","tax","refund","","100",""
"PWT3","3% WH","3%","purchase","3% WH","percent","-3.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"PWT5","5% WH","5%","purchase","5% WH","percent","-5.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"PWT10","10% WH","10%","purchase","10% WH","percent","-10.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"PWT12","12% WH","12%","purchase","12% WH","percent","-12.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"PWT15","15% WH","15%","purchase","15% WH","percent","-15.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"PWT20","20% WH","20%","purchase","20% WH","percent","-20.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"PWT25","25% WH","25%","purchase","25% WH","percent","-25.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"PWT30","30% WH","30%","purchase","30% WH","percent","-30.0","tax_group_withholding","","base","invoice","","",""
"","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","base","refund","","",""
"","","","","","","","","","tax","refund","","","ke2203"
"ST0EXPORT","Export (0%)","0%","sale","0% EXPORT","percent","0","tax_group_0","l10n_ke.item_code_2023_00011200","base","invoice","+Exempt Sales Base","",""
"","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","base","refund","-Exempt Sales Base","",""
"","","","","","","","","","tax","refund","","100",""
"id","description","invoice_label","type_tax_use","name","amount_type","amount","tax_group_id","active","l10n_ke_item_code_id","repartition_line_ids/repartition_type","repartition_line_ids/document_type","repartition_line_ids/tag_ids","repartition_line_ids/factor_percent","repartition_line_ids/account_id"
"ST16","Sales VAT (16%)","16%","sale","16%","percent","16.0","tax_group_16","1","","base","invoice","+16% Sales Base","",""
"","","","","","","","","","","tax","invoice","+16% Sales Tax","100","ke2200"
"","","","","","","","","","","base","refund","-16% Sales Base","",""
"","","","","","","","","","","tax","refund","-16% Sales Tax","100","ke2200"
"ST8","Sales VAT (8%)","8%","sale","8%","percent","8.0","tax_group_8","1","","base","invoice","+8% Sales Base","",""
"","","","","","","","","","","tax","invoice","+8% Sales Tax","100","ke2200"
"","","","","","","","","","","base","refund","-8% Sales Base","",""
"","","","","","","","","","","tax","refund","-8% Sales Tax","100","ke2200"
"ST0","Sales VAT Zero Rated","0%","sale","0%","percent","0.0","tax_group_0","1","","base","invoice","+Zero Rated Sales Base","",""
"","","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","","base","refund","-Zero Rated Sales Base","",""
"","","","","","","","","","","tax","refund","","100",""
"STEX","Sales VAT Exempt","Exempt","sale","0% EXEMPT","percent","0.0","tax_group_0","1","","base","invoice","+Exempt Sales Base","",""
"","","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","","base","refund","-Exempt Sales Base","",""
"","","","","","","","","","","tax","refund","","100",""
"SWT3","3% WH","3%","sale","3% WH","percent","-3.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"SWT5","5% WH","5%","sale","5% WH","percent","-5.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"SWT10","10% WH","10%","sale","10% WH","percent","-10.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"SWT12","12% WH","12%","sale","12% WH","percent","-12.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"SWT15","15% WH","15%","sale","15% WH","percent","-15.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"SWT20","20% WH","20%","sale","20% WH","percent","-20.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"SWT25","25% WH","25%","sale","25% WH","percent","-25.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"SWT30","30% WH","30%","sale","30% WH","percent","-30.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke1120"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke1120"
"PT16","Purchases VAT (16%)","16%","purchase","16%","percent","16.0","tax_group_16","1","","base","invoice","+16% Purchases Base","",""
"","","","","","","","","","","tax","invoice","+16% Purchases Tax","100","ke1110"
"","","","","","","","","","","base","refund","-16% Purchases Base","",""
"","","","","","","","","","","tax","refund","-16% Purchases Tax","100","ke1110"
"PT8","Purchases VAT (8%)","8%","purchase","8%","percent","8.0","tax_group_8","1","","base","invoice","+8% purchases Base","",""
"","","","","","","","","","","tax","invoice","+8% Purchases Tax","100","ke1110"
"","","","","","","","","","","base","refund","-8% purchases Base","",""
"","","","","","","","","","","tax","refund","-8% Purchases Tax","100","ke1110"
"PT0","Purchases VAT Zero rated (0%)","0%","purchase","0%","percent","0.0","tax_group_0","1","","base","invoice","+Zero Rated Purchases Base","",""
"","","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","","base","refund","-Zero Rated Purchases Base","",""
"","","","","","","","","","","tax","refund","","100",""
"PTEX","Purchase VAT Exempt","Exempt","purchase","0% EXEMPT","percent","0.0","tax_group_0","1","","base","invoice","+Exempt Purchases Base","",""
"","","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","","base","refund","-Exempt Purchases Base","",""
"","","","","","","","","","","tax","refund","","100",""
"PWT3","3% WH","3%","purchase","3% WH","percent","-3.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"PWT5","5% WH","5%","purchase","5% WH","percent","-5.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"PWT10","10% WH","10%","purchase","10% WH","percent","-10.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"PWT12","12% WH","12%","purchase","12% WH","percent","-12.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"PWT15","15% WH","15%","purchase","15% WH","percent","-15.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"PWT20","20% WH","20%","purchase","20% WH","percent","-20.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"PWT25","25% WH","25%","purchase","25% WH","percent","-25.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"PWT30","30% WH","30%","purchase","30% WH","percent","-30.0","tax_group_withholding","0","","base","invoice","","",""
"","","","","","","","","","","tax","invoice","","","ke2203"
"","","","","","","","","","","base","refund","","",""
"","","","","","","","","","","tax","refund","","","ke2203"
"ST0EXPORT","Export (0%)","0%","sale","0% EXPORT","percent","0","tax_group_0","1","l10n_ke.item_code_2023_00011200","base","invoice","+Exempt Sales Base","",""
"","","","","","","","","","","tax","invoice","","100",""
"","","","","","","","","","","base","refund","-Exempt Sales Base","",""
"","","","","","","","","","","tax","refund","","100",""
28 changes: 27 additions & 1 deletion addons/l10n_ke_edi_tremol/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
from datetime import datetime

from odoo import models, fields, _
from odoo import models, fields, _, api
from odoo.exceptions import UserError

_logger = logging.getLogger(__name__)
Expand All @@ -17,6 +17,21 @@ class AccountMove(models.Model):
l10n_ke_cu_serial_number = fields.Char(string='CU Serial Number', copy=False)
l10n_ke_cu_invoice_number = fields.Char(string='CU Invoice Number', copy=False)
l10n_ke_cu_qrcode = fields.Char(string='CU QR Code', copy=False)
l10n_ke_cu_show_send_button = fields.Boolean(string='Show Send to Tremol button', compute='_compute_l10n_ke_cu_show_send_button')

@api.depends('country_code', 'l10n_ke_cu_qrcode', 'state', 'move_type')
def _compute_l10n_ke_cu_show_send_button(self):
for move in self:
move.l10n_ke_cu_show_send_button = (
move.country_code == 'KE'
and not move.l10n_ke_cu_qrcode
and move.state == 'posted'
and move.move_type in ['out_invoice', 'out_refund']
and (
'l10n_ke_oscu_is_active' not in move.company_id
Copy link
Contributor

@jco-odoo jco-odoo Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not define l10n_ke_oscu_is_active in l10n_ke then instead of this hack? Or define this boolean in l10n_ke (even simpler)

or not move.company_id.l10n_ke_oscu_is_active
)
)

# -------------------------------------------------------------------------
# HELPERS
Expand Down Expand Up @@ -82,6 +97,12 @@ def _l10n_ke_validate_move(self):

def _l10n_ke_fiscal_device_details_filled(self):
self.ensure_one()
# If the company is configured for OSCU, don't block the Send & Print.
if (
'l10n_ke_oscu_is_active' in self.company_id
and self.company_id.l10n_ke_oscu_is_active
):
return True
return all([
self.country_code == 'KE',
self.l10n_ke_cu_invoice_number,
Expand Down Expand Up @@ -232,6 +253,11 @@ def l10n_ke_action_cu_post(self):
""" Returns the client action descriptor dictionary for sending the
invoice(s) to the control unit (the fiscal device).
"""
# If l10n_ke_edi_oscu is configured for the company, disable sending via TREMOL.
if 'l10n_ke_oscu_is_active' in self.company_id and self.company_id.l10n_ke_oscu_is_active:
raise UserError(
_('An OSCU has been initialized for this company. Please send the e-invoice via Send and Print -> Send to eTIMS instead.')
)
# Check the configuration of the invoice
errors = self._l10n_ke_validate_move()
if errors:
Expand Down
3 changes: 2 additions & 1 deletion addons/l10n_ke_edi_tremol/views/account_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
<field name="arch" type="xml">
<xpath expr="//header/button[@name='action_post']" position="after">
<field name="l10n_ke_cu_qrcode" invisible="1"/>
<field name="l10n_ke_cu_show_send_button" invisible="1"/>
<button name="l10n_ke_action_cu_post" type="object"
class="oe_highlight"
groups="account.group_account_manager"
string="Send To Fiscal Device"
invisible="country_code != 'KE' or l10n_ke_cu_qrcode or state != 'posted' or move_type not in ['out_invoice', 'out_refund']"/>
invisible="not l10n_ke_cu_show_send_button"/>
</xpath>
<xpath expr="//group[@id='header_right_group']" position="inside">
<field name="l10n_ke_cu_invoice_number" readonly="1" invisible="country_code != 'KE'"/>
Expand Down
2 changes: 1 addition & 1 deletion addons/l10n_ke_edi_tremol/views/report_invoice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<odoo>
<template id="l10n_ke_invoice" inherit_id="account.report_invoice_document">
<xpath expr="//div[@id='qrcode']" position="before">
<div t-if="o.country_code == 'KE'" id="l10n_ke_control_unit_information" style="page-break-inside:avoid;">
<div t-if="o.country_code == 'KE' and o.l10n_ke_cu_invoice_number" id="l10n_ke_control_unit_information" style="page-break-inside:avoid;">
<b>Kenyan Fiscal Device Info</b>
<div class="row mt-4 mb-4">
<div class="col-auto col-3 mw-100 mb-2">
Expand Down