diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index b8b2626e35e56f..77770adf40d9b4 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3189,6 +3189,10 @@ def button_draft(self): def button_cancel(self): self.write({'auto_post': False, 'state': 'cancel'}) + def _can_be_emailed(self): + self.ensure_one() + return self.is_invoice(include_receipts=True) + def _get_mail_template(self): """ :return: the correct mail template based on the current move type @@ -3313,7 +3317,7 @@ def action_invoice_print(self): """ Print the invoice and mark it as sent, so that we can see more easily the next step of the workflow """ - if any(not move.is_invoice(include_receipts=True) for move in self): + if any(not move._can_be_emailed() for move in self): raise UserError(_("Only invoices could be printed.")) self.filtered(lambda inv: not inv.is_move_sent).write({'is_move_sent': True}) diff --git a/addons/account/models/ir_actions_report.py b/addons/account/models/ir_actions_report.py index cd9ea71b45fe50..95e2a87d74bb29 100644 --- a/addons/account/models/ir_actions_report.py +++ b/addons/account/models/ir_actions_report.py @@ -43,7 +43,7 @@ def _render_qweb_pdf(self, res_ids=None, data=None): invoice_reports = (self.env.ref('account.account_invoices_without_payment'), self.env.ref('account.account_invoices')) if self in invoice_reports: moves = self.env['account.move'].browse(res_ids) - if any(not move.is_invoice(include_receipts=True) for move in moves): + if any(not move._can_be_emailed() for move in moves): raise UserError(_("Only invoices could be printed.")) return super()._render_qweb_pdf(res_ids=res_ids, data=data) diff --git a/addons/account/wizard/account_invoice_send.py b/addons/account/wizard/account_invoice_send.py index 7c895d6b1cf7c1..69bd271371d9d1 100644 --- a/addons/account/wizard/account_invoice_send.py +++ b/addons/account/wizard/account_invoice_send.py @@ -36,8 +36,8 @@ def default_get(self, fields): res = super(AccountInvoiceSend, self).default_get(fields) res_ids = self._context.get('active_ids') - invoices = self.env['account.move'].browse(res_ids).filtered(lambda move: move.is_invoice(include_receipts=True)) - if not invoices: + moves = self.env['account.move'].browse(res_ids).filtered(lambda move: move._can_be_emailed()) + if not moves: raise UserError(_("You can only send invoices.")) composer = self.env['mail.compose.message'].create({ diff --git a/addons/account_edi/models/account_edi_document.py b/addons/account_edi/models/account_edi_document.py index c96d48c21955f9..d552cffd0b8ea0 100644 --- a/addons/account_edi/models/account_edi_document.py +++ b/addons/account_edi/models/account_edi_document.py @@ -52,7 +52,7 @@ def _compute_edi_content(self): config_errors = doc.edi_format_id._check_move_configuration(move) if config_errors: res = base64.b64encode('\n'.join(config_errors).encode('UTF-8')) - elif move.is_invoice(include_receipts=True) and doc.edi_format_id._is_required_for_invoice(move): + elif move._is_edi_invoice() and doc.edi_format_id._is_required_for_invoice(move): res = base64.b64encode(doc.edi_format_id._get_invoice_edi_content(doc.move_id)) elif move.payment_id and doc.edi_format_id._is_required_for_payment(move): res = base64.b64encode(doc.edi_format_id._get_payment_edi_content(doc.move_id)) @@ -82,7 +82,7 @@ def _prepare_jobs(self): for edi_doc in documents: move = edi_doc.move_id edi_format = edi_doc.edi_format_id - if move.is_invoice(include_receipts=True): + if move._is_edi_invoice(): doc_type = 'invoice' elif move.payment_id or move.statement_line_id: doc_type = 'payment' @@ -159,7 +159,7 @@ def _postprocess_cancel_edi_results(documents, edi_result): 'blocking_level': False, }) - if move.is_invoice(include_receipts=True) and move.state == 'posted': + if move._is_edi_invoice() and move.state == 'posted': # The user requested a cancellation of the EDI and it has been approved. Then, the invoice # can be safely cancelled. invoice_ids_to_cancel.add(move.id) diff --git a/addons/account_edi/models/account_move.py b/addons/account_edi/models/account_move.py index 4ee7a0329a061e..3c723c978a5fae 100644 --- a/addons/account_edi/models/account_move.py +++ b/addons/account_edi/models/account_move.py @@ -100,7 +100,7 @@ def _compute_show_reset_to_draft_button(self): for doc in move.edi_document_ids: if doc.edi_format_id._needs_web_services() \ and doc.state in ('sent', 'to_cancel') \ - and move.is_invoice(include_receipts=True) \ + and move._is_edi_invoice() \ and doc.edi_format_id._is_required_for_invoice(move): move.show_reset_to_draft_button = False break @@ -116,7 +116,7 @@ def _compute_edi_show_cancel_button(self): move.edi_show_cancel_button = any([doc.edi_format_id._needs_web_services() and doc.state == 'sent' - and move.is_invoice(include_receipts=True) + and move._is_edi_invoice() and doc.edi_format_id._is_required_for_invoice(move) for doc in move.edi_document_ids]) @@ -127,10 +127,23 @@ def _compute_edi_show_abandon_cancel_button(self): for move in self: move.edi_show_abandon_cancel_button = any(doc.edi_format_id._needs_web_services() and doc.state == 'to_cancel' - and move.is_invoice(include_receipts=True) + and move._is_edi_invoice() and doc.edi_format_id._is_required_for_invoice(move) for doc in move.edi_document_ids) + def _is_edi_invoice(self): + """To be overridden for special cases where entry types need to be sent. """ + self.ensure_one() + return self._get_edi_document_type() == 'invoice' + + def _get_edi_document_type(self, edi_format=None): + """Defines the document types that are exchanged through the EDI. """ + self.ensure_one() + if self.is_invoice(include_receipts=False): + return 'invoice' + elif self.payment_id or self.statement_line_id: + return 'payment' + #################################################### # Export Electronic Document #################################################### @@ -503,7 +516,7 @@ def _post(self, soft=True): edi_document_vals_list = [] for move in posted: for edi_format in move.journal_id.edi_format_ids: - is_edi_needed = move.is_invoice(include_receipts=False) and edi_format._is_required_for_invoice(move) + is_edi_needed = move._is_edi_invoice() and edi_format._is_required_for_invoice(move) if is_edi_needed: errors = edi_format._check_move_configuration(move) @@ -565,7 +578,7 @@ def button_cancel_posted_moves(self): if doc.edi_format_id._needs_web_services() \ and doc.attachment_id \ and doc.state == 'sent' \ - and move.is_invoice(include_receipts=True) \ + and move._is_edi_invoice() \ and doc.edi_format_id._is_required_for_invoice(move): to_cancel_documents |= doc is_move_marked = True @@ -582,7 +595,7 @@ def button_abandon_cancel_posted_posted_moves(self): is_move_marked = False for doc in move.edi_document_ids: if doc.state == 'to_cancel' \ - and move.is_invoice(include_receipts=True) \ + and move._is_edi_invoice() \ and doc.edi_format_id._is_required_for_invoice(move): documents |= doc is_move_marked = True diff --git a/addons/l10n_ec/__manifest__.py b/addons/l10n_ec/__manifest__.py index 6eef9b9bb97dd8..0c5ef7e8be8733 100644 --- a/addons/l10n_ec/__manifest__.py +++ b/addons/l10n_ec/__manifest__.py @@ -2,7 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. { "name": "Ecuadorian Accounting", - "version": "3.3", + "version": "3.4", "description": """ Functional ---------- @@ -32,10 +32,10 @@ * Ecuador banks * Partners: Consumidor Final, SRI, IESS, and also basic VAT validation """, - "author": "OPA CONSULTING & TRESCLOUD", + "author": "TRESCLOUD", "category": "Accounting/Localizations/Account Charts", - "maintainer": "OPA CONSULTING", - "website": "https://opa-consulting.com", + "maintainer": "TRESCLOUD", + "website": "https://www.trescloud.com", "license": "LGPL-3", "depends": [ "base", @@ -66,6 +66,8 @@ "data/l10n_latam.document.type.csv", "data/account_chart_template_configure_data.xml", "data/l10n_ec.sri.payment.csv", + # Views + "views/root_sri_menu.xml", "views/account_tax_view.xml", "views/l10n_latam_document_type_view.xml", "views/l10n_ec_sri_payment.xml", diff --git a/addons/l10n_ec/data/account.account.template.csv b/addons/l10n_ec/data/account.account.template.csv index b791c376a27a92..ab947880d93186 100644 --- a/addons/l10n_ec/data/account.account.template.csv +++ b/addons/l10n_ec/data/account.account.template.csv @@ -29,13 +29,13 @@ ec110401,110401,Seguros pagados por anticipado,TRUE,account.data_account_type_pr ec110402,110402,Arriendos pagados por anticipado,TRUE,account.data_account_type_prepayments,l10n_ec_ifrs ec110403,110403,Anticipos a proveedores,TRUE,account.data_account_type_prepayments,l10n_ec_ifrs ec_other_downpayments,11040401,Otros anticipos entregados,TRUE,account.data_account_type_prepayments,l10n_ec_ifrs -ec_purchase_vat,11050101,Iva pagado en compras locales,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs -ec_purchase_vat_assets,11050102,Iva pagado en compras locales de activos fijos,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs -ec_purchase_vat_service_imports,11050103,Iva pagado en importacion de servicios,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs -ec_purchase_vat_goods_imports,11050104,Iva pagado en importacion de bienes,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs -ec_purchase_vat_assets_imports,11050105,Iva pagado en importacion de activos fijos,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs -ec_sale_vat_outstanding_withholds,11050106,Iva pagado en retenciones de la fuente,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs -ec_purchase_vat_zero,11050107,Iva en compras 0%,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs +ec_purchase_vat,11050101,IVA pagado en compras locales,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs +ec_purchase_vat_assets,11050102,IVA pagado en compras locales de activos fijos,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs +ec_purchase_vat_service_imports,11050103,IVA pagado en importacion de servicios,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs +ec_purchase_vat_goods_imports,11050104,IVA pagado en importacion de bienes,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs +ec_purchase_vat_assets_imports,11050105,IVA pagado en importacion de activos fijos,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs +ec_sale_vat_outstanding_withholds,11050106,IVA pagado en retenciones de la fuente,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs +ec_purchase_vat_zero,11050107,IVA en compras 0%,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs ec110502,110502,Credito tributario a favor de la empresa(i.r.),FALSE,account.data_account_type_current_assets,l10n_ec_ifrs ec110503,110503,Anticipo de impuesto a la renta,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs ec_sale_profit_withhold,110504,Retenciones en la fuente pagadas,FALSE,account.data_account_type_current_assets,l10n_ec_ifrs @@ -132,11 +132,11 @@ ec2110,2110,Anticipos de clientes,TRUE,account.data_account_type_payable,l10n_ec ec2111,2111,Pasivos directamente asociados con los activos no corrientes y operaciones discontinuadas,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ec211201,211201,Otros beneficios a largo plazo para los empleados,TRUE,account.data_account_type_payable,l10n_ec_ifrs ec211301,211301,Retenciones judiciales,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_sale_vat,2114010101,Iva cobrado en ventas locales,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_sale_vat_assets,2114010102,Iva cobrado en ventas de activos fijos,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_sale_vat_goods_exports,2114010103,Iva cobrado en exportacion de bienes,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_sale_vat_services_exports,2114010104,Iva cobrado en exportacion de servicios,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_sale_vat_zero,2114010105,Iva en ventas 0%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_sale_vat,2114010101,IVA cobrado en ventas locales,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_sale_vat_assets,2114010102,IVA cobrado en ventas de activos fijos,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_sale_vat_goods_exports,2114010103,IVA cobrado en exportacion de bienes,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_sale_vat_services_exports,2114010104,IVA cobrado en exportacion de servicios,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_sale_vat_zero,2114010105,IVA en ventas 0%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ret_ir_1x100,2114010201,Retenciones de la fuente 1%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ret_ir_1_75x100,2114010202,Retenciones de la fuente 1.75%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ret_ir_2x100,2114010203,Retenciones de la fuente 2%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs @@ -147,12 +147,12 @@ ret_ir_10x100,2114010207,Retenciones de la fuente 10%,FALSE,account.data_account ret_ir_15x100,2114010208,Retenciones de la fuente 15%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ret_ir_22x100,2114010209,Retenciones de la fuente 22%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ret_ir_others,2114010210,Otras retenciones,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_vat_withhold_10,2114010301,Retenciones de iva 10%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_vat_withhold_20,2114010302,Retenciones de iva 20%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_vat_withhold_30,2114010303,Retenciones de iva 30%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_vat_withhold_50,2114010304,Retenciones de iva 50%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_vat_withhold_70,2114010305,Retenciones de iva 70%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs -ec_vat_withhold_100,2114010306,Retenciones de iva 100%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_vat_withhold_10,2114010301,Retenciones de IVA 10%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_vat_withhold_20,2114010302,Retenciones de IVA 20%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_vat_withhold_30,2114010303,Retenciones de IVA 30%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_vat_withhold_50,2114010304,Retenciones de IVA 50%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_vat_withhold_70,2114010305,Retenciones de IVA 70%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs +ec_vat_withhold_100,2114010306,Retenciones de IVA 100%,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ec_vat_withhold_others,2114010307,Otras retenciones,FALSE,account.data_account_type_current_liabilities,l10n_ec_ifrs ec2201,2201,Pasivos por contratos de arrendamiento financiero,TRUE,account.data_account_type_payable,l10n_ec_ifrs ec220201,220201,Cuentas y documentos por pagar locales,TRUE,account.data_account_type_payable,l10n_ec_ifrs diff --git a/addons/l10n_ec/data/account_chart_template_setup_accounts.xml b/addons/l10n_ec/data/account_chart_template_setup_accounts.xml index 01642c130743d8..5fbd8504576158 100644 --- a/addons/l10n_ec/data/account_chart_template_setup_accounts.xml +++ b/addons/l10n_ec/data/account_chart_template_setup_accounts.xml @@ -3,7 +3,7 @@ - Plan Contable NIIF Ecuador conforme Superintendencia de Compañías + Ecuador - Plan Cuentas NIIF SupCias diff --git a/addons/l10n_ec/data/account_fiscal_position_template.xml b/addons/l10n_ec/data/account_fiscal_position_template.xml index 981600d6c9db16..ef68f3c23efe4e 100644 --- a/addons/l10n_ec/data/account_fiscal_position_template.xml +++ b/addons/l10n_ec/data/account_fiscal_position_template.xml @@ -1,55 +1,38 @@ - - - Sociedades - personas juridicas - - - - Contribuyentes especiales - - - - Sector publico y ep - - - - Persona natural obligada a llevar contabilidad - - - - Persona natural no obligada - arriendos - - - - Persona natural no obligada - profesionales - - - - Persona natural no obligada - liquidaciones de compras - - - - Persona natural no obligadas - emite factura o nota de venta - - - - Empresa extranjera - venta local - - - - Persona extranjera - venta local - - - - Empresa extranjera - exportacion - - - - Persona extranjera - exportacion - - - - Otras - sin cálculo automático de retención de iva - + + 10 + + Régimen nacional + + + + + + 20 + + Régimen extranjero + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/l10n_ec/data/account_group_template_data.xml b/addons/l10n_ec/data/account_group_template_data.xml index dc63ae475a4666..7796607688969d 100644 --- a/addons/l10n_ec/data/account_group_template_data.xml +++ b/addons/l10n_ec/data/account_group_template_data.xml @@ -118,7 +118,7 @@ 110501 - Credito tributario a favor de la empresa(iva) + Credito tributario a favor de la empresa(IVA) @@ -299,7 +299,7 @@ 21140101 - Iva cobrado + IVA cobrado @@ -313,7 +313,7 @@ 21140103 - Retenciones de iva + Retenciones de IVA diff --git a/addons/l10n_ec/data/account_tax_group_data.xml b/addons/l10n_ec/data/account_tax_group_data.xml index 72b32429fe9819..72b0e426a05438 100644 --- a/addons/l10n_ec/data/account_tax_group_data.xml +++ b/addons/l10n_ec/data/account_tax_group_data.xml @@ -2,6 +2,13 @@ + + VAT 8% + vat08 + 5 + + + VAT 12% vat12 @@ -52,19 +59,47 @@ - VAT Withhold + VAT Withhold (Deprecated) withhold_vat 80 - Profit Withhold + Profit Withhold (Deprecated) withhold_income_tax 90 + + VAT Withhold on Sales + withhold_vat_sale + 80 + + + + + VAT Withhold on Purchases + withhold_vat_purchase + 80 + + + + + Profit Withhold on Sales + withhold_income_sale + 90 + + + + + Profit Withhold on Purchases + withhold_income_purchase + 95 + + + Exchange Outflows outflows_tax diff --git a/addons/l10n_ec/data/account_tax_report_data.xml b/addons/l10n_ec/data/account_tax_report_data.xml index 60910f62a3a7fb..838ec3a93a46c7 100644 --- a/addons/l10n_ec/data/account_tax_report_data.xml +++ b/addons/l10n_ec/data/account_tax_report_data.xml @@ -296,6 +296,15 @@ 1 + + Valor neto(441) + c441 + 441 (Reporte 104) + + + 1 + + Impuesto generado(429) c429 diff --git a/addons/l10n_ec/data/account_tax_template_vat_data.xml b/addons/l10n_ec/data/account_tax_template_vat_data.xml index b2312f9035bb90..4e8abdff38c5f5 100644 --- a/addons/l10n_ec/data/account_tax_template_vat_data.xml +++ b/addons/l10n_ec/data/account_tax_template_vat_data.xml @@ -2,14 +2,51 @@ - - - Iva 12% + + + IVA 12% (Bienes) sale percent - 9 + 10 + 12.0 + IVA 12% + 411 + 421 + + + + + + + + IVA 12% (Servicios) + sale + percent + 20 12.0 IVA 12% 411 @@ -42,11 +79,11 @@ })]"/> - - Iva 12% (activos) + + IVA 12% (Activos) sale percent - 10 + 30 12.0 IVA 12% 412 @@ -69,21 +106,55 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'minus_report_line_ids': [ref('tax_report_line_104_411')], + 'minus_report_line_ids': [ref('tax_report_line_104_412')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', 'account_id': ref('l10n_ec.ec_sale_vat'), - 'minus_report_line_ids': [ref('tax_report_line_104_421')], + 'minus_report_line_ids': [ref('tax_report_line_104_422')], + })]"/> + + + + IVA 0% (Bienes) + sale + percent + 40 + 0.0 + IVA 0% + 415 + + + + - - - Iva 0% + + + IVA 0% (Servicios) sale percent - 19 + 50 0.0 IVA 0% 415 @@ -113,11 +184,11 @@ })]"/> - - Iva 0% (activos) + + IVA 0% (Activos) sale percent - 20 + 60 0.0 IVA 0% 416 @@ -127,7 +198,7 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_line_104_414')], + 'plus_report_line_ids': [ref('tax_report_line_104_416')], }), (0,0, { 'factor_percent': 100, @@ -138,7 +209,7 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'minus_report_line_ids': [ref('tax_report_line_104_414')], + 'minus_report_line_ids': [ref('tax_report_line_104_416')], }), (0,0, { 'factor_percent': 100, @@ -147,11 +218,11 @@ })]"/> - - Iva 0% (sin crédito tributario) + + IVA 0% (Sin Crédito Tributario) sale percent - 20 + 70 0.0 IVA 0% 413 @@ -181,11 +252,11 @@ })]"/> - - Iva 0% (activos sin crédito tributario) + + IVA 0% (Activos Sin Crédito Tributario) sale percent - 20 + 80 0.0 IVA 0% 414 @@ -215,11 +286,11 @@ })]"/> - - Iva 0% (exportación bienes) + + IVA 0% (Exportación Bienes) sale percent - 21 + 90 0.0 IVA 0% 417 @@ -249,11 +320,11 @@ })]"/> - - Iva 0% (exportación servicios) + + IVA 0% (Exportación Servicios) sale percent - 21 + 100 0.0 IVA 0% 418 @@ -282,23 +353,22 @@ 'account_id': ref('l10n_ec.ec_sale_vat_services_exports'), })]"/> - - - Iva 0% (no objeto/exentas) + + + IVA 0% (No Objeto/Exentas) sale percent - 40 + 110 0.0 IVA EXENTO - 419 - + 441 - - Iva 12% (reembolso) + + IVA 12% (Reembolsos) sale percent - 10 + 120 12.0 IVA 12% 444 @@ -345,7 +415,7 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'minus_report_line_ids': [ref('tax_report_line_104_411')], + 'minus_report_line_ids': [ref('tax_report_line_104_444')], }), (0,0, { 'factor_percent': 100, @@ -354,9 +424,11 @@ 'minus_report_line_ids': [ref('tax_report_line_104_421')], })]"/> - - - Iva 12% + + + + + IVA 12% (510, 01 Crédito IVA) purchase percent 9 @@ -391,9 +463,195 @@ 'minus_report_line_ids': [ref('tax_report_line_104_520')], })]"/> - - - Iva 12% (activos) + + + IVA 12% (510, 05 Liq. Viaje Gasto IR) + purchase + percent + 9 + 12.0 + IVA 12% + 510 + 520 + + + + + + + + IVA 12% (510, 06 Inventario Crédito IVA) + purchase + percent + 9 + 12.0 + IVA 12% + 510 + 520 + + + + + + + + IVA 12% (510, 09 Reembolso Siniestro) + purchase + percent + 9 + 12.0 + IVA 12% + 510 + 520 + + + + + + + + IVA 12% (510, 15 Servicios Digitales) + purchase + percent + 9 + 12.0 + IVA 12% + 510 + 520 + + + + + + + + + IVA 12% (511, 03 Activos Crédito IVA) + purchase + percent + 10 + 12.0 + IVA 12% + 511 + 521 + + + + + + + + IVA 12% (511, 04 Activos Costo IR) purchase percent 10 @@ -428,9 +686,79 @@ 'minus_report_line_ids': [ref('tax_report_line_104_521')], })]"/> - - - Iva 12% (sin crédito tributario) + + + IVA 12% (512, 02 Costo IR) + purchase + percent + 10 + 12.0 + IVA 12% + 512 + 522 + + + + + + + + IVA 12% (512, 07 Inventario Costo IR) + purchase + percent + 10 + 12.0 + IVA 12% + 512 + 522 + + + + + + + + IVA 12% (512, 09 Reembolso Siniestro) purchase percent 10 @@ -463,9 +791,9 @@ 'minus_report_line_ids': [ref('tax_report_line_104_522')], })]"/> - - - Iva 12% (importación servicios) + + + IVA 12% (importación servicios) purchase percent 10 @@ -500,9 +828,9 @@ 'minus_report_line_ids': [ref('tax_report_line_104_523')], })]"/> - - - Iva 12% (importación bienes) + + + IVA 12% (514, 06 Inventario Crédito IVA) purchase percent 10 @@ -537,9 +865,46 @@ 'minus_report_line_ids': [ref('tax_report_line_104_524')], })]"/> - - - Iva 12% (importación activos) + + + IVA 12% (514, 07 Inventario Costo IR) + purchase + percent + 10 + 12.0 + IVA 12% + 514 + 524 + + + + + + + + IVA 12% (515, 03 Activos Crédito IVA) purchase percent 10 @@ -574,9 +939,44 @@ 'minus_report_line_ids': [ref('tax_report_line_104_525')], })]"/> - - - Iva 0% + + + + IVA 0% (517, 02 Costo IR) + purchase + percent + 20 + 0.0 + IVA 0% + 517 + + + + + + + + IVA 0% (517, 04 Activos Costo IR) purchase percent 20 @@ -607,24 +1007,23 @@ 'repartition_type': 'tax', 'account_id': ref('l10n_ec.ec_purchase_vat_zero'), })]"/> - - - - Iva 0% (importación bienes) + + + IVA 0% (517, 05 Liq. Viaje Gasto IR) purchase percent 20 0.0 IVA 0% - 516 + 517 - - - Iva 0% (rise) + + + IVA 0% (517, 07 Inventario Costo IR) purchase percent 20 0.0 IVA 0% - 518 + 517 - - - Iva 0% (no objeto de iva) + + + IVA 0% (517, 15 Servicios Digitales) purchase percent + 20 + 0.0 + IVA 0% + 517 + + + + + + + + + No Objeto IVA 0% (541, 02 Costo IR) + percent 30 0.0 - NO OBJETO DE IVA + IVA 0% 541 - + - - - Iva 0% (excento de iva) + + IVA 8% + purchase + percent + 50 + 8.0 + IVA 8% + 510 + 520 + + + + + + + + Exento IVA 0% (542, 02 Costo IR) purchase percent 40 @@ -746,8 +1215,8 @@ })]"/> - - Iva 12% (reembolso intermediario) + + IVA 12% (Reembolso Intermediario) purchase percent 10 diff --git a/addons/l10n_ec/data/account_tax_template_withhold_profit_data.xml b/addons/l10n_ec/data/account_tax_template_withhold_profit_data.xml index 8c282fb8f48ced..f6f832d1af7bfb 100644 --- a/addons/l10n_ec/data/account_tax_template_withhold_profit_data.xml +++ b/addons/l10n_ec/data/account_tax_template_withhold_profit_data.xml @@ -2,11 +2,11 @@ + Purchase withholds over anticipaded profit *impuesto a la renta + --> - 303 10% honorarios profesionales y demas pagos por servicios relacionados con el titulo profesional - purchase + 303 10% Honorarios Profesionales y Demás Pagos por Servicios Relacionados con el Titulo Profesional + none percent 70 -10.0 @@ -15,7 +15,7 @@ 303 303 - + - 304 8% servicios predomina el intelecto no relacionados con el titulo profesional - purchase + 304 8% Servicios Predomina el Intelecto No Relacionados con el Titulo Profesional + none percent 70 -8.0 @@ -52,7 +52,7 @@ 304 304 - + - 304a 8% comisiones y demas pagos por servicios predomina intelecto no relacionados con el titulo profesional - purchase + 304A 8% Comisiones y Demas Pagos por Servicios Predomina Intelecto No Relacionados con el Titulo Profesional + none percent 70 -8.0 @@ -89,7 +89,7 @@ 304 304A - + - 304b 8% pagos a notarios y registradores de la propiedad y mercantil por sus actividades ejercidas como tales - purchase + 304B 8% Pagos a Notarios y Registradores de la Propiedad y Mercantil por sus Actividades Ejercidas Como Tales + none percent 70 -8.0 @@ -126,7 +126,7 @@ 304 304B - + - 304c 8% pagos a deportistas, entrenadores, arbitros, miembros del cuerpo tecnico por sus actividades ejercidas como tales - purchase + 304C 8% Pagos a Deportistas, Entrenadores, Arbitros, Miembros del Cuerpo Tecnico por sus Actividades Ejercidas Como Tales + none percent 70 -8.0 @@ -163,7 +163,7 @@ 304 304C - + - 304d 8% pagos a artistas por sus actividades ejercidas como tales - purchase + 304D 8% Pagos a Artistas por sus Actividades Ejercidas Como Tales + none percent 70 -8.0 @@ -200,7 +200,7 @@ 304 304D - + - 304e 8% honorarios y demas pagos por servicios de docencia - purchase + 304E 8% Honorarios y Demas Pagos por Servicios de Docencia + none percent 70 -8.0 @@ -237,7 +237,7 @@ 304 304E - + - 307 2% servicios predomina mano de obra - purchase + 307 2% Servicios Predomina Mano de Obra + none percent 70 -2.0 @@ -274,7 +274,7 @@ 307 307 - + - 308 10% utilizacion o aprovechamiento de la imagen o renombre - purchase + 308 10% Utilizacion o Aprovechamiento de la Imagen o Renombre + none percent 70 -10.0 @@ -311,7 +311,7 @@ 308 308 - + - 309 1.75% servicios prestados por medios de comunicación y agencias de publicidad - purchase + 309 1.75% Servicios Prestados por Medios de Comunicación y Agencias de Publicidad + none percent 70 -1.75 @@ -348,7 +348,7 @@ 309 309 - + - 310 1% servicio de transporte privado de pasajeros o transporte publico o privado de carga - purchase + 310 1% Servicio de Transporte Privado de Pasajeros o Transporte Publico o Privado de Carga + none percent 70 -1.0 @@ -385,7 +385,7 @@ 310 310 - + - 311 2% por pagos a traves de liquidacion de compra (nivel cultural o rusticidad) - purchase + 311 2% Por Pagos a Traves de Liquidacion de Compra (nivel cultural o rusticidad) + none percent 70 -2.0 @@ -422,7 +422,7 @@ 311 311 - + - 312 1.75% transferencia de bienes muebles de naturaleza corporal - purchase + 312 1.75% Transferencia de Bienes Muebles de Naturaleza Corporal + none percent 70 -1.75 @@ -459,7 +459,7 @@ 312 312 - + - 312a 1% compra de bienes de origen agricola, avicola, pecuario, apicola, cunicula, bioacuatico, y forestal - purchase + 312A 1% Compra de Bienes de Origen Agricola, Avicola, Pecuario, Apicola, Cunicula, Bioacuatico, y Forestal + none percent 70 -1.0 @@ -496,7 +496,7 @@ 312 312A - + - 314a 8% regalias por concepto de franquicias de acuerdo a ley de propiedad intelectual - pago a personas naturales - purchase + 314A 8% Regalias por Concepto de Franquicias de Acuerdo a Ley de Propiedad Intelectual - Pago a Personas Naturales + none percent 70 -8.0 @@ -533,7 +533,7 @@ 314 314A - + - 314b 8% casales, derechos de autor, marcas, patentes y similares de acuerdo a ley de propiedad intelectual – pago a personas naturales - purchase + 314B 8% Casales, Derechos de Autor, Marcas, Patentes y Similares de Acuerdo a Ley de Propiedad Intelectual – Pago a Personas Naturales + none percent 70 -8.0 @@ -570,7 +570,7 @@ 314 314B - + - 314c 8% regalias por concepto de franquicias de acuerdo a ley de propiedad intelectual - pago a sociedades - purchase + 314C 8% Regalias por Concepto de Franquicias de Acuerdo a Ley de Propiedad Intelectual - Pago a Sociedades + none percent 70 -8.0 @@ -607,7 +607,7 @@ 314 314C - + - 314d 8% casales, derechos de autor, marcas, patentes y similares de acuerdo a ley de propiedad intelectual – pago a sociedades - purchase + 314D 8% Casales, Derechos de Autor, Marcas, Patentes y Similares de Acuerdo a Ley de Propiedad Intelectual – Pago a Sociedades + none percent 70 -8.0 @@ -644,7 +644,7 @@ 314 314D - + - 319 1.75% cuotas de arrendamiento mercantil (prestado por sociedades), inclusive la de opción de compra - purchase + 319 1.75% Cuotas de Arrendamiento Mercantil (Prestado por Sociedades), Inclusive la de Opción de Compra + none percent 70 -1.75 @@ -681,7 +681,7 @@ 319 319 - + - 320 8% por arrendamiento bienes inmuebles - purchase + 320 8% Por Arrendamiento Bienes Inmuebles + none percent 70 -8.0 @@ -718,7 +718,7 @@ 320 320 - + - 322 1.75% seguros y reaseguros (primas y cesiones) 1.75% - purchase + 322 1.75% Seguros y Reaseguros (Primas y Cesiones) 1.75% + none percent 70 -1.75 @@ -755,7 +755,7 @@ 322 322 - + - 332 0% otras compras de bienes y servicios no sujetas a retencion - purchase + 332 0% Otras Compras de Bienes y Servicios No Sujetas a Retencion + none percent 70 0.0 @@ -791,7 +791,7 @@ 332 332 - + - 332a 0% enajenacion de derechos representativos de capital y otros derechos exentos (mayo 2016) - purchase + 332A 0% Enajenacion de Derechos Representativos de Capital y Otros Derechos Exentos (mayo 2016) + none percent 70 0.0 @@ -825,7 +825,7 @@ 332 332A - + - 332b 0% compra de bienes inmuebles - purchase + 332B 0% Compra de Bienes Inmuebles + none percent 70 0.0 @@ -859,7 +859,7 @@ 332 332B - + - 332c 0% transporte publico de pasajeros - purchase + 332C 0% Transporte Publico de Pasajeros + none percent 70 0.0 @@ -893,7 +893,7 @@ 332 332C - + - 332d 0% pagos en el pais por transporte de pasajeros o transporte internacional de carga, a compañias nacionales o extranjeras de aviacion o maritimas - purchase + 332D 0% Pagos en el Pais por Transporte de Pasajeros o Transporte Internacional de Carga, a Compañias Nacionales o Extranjeras de Aviacion o Maritimas + none percent 70 0.0 @@ -927,7 +927,7 @@ 332 332D - + - 332g 0% pagos con tarjeta de credito - purchase + 332G 0% Pagos con Tarjeta de Credito + none percent 70 0.0 @@ -961,7 +961,7 @@ 332 332G - + - 332i 0% pagos a través de convenios de débito (clientes ifi`s) - purchase + 332I 0% Pagos a Través de Convenios de Débito (clientes ifi`s) + none percent 70 0.0 @@ -995,7 +995,7 @@ 332 332I - + + + 343 1% Otras Retenciones Aplicables el 1% (Incluye régimen RIMPE) + none + percent + 70 + -1.0 + Otras 1% + 393 + 343 + 343 + + + + + - 343a 1% por energia electrica - purchase + 343A 1% Por Energia Electrica + none percent 70 -1.0 @@ -1030,7 +1067,7 @@ 343 343A - + - 343b 1% por actividades de construccion de obra material inmueble, urbanizacion, lotizacion o actividades similares - purchase + 343B 1% Por Actividades de Construccion de Obra Material Inmueble, Urbanizacion, Lotizacion o Actividades Similares + none percent 70 -1.0 @@ -1067,7 +1104,7 @@ 343 343B - + - 3440 2.75% otras retenciones aplicables el 2,75% - purchase + 3440 2.75% Otras Retenciones Aplicables el 2,75% + none percent 70 - -2.0 + -2.75 3440 394 3440 3440 - + - 346 1.75% microempresas (otras retenciones aplicables a otros porcentajes) - purchase + 346 1.75% Microempresas (Otras retenciones aplicables a otros porcentajes) + none percent 70 -1.75 @@ -1141,35 +1178,35 @@ 346 346 - + - 347-346 2% donaciones en dinero -impuesto a la donaciones - purchase + 347-346 2% Donaciones en Dinero -Impuesto a las Donaciones + none percent 70 -2.0 @@ -1178,7 +1215,7 @@ 346 347 - + - 501-411 22% pago al exterior - beneficios empresariales (con convenio de doble tributación) - purchase + 501-411 22% Pago al Exterior - Beneficios Empresariales (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1215,7 +1252,7 @@ 411 501 - + - 501-422 22% pago al exterior - beneficios empresariales (sin convenio de doble tributación) - purchase + 501-422 22% Pago al Exterior - Beneficios Empresariales (Sin Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1252,7 +1289,7 @@ 422 501 - + - 502-411 22% pago al exterior - servicios empresariales (con convenio de doble tributación) - purchase + 502-411 22% Pago al Exterior - Servicios Empresariales (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1289,7 +1326,7 @@ 411 502 - + - 502-422 22% pago al exterior - servicios empresariales (sin convenio de doble tributación) - purchase + 502-422 22% Pago al Exterior - Servicios Empresariales (Sin Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1326,7 +1363,7 @@ 422 502 - + - 509-411 22% pago al exterior - casales, derechos de autor, marcas, patentes y similares (con convenio de doble tributación) - purchase + 509-411 22% Pago al Exterior - Casales, Derechos de Autor, Marcas, Patentes y Similares (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1363,7 +1400,7 @@ 461 509 - + - 509-422 pago al exterior - casales, derechos de autor, marcas, patentes y similares (sin convenio de doble tributación) - purchase + 509-422 Pago al Exterior - Casales, Derechos de Autor, Marcas, Patentes y Similares (Sin Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1400,7 +1437,7 @@ 472 509 - + - 511-411 22% pago al exterior - servicios profesionales independientes (con convenio de doble tributación) - purchase + 511-411 22% Pago al Exterior - Servicios Profesionales Independientes (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1437,7 +1474,7 @@ 461 511 - + - 512-411 22% pago al exterior - servicios profesionales dependientes (con convenio de doble tributación) - purchase + 512-411 22% Pago al Exterior - Servicios Profesionales Dependientes (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1474,7 +1511,7 @@ 461 512 - + - 517-411 22% pago al exterior - reembolso de gastos (con convenio de doble tributación) - purchase + 517-411 22% Pago al Exterior - Reembolso de Gastos (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1511,7 +1548,7 @@ 461 517 - + - 520d-411 22% pago al exterior - comisiones por exportaciones y por promocion de turismo receptivo (con convenio de doble tributación) - purchase + 520D-411 22% Pago al Exterior - Comisiones por Exportaciones y Por Promocion de Turismo Receptivo (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1548,7 +1585,7 @@ 461 520D - + - 522a-410 22% pago al exterior - servicios tecnicos, administrativos o de consultoria y regalias con convenio de doble tributacion (con convenio de doble tributación) - purchase + 522A-410 22% Pago al Exterior - Servicios Tecnicos, Administrativos o de Consultoria y Regalias (Con Convenio de Doble Tributación) + none percent 70 -22.0 @@ -1585,7 +1622,7 @@ 460 522A - + + + 352 En relación de Dependencia que Supera o no la Base Desgravada + percent + none + 352 + 302 + 352 + -22.0 + 352 + + 70 + + + + + Sales withholds over anticipaded profit *impuesto a la renta venta + --> - 1% retenciones de la fuente - sale + 1% Retenciones de la Fuente + none percent 70 -1.0 1% - + - 1.75% retenciones de la fuente - sale + 1.75% Retenciones de la Fuente + none percent 70 -1.75 1.75% - + - 2% retenciones de la fuente - sale + 2% Retenciones de la Fuente + none percent 70 -2.0 2% - + - 2.75% retenciones de la fuente - sale + 2.75% Retenciones de la Fuente + none percent 70 -2.75 2.75% - + - 5% retenciones de la fuente - sale + 5% Retenciones de la Fuente + none percent 70 -5.0 5% - + - 8% retenciones de la fuente - sale + 8% Retenciones de la Fuente + none percent 70 -8.0 8% - + - 10% retenciones de la fuente - sale + 10% Retenciones de la Fuente + none percent 70 -10.0 10% - + - 15% retenciones de la fuente - sale + 15% Retenciones de la Fuente + none percent 70 -15.0 15% - + - 22% retenciones de la fuente - sale + 22% Retenciones de la Fuente + none percent 70 -22.0 22% - + diff --git a/addons/l10n_ec/data/account_tax_template_withhold_vat_data.xml b/addons/l10n_ec/data/account_tax_template_withhold_vat_data.xml index ebbc0f836829bb..5220577ca5e373 100644 --- a/addons/l10n_ec/data/account_tax_template_withhold_vat_data.xml +++ b/addons/l10n_ec/data/account_tax_template_withhold_vat_data.xml @@ -2,25 +2,25 @@ - Retencion iva 10% - purchase + 10% Retención IVA + none percent 50 -10.0 RET IVA 10% 721 - + - Retencion iva 20% - purchase + 20% Retención IVA + none percent 50 -20.0 RET IVA 20% 723 - + - Retencion iva 30% - purchase + 30% Retención IVA + none percent 50 -30.0 RET IVA 30% 725 - + - Retencion iva 50% - purchase + 50% Retención IVA + none percent 50 -50.0 RET IVA 50% 727 - + - Retencion iva 70% - purchase + 70% Retención IVA + none percent 50 -70.0 RET IVA 70% 729 - + - Retencion iva 100% - purchase + 100% Retención IVA + none percent 50 -100.0 RET IVA 100% 731 - + - Retencion iva 10% - sale + 10% Retención IVA + none percent 60 -10.0 RET IVA 10% 609 - + - Retencion iva 20% - sale + 20% Retención IVA + none percent 60 -20.0 RET IVA 20% 609 - + - Retencion iva 30% - sale + 30% Retención IVA + none percent 60 -30.0 RET IVA 30% 609 - + - Retencion iva 50% - sale + 50% Retención IVA + none percent 60 -50.0 RET IVA 50% 609 - + - Retencion iva 70% - sale + 70% Retención IVA + none percent 60 -70.0 RET IVA 70% 609 - + - Retencion iva 100% - sale + 100% Retención IVA + none percent 60 -100.0 RET IVA 100% 609 - + RUC - Registre Unico de Contribuyente + Registro Unico de Contribuyente 10 diff --git a/addons/l10n_ec/demo/account_demo.py b/addons/l10n_ec/demo/account_demo.py index ad464f1d8a328b..5c7e7ff129a533 100644 --- a/addons/l10n_ec/demo/account_demo.py +++ b/addons/l10n_ec/demo/account_demo.py @@ -15,7 +15,7 @@ def _get_demo_data_move(self): cid = self.env.company.id model, data = super()._get_demo_data_move() if self.env.company.account_fiscal_country_id.code == 'EC': - document_type = ref('l10n_ec.ec_dt_18', False) and ref('l10n_ec.ec_dt_18').id or False + document_type = ref('l10n_ec.ec_dt_01', False) and ref('l10n_ec.ec_dt_01').id or False data[f'{cid}_demo_invoice_1']['l10n_latam_document_type_id'] = document_type data[f'{cid}_demo_invoice_2']['l10n_latam_document_type_id'] = document_type data[f'{cid}_demo_invoice_3']['l10n_latam_document_type_id'] = document_type diff --git a/addons/l10n_ec/demo/demo_company.xml b/addons/l10n_ec/demo/demo_company.xml index 9291861d1313db..26a3314a280fcc 100644 --- a/addons/l10n_ec/demo/demo_company.xml +++ b/addons/l10n_ec/demo/demo_company.xml @@ -2,8 +2,8 @@ EC Company - 2067636473651 - A + 2067636473001 + Av. de las Americas 505 Quito diff --git a/addons/l10n_ec/migrations/3.4/post-migration.py b/addons/l10n_ec/migrations/3.4/post-migration.py new file mode 100644 index 00000000000000..d9a54f92c45028 --- /dev/null +++ b/addons/l10n_ec/migrations/3.4/post-migration.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +from odoo import api, SUPERUSER_ID + +def update_withhold_type(env): + # reclassifies withhold taxes into independent tax groups for sales and purchases + env.cr.execute(''' + UPDATE account_tax + SET tax_group_id=t.id FROM (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_vat_sale') AS t + WHERE account_tax.id IN (SELECT id FROM account_tax WHERE tax_group_id IN (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_vat') AND type_tax_use='sale') + ''') + env.cr.execute(''' + UPDATE account_tax + SET tax_group_id=t.id FROM (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_vat_purchase') AS t + WHERE account_tax.id IN (SELECT id FROM account_tax WHERE tax_group_id IN (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_vat') AND type_tax_use='purchase') + ''') + env.cr.execute(''' + UPDATE account_tax + SET tax_group_id=t.id FROM (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_income_sale') AS t + WHERE account_tax.id IN (SELECT id FROM account_tax WHERE tax_group_id IN (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_income_tax') AND type_tax_use='sale') + ''') + env.cr.execute(''' + UPDATE account_tax + SET tax_group_id=t.id FROM (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_income_purchase') AS t + WHERE account_tax.id IN (SELECT id FROM account_tax WHERE tax_group_id IN (SELECT id FROM account_tax_group WHERE l10n_ec_type='withhold_income_tax') AND type_tax_use='purchase') + ''') + +def update_type_tax_use(env): + # sets type_tax_use = none for withholding taxes + env.cr.execute(''' + UPDATE account_tax + SET type_tax_use = 'none' + WHERE tax_group_id IN (SELECT id FROM account_tax_group WHERE l10n_ec_type IN ('withhold_income_purchase','withhold_vat_purchase','withhold_income_sale','withhold_vat_sale')) + ''') + +def update_vat_withhold_base_percent(env): + # For vat withhold taxes, replace factor_percent=12% with factor_percent=100% + env.cr.execute(''' + --for invoice_tax_id + UPDATE account_tax_repartition_line + SET factor_percent = 100 + WHERE factor_percent = 12 + AND repartition_type = 'tax' + AND invoice_tax_id in ( + SELECT id + FROM account_tax + WHERE country_id = (SELECT id FROM res_country WHERE code = 'EC' LIMIT 1) --Country is Ecuador) + AND tax_group_id IN ( + SELECT id FROM account_tax_group WHERE l10n_ec_type IN ('withhold_vat_sale','withhold_vat_purchase') + ) + ) + ''') + env.cr.execute(''' + --for refund_tax_id + UPDATE account_tax_repartition_line + SET factor_percent = 100 + WHERE factor_percent = 12 + AND repartition_type = 'tax' + AND refund_tax_id in ( + SELECT id + FROM account_tax + WHERE country_id = (SELECT id FROM res_country WHERE code = 'EC' LIMIT 1) --Country is Ecuador) + AND tax_group_id IN ( + SELECT id FROM account_tax_group WHERE l10n_ec_type IN ('withhold_vat_sale','withhold_vat_purchase') + ) + ) + ''') + +def migrate(cr, version): + env = api.Environment(cr, SUPERUSER_ID, {}) + update_withhold_type(env) + update_type_tax_use(env) + update_vat_withhold_base_percent(env) diff --git a/addons/l10n_ec/models/__init__.py b/addons/l10n_ec/models/__init__.py index e7991db73a20b9..41c8372cea439a 100644 --- a/addons/l10n_ec/models/__init__.py +++ b/addons/l10n_ec/models/__init__.py @@ -9,3 +9,4 @@ from . import account_tax_group from . import res_company from . import account_journal +from . import account_chart_template diff --git a/addons/l10n_ec/models/account_chart_template.py b/addons/l10n_ec/models/account_chart_template.py new file mode 100644 index 00000000000000..4abbac82820705 --- /dev/null +++ b/addons/l10n_ec/models/account_chart_template.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models + + +class AccountChartTemplate(models.Model): + _inherit = "account.chart.template" + + def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None): + res = super(AccountChartTemplate, self)._prepare_all_journals(acc_template_ref, company, journals_dict=journals_dict) + for r in res: + if r.get('code') == 'INV': + r.update({'name': '001-001 ' + r.get('name'), + 'l10n_ec_entity': '001', + 'l10n_ec_emission': '001', + 'l10n_ec_emission_address_id': company.partner_id.id, + }) + return res diff --git a/addons/l10n_ec/models/account_journal.py b/addons/l10n_ec/models/account_journal.py index 6ee5e541317eb1..58f607152ed530 100644 --- a/addons/l10n_ec/models/account_journal.py +++ b/addons/l10n_ec/models/account_journal.py @@ -1,18 +1,28 @@ -from odoo import fields, models +from odoo import api, fields, models class AccountJournal(models.Model): - _inherit = "account.journal" - l10n_ec_entity = fields.Char(string="Emission Entity", size=3, default="001") - l10n_ec_emission = fields.Char(string="Emission Point", size=3, default="001") + @api.depends('type', 'l10n_latam_use_documents') + def _compute_l10n_ec_require_emission(self): + # True when there should be an entity and emission point + l10n_ec_require_emission = False + if self.country_code == 'EC' and self.l10n_latam_use_documents: + if self.type == 'sale': + l10n_ec_require_emission = True + self.l10n_ec_require_emission = l10n_ec_require_emission + + l10n_ec_require_emission = fields.Boolean(string='Require Emission', compute='_compute_l10n_ec_require_emission') + l10n_ec_entity = fields.Char(string="Emission Entity", size=3, copy=False) + l10n_ec_emission = fields.Char(string="Emission Point", size=3, copy=False) l10n_ec_emission_address_id = fields.Many2one( comodel_name="res.partner", string="Emission address", domain="['|', ('id', '=', company_partner_id), '&', ('id', 'child_of', company_partner_id), ('type', '!=', 'contact')]", ) + #TODO: Deprecate field in master as is it has no use l10n_ec_emission_type = fields.Selection( string="Emission type", selection=[ diff --git a/addons/l10n_ec/models/account_move.py b/addons/l10n_ec/models/account_move.py index 9e2de178520d5b..f3c47cadfcf35b 100644 --- a/addons/l10n_ec/models/account_move.py +++ b/addons/l10n_ec/models/account_move.py @@ -46,9 +46,9 @@ 'ec_dt_344' ], "04": [ + 'ec_dt_01', 'ec_dt_04', 'ec_dt_05', - 'ec_dt_18', 'ec_dt_41', 'ec_dt_44', 'ec_dt_47', @@ -63,9 +63,9 @@ 'ec_dt_373' ], "05": [ + 'ec_dt_01', 'ec_dt_04', 'ec_dt_05', - 'ec_dt_18', 'ec_dt_41', 'ec_dt_44', 'ec_dt_47', @@ -76,9 +76,9 @@ 'ec_dt_373' ], "06": [ + 'ec_dt_01', 'ec_dt_04', 'ec_dt_05', - 'ec_dt_18', 'ec_dt_41', 'ec_dt_44', 'ec_dt_47', @@ -89,9 +89,9 @@ 'ec_dt_373' ], "07": [ + 'ec_dt_01', 'ec_dt_04', 'ec_dt_05', - 'ec_dt_18' ], "09": [ 'ec_dt_01', @@ -134,44 +134,40 @@ class AccountMove(models.Model): string="Payment Method (SRI)", ) - def _get_l10n_ec_identification_type(self): + def _get_l10n_ec_ats_identification_type(self): + # Helps filter out document types based on subset of Table 2 of SRI's ATS specification self.ensure_one() - move = self - it_ruc = self.env.ref("l10n_ec.ec_ruc", False) - it_dni = self.env.ref("l10n_ec.ec_dni", False) - it_passport = self.env.ref("l10n_ec.ec_passport", False) - is_final_consumer = verify_final_consumer(move.partner_id.commercial_partner_id.vat) - is_ruc = move.partner_id.commercial_partner_id.l10n_latam_identification_type_id.id == it_ruc.id - is_dni = move.partner_id.commercial_partner_id.l10n_latam_identification_type_id.id == it_dni.id - is_passport = move.partner_id.commercial_partner_id.l10n_latam_identification_type_id.id == it_passport.id - l10n_ec_is_exportation = move.partner_id.commercial_partner_id.country_id.code != 'EC' + ec_ruc = self.env.ref("l10n_ec.ec_ruc", False) + ec_dni = self.env.ref("l10n_ec.ec_dni", False) + ec_passport = self.env.ref("l10n_ec.ec_passport", False) + it_pass = self.env.ref("l10n_latam_base.it_pass", False) # Passport + it_vat = self.env.ref("l10n_latam_base.it_vat", False) + it_fid = self.env.ref("l10n_latam_base.it_fid", False) # Foreign ID + # find partner identification type + is_ruc = self.partner_id.l10n_latam_identification_type_id == ec_ruc + is_dni = self.partner_id.l10n_latam_identification_type_id == ec_dni + #TODO Joss, for "is_foreign", are we sure it_vat is intended to be a foreigner? it will affect the edi module in sister method _get_l10n_ec_edi_identification_type() + is_foreign = self.partner_id.l10n_latam_identification_type_id in [ec_passport, it_pass, it_vat, it_fid] + # map identification code considering sale or purchase as per table 2 of ATS identification_code = False - if move.move_type in ("in_invoice", "in_refund"): - if is_ruc: + if self.move_type in ("in_invoice", "in_refund"): + if is_ruc: # includes final consumer identification_code = "01" elif is_dni: identification_code = "02" - else: + elif is_foreign: identification_code = "03" - elif move.move_type in ("out_invoice", "out_refund"): - if not l10n_ec_is_exportation: - if is_final_consumer: - identification_code = "07" - elif is_ruc: - identification_code = "04" - elif is_dni: - identification_code = "05" - elif is_passport: - identification_code = "06" - else: - if is_ruc: - identification_code = "20" - elif is_dni: - identification_code = "21" - else: - identification_code = "09" + elif self.move_type in ("out_invoice", "out_refund"): + if is_ruc: # includes final consumer + identification_code = "04" + elif is_dni: + identification_code = "05" + elif is_foreign: #passport or foreign ID + identification_code = "06" return identification_code + _get_l10n_ec_identification_type = _get_l10n_ec_ats_identification_type #For backward compatibility, remove in master + @api.model def _get_l10n_ec_documents_allowed(self, identification_code): documents_allowed = self.env['l10n_latam.document.type'] @@ -181,28 +177,17 @@ def _get_l10n_ec_documents_allowed(self, identification_code): documents_allowed |= document_allowed return documents_allowed - def _get_l10n_ec_internal_type(self): - self.ensure_one() - internal_type = self.env.context.get("internal_type", "invoice") - if self.move_type in ("out_refund", "in_refund"): - internal_type = "credit_note" - if self.debit_origin_id: - internal_type = "debit_note" - return internal_type - def _get_l10n_latam_documents_domain(self): self.ensure_one() - if self.journal_id.company_id.account_fiscal_country_id != self.env.ref('base.ec') or not \ - self.journal_id.l10n_latam_use_documents: - return super()._get_l10n_latam_documents_domain() - domain = [ - ('country_id.code', '=', 'EC'), - ('internal_type', 'in', ['invoice', 'debit_note', 'credit_note', 'invoice_in']) - ] - internal_type = self._get_l10n_ec_internal_type() - allowed_documents = self._get_l10n_ec_documents_allowed(self._get_l10n_ec_identification_type()) - if internal_type and allowed_documents: - domain.append(("id", "in", allowed_documents.filtered(lambda x: x.internal_type == internal_type).ids)) + domain = super(AccountMove, self)._get_l10n_latam_documents_domain() + if self.country_code == 'EC' and self.journal_id.l10n_latam_use_documents: + if self.debit_origin_id: # show/hide the debit note document type + domain.extend([("internal_type", "=", 'debit_note')]) + elif self.move_type in ('out_invoice', 'in_invoice'): + domain.extend([("internal_type", "=", 'invoice')]) + allowed_documents = self._get_l10n_ec_documents_allowed(self._get_l10n_ec_ats_identification_type()) + if allowed_documents: #TODO Joss, Andres suggest to remove the condition, so that if no ID matches then no document is available + domain.extend([("id", "in", allowed_documents.ids)]) return domain def _get_ec_formatted_sequence(self, number=0): @@ -225,17 +210,10 @@ def _get_starting_sequence(self): return super()._get_starting_sequence() def _get_last_sequence_domain(self, relaxed=False): - l10n_latam_document_type_model = self.env['l10n_latam.document.type'] where_string, param = super(AccountMove, self)._get_last_sequence_domain(relaxed) - if self.country_code == "EC" and self.l10n_latam_use_documents and self.move_type in ( - "out_invoice", - "out_refund", - "in_invoice", - "in_refund", - ): - where_string, param = super(AccountMove, self)._get_last_sequence_domain(False) - internal_type = self._get_l10n_ec_internal_type() - document_types = l10n_latam_document_type_model.search([ + if self.country_code == "EC" and self.l10n_latam_use_documents: + internal_type = self.l10n_latam_document_type_id.internal_type + document_types = self.env['l10n_latam.document.type'].search([ ('internal_type', '=', internal_type), ('country_id.code', '=', 'EC'), ]) diff --git a/addons/l10n_ec/models/account_tax_group.py b/addons/l10n_ec/models/account_tax_group.py index 2510084fb6a088..c7988c98db3a6f 100644 --- a/addons/l10n_ec/models/account_tax_group.py +++ b/addons/l10n_ec/models/account_tax_group.py @@ -4,17 +4,22 @@ from odoo import fields, models _TYPE_EC = [ + ("vat08", "VAT 8%"), ("vat12", "VAT 12%"), ("vat14", "VAT 14%"), ("zero_vat", "VAT 0%"), ("not_charged_vat", "VAT Not Charged"), ("exempt_vat", "VAT Exempt"), - ("withhold_vat", "VAT Withhold"), - ("withhold_income_tax", "Profit Withhold"), ("ice", "Special Consumptions Tax (ICE)"), ("irbpnr", "Plastic Bottles (IRBPNR)"), + ("withhold_vat_sale", "VAT Withhold on Sales"), + ("withhold_vat_purchase", "VAT Withhold on Purchases"), + ("withhold_income_sale", "Profit Withhold on Sales"), + ("withhold_income_purchase", "Profit Withhold on Purchases"), ("outflows_tax", "Exchange Outflows"), ("other", "Others"), + ("withhold_vat", "VAT Withhold (Deprecated)"), #remove in master + ("withhold_income_tax", "Profit Withhold (Deprecated)"), #remove in master ] diff --git a/addons/l10n_ec/models/l10n_latam_document_type.py b/addons/l10n_ec/models/l10n_latam_document_type.py index eb6cfcef24101e..8ff2f6eae8caab 100644 --- a/addons/l10n_ec/models/l10n_latam_document_type.py +++ b/addons/l10n_ec/models/l10n_latam_document_type.py @@ -11,6 +11,7 @@ class L10nLatamDocumentType(models.Model): internal_type = fields.Selection( selection_add=[ ("purchase_liquidation", "Purchase Liquidation"), + ("withhold", "Withhold"), ] ) diff --git a/addons/l10n_ec/models/res_partner.py b/addons/l10n_ec/models/res_partner.py index fda2490d62149c..c383be401699ea 100644 --- a/addons/l10n_ec/models/res_partner.py +++ b/addons/l10n_ec/models/res_partner.py @@ -49,9 +49,9 @@ def check_vat(self): error_message = "" if partner.l10n_latam_identification_type_id.id == it_dni.id: error_message = _("VAT %s is not valid for an Ecuadorian DNI, " - "it must be like this form 0915068258") % partner.vat + "it must be like this form 1234567897") % partner.vat if partner.l10n_latam_identification_type_id.id == it_ruc.id: error_message = _("VAT %s is not valid for an Ecuadorian company, " - "it must be like this form 0993143790001") % partner.vat + "it must be like this form 1234567897001") % partner.vat raise ValidationError(error_message) return super(ResPartner, self - ecuadorian_partners).check_vat() diff --git a/addons/l10n_ec/views/account_journal_view.xml b/addons/l10n_ec/views/account_journal_view.xml index 7427566b22c303..2a7ec9d35fe30b 100644 --- a/addons/l10n_ec/views/account_journal_view.xml +++ b/addons/l10n_ec/views/account_journal_view.xml @@ -7,17 +7,25 @@ + + placeholder="001" + attrs="{'invisible':[('l10n_ec_require_emission', '!=', True)], + 'required':[('l10n_ec_require_emission', '=', True)]}" + /> + placeholder="001" + attrs="{'invisible':[('l10n_ec_require_emission', '!=', True)], + 'required':[('l10n_ec_require_emission', '=', True)]}" + /> - + attrs="{'invisible':[('l10n_ec_require_emission', '!=', True)], + 'required':[('l10n_ec_require_emission', '=', True)]}" + context="{'default_parent_id': company_partner_id, + 'default_type': 'invoice', + 'form_view_ref': 'base.view_partner_address_form' + }" + /> diff --git a/addons/l10n_ec/views/l10n_ec_sri_payment.xml b/addons/l10n_ec/views/l10n_ec_sri_payment.xml index 3915e42ef733a4..61744e76a17dab 100644 --- a/addons/l10n_ec/views/l10n_ec_sri_payment.xml +++ b/addons/l10n_ec/views/l10n_ec_sri_payment.xml @@ -1,12 +1,30 @@ - - l10n.ec.sri.payment.form + + + view.payment.method.form l10n_ec.sri.payment + form - - +
+ + + + + + +
+
+
+ + + view.payment.method.tree + l10n_ec.sri.payment + tree + + + @@ -15,8 +33,9 @@ Payment Methods SRI l10n_ec.sri.payment tree,form +
+ groups="account.group_account_manager" parent="l10n_ec.sri_menu" sequence="3"/>
diff --git a/addons/l10n_ec/views/root_sri_menu.xml b/addons/l10n_ec/views/root_sri_menu.xml new file mode 100644 index 00000000000000..3ae2b0eee0929a --- /dev/null +++ b/addons/l10n_ec/views/root_sri_menu.xml @@ -0,0 +1,8 @@ + + + + diff --git a/addons/l10n_latam_invoice_document/models/account_move.py b/addons/l10n_latam_invoice_document/models/account_move.py index 6669e0c7147574..baa1a2778b4258 100644 --- a/addons/l10n_latam_invoice_document/models/account_move.py +++ b/addons/l10n_latam_invoice_document/models/account_move.py @@ -86,7 +86,8 @@ def _compute_l10n_latam_manual_document_number(self): remaining.l10n_latam_manual_document_number = False def _is_manual_document_number(self): - return self.journal_id.type == 'purchase' + # Manual number when document number is to be typed by the user, aka issued by suppliers + return self.is_purchase_document() @api.depends('name') def _compute_l10n_latam_document_number(self): @@ -140,9 +141,9 @@ def _post(self, soft=True): @api.constrains('name', 'journal_id', 'state') def _check_unique_sequence_number(self): - """ This uniqueness verification is only valid for customer invoices, and vendor bills that does not use + """ This uniqueness verification was only valid for customer invoices, and vendor bills that does not use documents. A new constraint method _check_unique_vendor_number has been created just for validate for this purpose """ - vendor = self.filtered(lambda x: x.is_purchase_document() and x.l10n_latam_use_documents) + vendor = self.filtered(lambda x: x._is_manual_document_number() and x.l10n_latam_use_documents) return super(AccountMove, self - vendor)._check_unique_sequence_number() @api.constrains('state', 'l10n_latam_document_type_id') @@ -208,7 +209,7 @@ def _check_unique_vendor_number(self): """ The constraint _check_unique_sequence_number is valid for customer bills but not valid for us on vendor bills because the uniqueness must be per partner """ for rec in self.filtered( - lambda x: x.name and x.name != '/' and x.is_purchase_document() and x.l10n_latam_use_documents + lambda x: x.name and x.name != '/' and x._is_manual_document_number() and x.l10n_latam_use_documents and x.commercial_partner_id): domain = [ ('move_type', '=', rec.move_type), @@ -221,4 +222,4 @@ def _check_unique_vendor_number(self): ('state', '!=', 'cancel'), ] if rec.search(domain): - raise ValidationError(_('Vendor bill number must be unique per vendor and company.')) + raise ValidationError(_('Document %s must be unique per partner and company.', rec.name))