diff --git a/__manifest__.py b/__manifest__.py index 1031361327ce221e839cff400791ebd1acea231d..233c9b2192f7a6eebdff9bd8c39a8a1dddff4ee5 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -9,9 +9,12 @@ 'account', ], 'data': [ + # templates + 'templates/report_invoice_document.xml', # views 'views/account_move.xml', 'views/account_journal.xml', + 'views/res_company.xml', ], 'qweb': [], 'installable': True, diff --git a/models/__init__.py b/models/__init__.py index 56e136c1ca859252fb32e3b80c3a5624d418bd0a..611ab07785a3cc0d8f6b784ffeb254b2179bbd4f 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -3,3 +3,4 @@ from . import account_journal from . import account_move +from . import res_company diff --git a/models/res_company.py b/models/res_company.py new file mode 100644 index 0000000000000000000000000000000000000000..190faa646f39f93f988419ab09173e47519e2ab0 --- /dev/null +++ b/models/res_company.py @@ -0,0 +1,13 @@ +# Copyright 2021 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = 'res.company' + + is_tax = fields.Boolean( + 'TVA Applicable', + default=True + ) diff --git a/templates/report_invoice_document.xml b/templates/report_invoice_document.xml new file mode 100644 index 0000000000000000000000000000000000000000..e05d590dda4ad73c079ea34e0dfbf1e2742d8b00 --- /dev/null +++ b/templates/report_invoice_document.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + +<odoo> + <data> + + <template id="afac_report_invoice_document" inherit_id="account.report_invoice_document"> + <!-- Gestion de l'affichage de la TVA : tableau & total --> + <xpath expr="//th[@name='th_taxes']" position="attributes"> + <attribute name="t-if">o.company_id.is_tax</attribute> + </xpath> + <xpath expr="//t[@name='account_invoice_line_accountable']/td[5]" position="attributes"> + <attribute name="t-if">o.company_id.is_tax</attribute> + </xpath> + <xpath expr="//tr[hasclass('o_subtotal')]" position="attributes"> + <attribute name="t-if">o.company_id.is_tax</attribute> + </xpath> + <xpath expr="//t[@t-foreach='o.amount_by_group']/tr" position="attributes"> + <attribute name="t-if">o.company_id.is_tax</attribute> + </xpath> + <!-- Suppression affichage communication --> + <xpath expr="//p[@name='payment_communication']" position="attributes"> + <attribute name="t-if">o.company_id.is_tax</attribute> + </xpath> + </template> + + </data> +</odoo> \ No newline at end of file diff --git a/views/res_company.xml b/views/res_company.xml new file mode 100644 index 0000000000000000000000000000000000000000..d96414c130f98a326b27325069ce88075f745fc9 --- /dev/null +++ b/views/res_company.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + +<odoo> + <data> + + <!-- Form View --> + + <record model="ir.ui.view" id="res_company_afac_form"> + <field name="name">res.company.afac.form</field> + <field name="model">res.company</field> + <field name="inherit_id" ref="base.view_company_form"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='vat']" position="before"> + <field name="is_tax" /> + </xpath> + </field> + </record> + + </data> +</odoo>