From 30019e3e32e992b97e0aa4729bbf02b2b8b8ec46 Mon Sep 17 00:00:00 2001 From: baa Date: Mon, 8 Nov 2021 07:26:54 +0000 Subject: [PATCH] [ADD] l10n_gcc_invoice: arabic/english report for GCC countries Most GCC countries are required by law to have invoice reports in both arabic in english X-original-commit: 0baca0420b472bdfdd95c108c945f5990e0b34da Part-of: odoo/odoo#79817 --- addons/l10n_gcc_invoice/__init__.py | 4 + addons/l10n_gcc_invoice/__manifest__.py | 16 + addons/l10n_gcc_invoice/models/__init__.py | 4 + .../l10n_gcc_invoice/models/account_move.py | 27 + .../l10n_gcc_invoice/views/report_invoice.xml | 569 ++++++++++++++++++ 5 files changed, 620 insertions(+) create mode 100644 addons/l10n_gcc_invoice/__init__.py create mode 100644 addons/l10n_gcc_invoice/__manifest__.py create mode 100644 addons/l10n_gcc_invoice/models/__init__.py create mode 100644 addons/l10n_gcc_invoice/models/account_move.py create mode 100644 addons/l10n_gcc_invoice/views/report_invoice.xml diff --git a/addons/l10n_gcc_invoice/__init__.py b/addons/l10n_gcc_invoice/__init__.py new file mode 100644 index 00000000000..dc5e6b693d1 --- /dev/null +++ b/addons/l10n_gcc_invoice/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/addons/l10n_gcc_invoice/__manifest__.py b/addons/l10n_gcc_invoice/__manifest__.py new file mode 100644 index 00000000000..0ac35562f89 --- /dev/null +++ b/addons/l10n_gcc_invoice/__manifest__.py @@ -0,0 +1,16 @@ +# -*- encoding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +{ + 'name': 'G.C.C. - Arabic/English Invoice', + 'version': '1.0.0', + 'author': 'Odoo', + 'category': 'Accounting/Localizations', + 'description': """ + Arabic/English for GCC +""", + 'license': 'LGPL-3', + 'depends': ['account'], + 'data': [ + 'views/report_invoice.xml', + ], +} diff --git a/addons/l10n_gcc_invoice/models/__init__.py b/addons/l10n_gcc_invoice/models/__init__.py new file mode 100644 index 00000000000..c0124efe182 --- /dev/null +++ b/addons/l10n_gcc_invoice/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import account_move diff --git a/addons/l10n_gcc_invoice/models/account_move.py b/addons/l10n_gcc_invoice/models/account_move.py new file mode 100644 index 00000000000..23d0869f884 --- /dev/null +++ b/addons/l10n_gcc_invoice/models/account_move.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models, api + + +class AccountMove(models.Model): + _inherit = 'account.move' + + narration = fields.Text(translate=True) + + def _get_name_invoice_report(self): + self.ensure_one() + if self.company_id.country_id in self.env.ref('base.gulf_cooperation_council').country_ids: + return 'l10n_gcc_invoice.arabic_english_invoice' + return super()._get_name_invoice_report() + + +class AccountMoveLine(models.Model): + _inherit = 'account.move.line' + + l10n_gcc_invoice_tax_amount = fields.Float(string='Tax Amount', compute='_compute_tax_amount', digits='Product Price') + + @api.depends('price_subtotal', 'price_total') + def _compute_tax_amount(self): + for record in self: + record.l10n_gcc_invoice_tax_amount = record.price_total - record.price_subtotal diff --git a/addons/l10n_gcc_invoice/views/report_invoice.xml b/addons/l10n_gcc_invoice/views/report_invoice.xml new file mode 100644 index 00000000000..88b55b1e7de --- /dev/null +++ b/addons/l10n_gcc_invoice/views/report_invoice.xml @@ -0,0 +1,569 @@ + + + + + + + + + + + + +