diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 494ffe94c79..160fc607097 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -282,7 +282,9 @@ class AccountMove(models.Model): ) needed_terms = fields.Binary(compute='_compute_needed_terms') needed_terms_dirty = fields.Boolean(compute='_compute_needed_terms') - + tax_calculation_rounding_method = fields.Selection( + related='company_id.tax_calculation_rounding_method', + string='Tax calculation rounding method', readonly=True) # === Partner fields === # partner_id = fields.Many2one( 'res.partner', diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index 9ca93ceaff2..8fc711ff30d 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -345,7 +345,9 @@ class AccountMoveLine(models.Model): digits='Discount', default=0.0, ) - + tax_calculation_rounding_method = fields.Selection( + related='company_id.tax_calculation_rounding_method', + string='Tax calculation rounding method', readonly=True) # === Invoice sync fields === # term_key = fields.Binary(compute='_compute_term_key') tax_key = fields.Binary(compute='_compute_tax_key') diff --git a/addons/account/models/res_config_settings.py b/addons/account/models/res_config_settings.py index f5cfe781293..edc3de30349 100644 --- a/addons/account/models/res_config_settings.py +++ b/addons/account/models/res_config_settings.py @@ -71,28 +71,10 @@ class ResConfigSettings(models.TransientModel): module_account_accountant = fields.Boolean(string='Accounting') group_warning_account = fields.Boolean(string="Warnings in Invoices", implied_group='account.group_warning_account') group_cash_rounding = fields.Boolean(string="Cash Rounding", implied_group='account.group_cash_rounding') - # group_show_line_subtotals_tax_excluded and group_show_line_subtotals_tax_included are opposite, - # so we can assume exactly one of them will be set, and not the other. - # We need both of them to coexist so we can take advantage of automatic group assignation. - group_show_line_subtotals_tax_excluded = fields.Boolean( - "Show line subtotals without taxes (B2B)", - implied_group='account.group_show_line_subtotals_tax_excluded', - group='base.group_portal,base.group_user,base.group_public', - compute='_compute_group_show_line_subtotals', store=True, readonly=False) - group_show_line_subtotals_tax_included = fields.Boolean( - "Show line subtotals with taxes (B2C)", - implied_group='account.group_show_line_subtotals_tax_included', - group='base.group_portal,base.group_user,base.group_public', - compute='_compute_group_show_line_subtotals', store=True, readonly=False) group_show_sale_receipts = fields.Boolean(string='Sale Receipt', implied_group='account.group_sale_receipts') group_show_purchase_receipts = fields.Boolean(string='Purchase Receipt', implied_group='account.group_purchase_receipts') - show_line_subtotals_tax_selection = fields.Selection([ - ('tax_excluded', 'Tax Excluded'), - ('tax_included', 'Tax Included')], string="Line Subtotals Tax Display", - required=True, default='tax_excluded', - config_parameter='account.show_line_subtotals_tax_selection') module_account_budget = fields.Boolean(string='Budget Management') module_account_payment = fields.Boolean(string='Invoice Online Payment') module_account_reports = fields.Boolean("Dynamic Reports") @@ -208,12 +190,6 @@ class ResConfigSettings(models.TransientModel): self.has_chart_of_accounts = bool(self.company_id.chart_template) self.has_accounting_entries = self.company_id._existing_accounting() - @api.depends('show_line_subtotals_tax_selection') - def _compute_group_show_line_subtotals(self): - for wizard in self: - wizard.group_show_line_subtotals_tax_included = wizard.show_line_subtotals_tax_selection == "tax_included" - wizard.group_show_line_subtotals_tax_excluded = wizard.show_line_subtotals_tax_selection == "tax_excluded" - @api.onchange('group_analytic_accounting') def onchange_analytic_accounting(self): if self.group_analytic_accounting: diff --git a/addons/account/models/res_users.py b/addons/account/models/res_users.py index 1935d40caa5..7f703b4e95b 100644 --- a/addons/account/models/res_users.py +++ b/addons/account/models/res_users.py @@ -5,28 +5,6 @@ from odoo import api, models, _ from odoo.exceptions import ValidationError -class Users(models.Model): - _inherit = "res.users" - - @api.constrains('groups_id') - def _check_one_user_type(self): - super(Users, self)._check_one_user_type() - - g1 = self.env.ref('account.group_show_line_subtotals_tax_included', False) - g2 = self.env.ref('account.group_show_line_subtotals_tax_excluded', False) - - if not g1 or not g2: - # A user cannot be in a non-existant group - return - - for user in self: - if user._has_multiple_groups([g1.id, g2.id]): - raise ValidationError(_("A user cannot have both Tax B2B and Tax B2C.\n" - "You should go in General Settings, and choose to display Product Prices\n" - "either in 'Tax-Included' or in 'Tax-Excluded' mode\n" - "(or switch twice the mode if you are already in the desired one).")) - - class GroupsView(models.Model): _inherit = 'res.groups' diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index a47f75e1eda..892865d94bd 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -38,18 +38,6 @@ - - Tax display B2B - Show line subtotals without taxes (B2B) - - - - - Tax display B2C - Show line subtotals with taxes included (B2C) - - - Show Accounting Features - Readonly @@ -105,16 +93,6 @@ - - - - - - - - - - diff --git a/addons/account/tests/__init__.py b/addons/account/tests/__init__.py index c5e715d00f8..7e2cc2b966c 100644 --- a/addons/account/tests/__init__.py +++ b/addons/account/tests/__init__.py @@ -23,7 +23,6 @@ from . import test_account_journal_dashboard from . import test_chart_template from . import test_fiscal_position from . import test_sequence_mixin -from . import test_settings from . import test_tax from . import test_invoice_taxes from . import test_mail_performance diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 5aa00ed5a52..732a6a296da 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -745,6 +745,7 @@ + @@ -916,11 +917,11 @@ options="{'no_create': True}" optional="show"/> + string="Tax excl."/> + string="Tax incl." + attrs="{'column_invisible': [('parent.tax_calculation_rounding_method', '=', 'round_globally')]}" + optional="hide"/> @@ -936,8 +937,12 @@ - - + + @@ -957,8 +962,8 @@
- - + +
@@ -986,6 +991,7 @@ + @@ -994,6 +1000,7 @@
+ @@ -1015,8 +1022,12 @@
diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 088816c6fb0..af20a477e29 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -100,18 +100,21 @@ Taxes - Amount - Total Price + Tax excl. + + + Tax incl. + - - + + @@ -130,8 +133,10 @@ - - + + + + diff --git a/addons/account/views/res_config_settings_views.xml b/addons/account/views/res_config_settings_views.xml index 0d46d7ee5aa..ed59290a672 100644 --- a/addons/account/views/res_config_settings_views.xml +++ b/addons/account/views/res_config_settings_views.xml @@ -114,11 +114,6 @@ - - - - - diff --git a/addons/event_booth_sale/models/event_booth_category.py b/addons/event_booth_sale/models/event_booth_category.py index ddf9aa1a17e..12c775d30f0 100644 --- a/addons/event_booth_sale/models/event_booth_category.py +++ b/addons/event_booth_sale/models/event_booth_category.py @@ -21,6 +21,9 @@ class EventBoothCategory(models.Model): price = fields.Float( string='Price', compute='_compute_price', digits='Product Price', readonly=False, store=True, groups="event.group_event_registration_desk") + price_incl = fields.Float( + string='Price incl', compute='_compute_price_incl', digits='Product Price', readonly=False, + groups="event.group_event_registration_desk") currency_id = fields.Many2one(related='product_id.currency_id', groups="event.group_event_registration_desk") price_reduce = fields.Float( string='Price Reduce', compute='_compute_price_reduce', @@ -44,6 +47,16 @@ class EventBoothCategory(models.Model): if category.product_id and category.product_id.list_price: category.price = category.product_id.list_price + category.product_id.price_extra + @api.depends('product_id', 'product_id.taxes_id', 'price') + def _compute_price_incl(self): + for category in self: + if category.product_id and category.price: + tax_ids = category.product_id.taxes_id + taxes = tax_ids.compute_all(category.price, category.currency_id, 1.0, product=category.product_id) + category.price_incl = taxes['total_included'] + else: + category.price_incl = 0 + @api.depends_context('pricelist', 'quantity') @api.depends('product_id', 'price') def _compute_price_reduce(self): @@ -65,7 +78,7 @@ class EventBoothCategory(models.Model): for category in self: tax_ids = category.product_id.taxes_id taxes = tax_ids.compute_all(category.price_reduce, category.currency_id, 1.0, product=category.product_id) - category.price_reduce_taxinc = taxes['total_included'] + category.price_reduce_taxinc = taxes['total_included'] or 0 def _init_column(self, column_name): """ Initialize product_id for existing columns when installing sale diff --git a/addons/event_sale/models/event_ticket.py b/addons/event_sale/models/event_ticket.py index c6a95a01edc..f5e522d6f4a 100644 --- a/addons/event_sale/models/event_ticket.py +++ b/addons/event_sale/models/event_ticket.py @@ -113,6 +113,9 @@ class EventTicket(models.Model): price_reduce_taxinc = fields.Float( string='Price Reduce Tax inc', compute='_compute_price_reduce_taxinc', compute_sudo=True) + price_incl = fields.Float( + string='Price include', compute='_compute_price_incl', + digits='Product Price', readonly=False) def _compute_price_reduce_taxinc(self): for event in self: @@ -121,6 +124,16 @@ class EventTicket(models.Model): taxes = tax_ids.compute_all(event.price_reduce, event.event_id.company_id.currency_id, 1.0, product=event.product_id) event.price_reduce_taxinc = taxes['total_included'] + @api.depends('product_id', 'product_id.taxes_id', 'price') + def _compute_price_incl(self): + for event in self: + if event.product_id and event.price: + tax_ids = event.product_id.taxes_id.filtered(lambda r: r.company_id == event.event_id.company_id) + taxes = tax_ids.compute_all(event.price, event.currency_id, 1.0, product=event.product_id) + event.price_incl = taxes['total_included'] + else: + event.price_incl = 0 + @api.depends('product_id.active') def _compute_sale_available(self): inactive_product_tickets = self.filtered(lambda ticket: not ticket.product_id.active) diff --git a/addons/l10n_ar/views/report_invoice.xml b/addons/l10n_ar/views/report_invoice.xml index 261e12f7eb7..75272114e28 100644 --- a/addons/l10n_ar/views/report_invoice.xml +++ b/addons/l10n_ar/views/report_invoice.xml @@ -126,24 +126,21 @@ current_subtotal + l10n_ar_values['price_subtotal'] - + current_subtotal + l10n_ar_values['price_subtotal'] - - Amount + + Amount + l10n_ar_values['price_subtotal'] {"widget": "monetary", "display_currency": o.currency_id} - - - - l10n_ar_values['price_subtotal'] - {"widget": "monetary", "display_currency": o.currency_id} - + + o._l10n_ar_get_invoice_totals_for_report() diff --git a/addons/l10n_cl/views/report_invoice.xml b/addons/l10n_cl/views/report_invoice.xml index ef61e190975..d1cbf654d9e 100644 --- a/addons/l10n_cl/views/report_invoice.xml +++ b/addons/l10n_cl/views/report_invoice.xml @@ -170,16 +170,20 @@ current_subtotal + l10n_cl_values['price_subtotal'] - - Amount + + Amount + + l10n_cl_values['price_subtotal'] {"widget": "monetary", "display_currency": o.currency_id} + + o._l10n_cl_get_invoice_totals_for_report() diff --git a/addons/l10n_gcc_invoice/views/report_invoice.xml b/addons/l10n_gcc_invoice/views/report_invoice.xml index 16a06c75aa4..642f5e09723 100644 --- a/addons/l10n_gcc_invoice/views/report_invoice.xml +++ b/addons/l10n_gcc_invoice/views/report_invoice.xml @@ -264,12 +264,9 @@ - - - + + diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index b93ccf5ebd9..7a020d05478 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -121,6 +121,9 @@ class PurchaseOrder(models.Model): # Avoid access error on fiscal position, when reading a purchase order with company != user.company_ids compute_sudo=True, help="Technical field to filter the available taxes depending on the fiscal country and fiscal position.") + tax_calculation_rounding_method = fields.Selection( + related='company_id.tax_calculation_rounding_method', + string='Tax calculation rounding method', readonly=True) payment_term_id = fields.Many2one('account.payment.term', 'Payment Terms', domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]") incoterm_id = fields.Many2one('account.incoterms', 'Incoterm', states={'done': [('readonly', True)]}, help="International Commercial Terms are a series of predefined commercial terms used in international transactions.") @@ -189,7 +192,7 @@ class PurchaseOrder(models.Model): return result @api.depends('order_line.taxes_id', 'order_line.price_subtotal', 'amount_total', 'amount_untaxed') - def _compute_tax_totals(self): + def _compute_tax_totals(self): for order in self: order_lines = order.order_line.filtered(lambda x: not x.display_type) order.tax_totals = self.env['account.tax']._prepare_tax_totals( @@ -966,7 +969,9 @@ class PurchaseOrderLine(models.Model): product_packaging_id = fields.Many2one('product.packaging', string='Packaging', domain="[('purchase', '=', True), ('product_id', '=', product_id)]", check_company=True, compute="_compute_product_packaging_id", store=True, readonly=False) product_packaging_qty = fields.Float('Packaging Quantity', compute="_compute_product_packaging_qty", store=True, readonly=False) - + tax_calculation_rounding_method = fields.Selection( + related='company_id.tax_calculation_rounding_method', + string='Tax calculation rounding method', readonly=True) display_type = fields.Selection([ ('line_section', "Section"), ('line_note', "Note")], default=False, help="Technical field for UX purpose.") diff --git a/addons/purchase/report/purchase_order_templates.xml b/addons/purchase/report/purchase_order_templates.xml index 1732df6ecb1..9d878028dba 100644 --- a/addons/purchase/report/purchase_order_templates.xml +++ b/addons/purchase/report/purchase_order_templates.xml @@ -53,14 +53,19 @@ Date Req. Qty Unit Price - Amount + + Tax excl. + + + Tax incl. + - - + + @@ -84,6 +89,10 @@ + + + diff --git a/addons/purchase/views/portal_templates.xml b/addons/purchase/views/portal_templates.xml index cd7140aa430..e8b7dfbbb0d 100644 --- a/addons/purchase/views/portal_templates.xml +++ b/addons/purchase/views/portal_templates.xml @@ -268,8 +268,10 @@ Taxes - Amount - Total Price + Tax excl. + + + Tax incl. @@ -279,8 +281,8 @@ - - + + @@ -318,8 +320,10 @@ - - + + + + diff --git a/addons/purchase/views/purchase_views.xml b/addons/purchase/views/purchase_views.xml index a5b811bfd86..cd7bd202cdf 100644 --- a/addons/purchase/views/purchase_views.xml +++ b/addons/purchase/views/purchase_views.xml @@ -178,6 +178,7 @@ + @@ -219,6 +220,7 @@ + @@ -257,11 +259,14 @@