@@ -121,7 +123,7 @@
| Taking care of Trees Course |
1 |
-
+
$ 10.00
diff --git a/addons/sale/models/sale_order.py b/addons/sale/models/sale_order.py
index 794dc8f0ffb..86da650a14d 100644
--- a/addons/sale/models/sale_order.py
+++ b/addons/sale/models/sale_order.py
@@ -274,6 +274,9 @@ class SaleOrder(models.Model):
partner_credit_warning = fields.Text(
compute='_compute_partner_credit_warning',
groups='account.group_account_invoice,account.group_account_readonly')
+ tax_calculation_rounding_method = fields.Selection(
+ related='company_id.tax_calculation_rounding_method',
+ depends=['company_id'])
tax_country_id = fields.Many2one(
comodel_name='res.country',
compute='_compute_tax_country_id',
diff --git a/addons/sale/models/sale_order_line.py b/addons/sale/models/sale_order_line.py
index 5c3ac59e7e6..3ea67719012 100644
--- a/addons/sale/models/sale_order_line.py
+++ b/addons/sale/models/sale_order_line.py
@@ -255,6 +255,9 @@ class SaleOrderLine(models.Model):
compute='_compute_product_updatable')
product_uom_readonly = fields.Boolean(
compute='_compute_product_uom_readonly')
+ tax_calculation_rounding_method = fields.Selection(
+ related='company_id.tax_calculation_rounding_method',
+ string='Tax calculation rounding method', readonly=True)
#=== COMPUTE METHODS ===#
diff --git a/addons/sale/report/ir_actions_report_templates.xml b/addons/sale/report/ir_actions_report_templates.xml
index 32d59022fc9..87ae01aa9a4 100644
--- a/addons/sale/report/ir_actions_report_templates.xml
+++ b/addons/sale/report/ir_actions_report_templates.xml
@@ -78,8 +78,10 @@
| Taxes |
- Amount
- Total Price
+ Tax excl.
+ |
+
+ Tax incl.
|
@@ -89,8 +91,8 @@
-
-
+
+
@@ -109,8 +111,10 @@
|
-
-
+
+ |
+
+
|
diff --git a/addons/sale/views/sale_order_views.xml b/addons/sale/views/sale_order_views.xml
index 8441219971b..59fd386a774 100644
--- a/addons/sale/views/sale_order_views.xml
+++ b/addons/sale/views/sale_order_views.xml
@@ -285,6 +285,7 @@
+
@@ -520,8 +521,13 @@
/>
-
-
+
+
+
+
@@ -541,6 +547,7 @@
+
@@ -555,8 +562,8 @@
-
-
+ Tax excl.:
+
@@ -567,10 +574,15 @@
-
+
Unit Price:
+
+ Tax incl.:
+
+
+
diff --git a/addons/sale/views/sale_portal_templates.xml b/addons/sale/views/sale_portal_templates.xml
index e51a49d5657..ee7614259b0 100644
--- a/addons/sale/views/sale_portal_templates.xml
+++ b/addons/sale/views/sale_portal_templates.xml
@@ -478,9 +478,11 @@
Taxes
|
-
- Amount
- Total Price
+ |
+ Tax excl.
+ |
+
+ Tax incl.
|
@@ -491,8 +493,8 @@
-
-
+
+
@@ -525,8 +527,10 @@
|
-
-
+
+ |
+
+
|
diff --git a/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js b/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js
index 05a90c912e6..accbf7f88ce 100644
--- a/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js
+++ b/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js
@@ -18,7 +18,7 @@ registry.category("web_tour.tours").add('event_sale_with_product_configurator_to
trigger: '.ui-menu-item > a:contains("Tajine Saucisse")',
auto: true,
}, {
- trigger: "a:contains('Add a product')",
+ trigger: 'a:contains("Add a product")',
}, {
trigger: 'div[name="product_template_id"] input',
run: 'text event (',
@@ -48,7 +48,7 @@ registry.category("web_tour.tours").add('event_sale_with_product_configurator_to
trigger: '.o_event_sale_js_event_configurator_ok'
}, {
trigger: 'a:contains("Add a product")',
- extra_trigger: '.o_monetary_cell span:contains("16.50")', // wait for the optional product line
+ extra_trigger: 'td[name="price_subtotal"]:contains("16.50")', // wait for the optional product line
}, {
trigger: 'div[name="product_template_id"] input',
extra_trigger: '[name="product_template_id"] .o_dropdown_button',
@@ -84,7 +84,7 @@ registry.category("web_tour.tours").add('event_sale_with_product_configurator_to
trigger: '.o_event_sale_js_event_configurator_ok'
}, {
trigger: 'a:contains("Add a product")',
- extra_trigger: '.o_monetary_cell span:contains("150.00")', // wait for the adult tickets line
+ extra_trigger: 'td[name="price_subtotal"]:contains("150.00")', // wait for the adult tickets line
}, {
trigger: 'div[name="product_template_id"] input',
extra_trigger: '[name="product_template_id"] .o_dropdown_button',
diff --git a/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js b/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js
index 8cedad3f04e..dd91509ad36 100644
--- a/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js
+++ b/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js
@@ -45,31 +45,31 @@ registry.category("web_tour.tours").add('event_booth_sale_pricelists_different_c
...getPriceListChecksSteps({
pricelistName: "EUR With Discount Included",
eventName: "Test Event Booths",
- price: "90.00",
- priceSelected: "90",
+ price: "99.00",
+ priceSelected: "99",
priceCart: "99.00",
}),
...getPriceListChecksSteps({
pricelistName: "EUR Without Discount Included",
eventName: "Test Event Booths",
- price: "90.00",
- priceSelected: "90",
+ price: "99.00",
+ priceSelected: "99",
priceCart: "99.00",
- priceBeforeDiscount: "100.00",
+ priceBeforeDiscount: "110.00",
}),
...getPriceListChecksSteps({
pricelistName: "EX With Discount Included",
eventName: "Test Event Booths",
- price: "900.00",
- priceSelected: "900",
+ price: "990.00",
+ priceSelected: "990",
priceCart: "990.00",
}),
...getPriceListChecksSteps({
pricelistName: "EX Without Discount Included",
eventName: "Test Event Booths",
- price: "900.00",
- priceSelected: "900",
+ price: "990.00",
+ priceSelected: "990",
priceCart: "990.00",
- priceBeforeDiscount: "1,000.00",
+ priceBeforeDiscount: "1,100.00",
}),
]});
diff --git a/addons/website_event_booth_sale/tests/test_event_booth_sale.py b/addons/website_event_booth_sale/tests/test_event_booth_sale.py
index c088492be81..b539c9e6d45 100644
--- a/addons/website_event_booth_sale/tests/test_event_booth_sale.py
+++ b/addons/website_event_booth_sale/tests/test_event_booth_sale.py
@@ -15,7 +15,7 @@ class TestWebsiteEventBoothSale(HttpCase, TestWebsiteEventSaleCommon):
def setUp(self):
super().setUp()
- self.env['ir.config_parameter'].sudo().set_param('account.show_line_subtotals_tax_selection', 'tax_included')
+ self.env["res.company"].sudo().search([]).show_line_subtotals_tax_selection = 'tax_included'
self.tax = self.env['account.tax'].sudo().create({
'name': 'Tax 10',
'amount': 10,
diff --git a/addons/website_event_booth_sale/views/event_booth_templates.xml b/addons/website_event_booth_sale/views/event_booth_templates.xml
index 4c6f03df4d9..e5ccd311c55 100644
--- a/addons/website_event_booth_sale/views/event_booth_templates.xml
+++ b/addons/website_event_booth_sale/views/event_booth_templates.xml
@@ -4,24 +4,30 @@
-
+
+ t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.get_current_pricelist().currency_id}"
+ t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
+
+
+ t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
+ t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
Free
event.company_id.sudo().currency_id._convert(
- booth_category.price_reduce_taxinc if env.user.has_group('account.group_show_line_subtotals_tax_included') else booth_category.price_reduce,
+ booth_category.price_reduce_taxinc if env.company.show_line_subtotals_tax_selection == 'tax_included' else booth_category.price_reduce,
website.get_current_pricelist().currency_id,
event.company_id,
datetime.date.today()
diff --git a/addons/website_event_sale/views/website_event_templates.xml b/addons/website_event_sale/views/website_event_templates.xml
index 9f71347030b..07ebce32e4b 100644
--- a/addons/website_event_sale/views/website_event_templates.xml
+++ b/addons/website_event_sale/views/website_event_templates.xml
@@ -15,15 +15,22 @@
-
-
+
+
+
+ t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
+ t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
@@ -48,15 +55,22 @@
-
-
+
+
+
+ t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
+ t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
diff --git a/addons/website_sale/models/product_product.py b/addons/website_sale/models/product_product.py
index 489c5a1fa2f..dcaddd64760 100644
--- a/addons/website_sale/models/product_product.py
+++ b/addons/website_sale/models/product_product.py
@@ -99,7 +99,7 @@ class Product(models.Model):
def _get_contextual_price_tax_selection(self):
self.ensure_one()
price = self._get_contextual_price()
- line_tax_type = self.env['ir.config_parameter'].sudo().get_param('account.show_line_subtotals_tax_selection')
+ line_tax_type = self.env.company.show_line_subtotals_tax_selection
if line_tax_type == "tax_included" and self.taxes_id:
price = self.taxes_id.compute_all(price, product=self, partner=self.env['res.partner'])['total_included']
return price
diff --git a/addons/website_sale/models/product_template.py b/addons/website_sale/models/product_template.py
index 88961ad0531..7b140255622 100644
--- a/addons/website_sale/models/product_template.py
+++ b/addons/website_sale/models/product_template.py
@@ -189,7 +189,7 @@ class ProductTemplate(models.Model):
price_reduce = self.env['account.tax']._fix_tax_included_price_company(
price_reduce, product_taxes, taxes, self.env.company)
- tax_display = self.user_has_groups('account.group_show_line_subtotals_tax_excluded') and 'total_excluded' or 'total_included'
+ tax_display = 'total_excluded' if self.env.company.show_line_subtotals_tax_selection == 'tax_excluded' else 'total_included'
price_reduce = taxes.compute_all(price_reduce, currency, 1, template, partner_sudo)[tax_display]
template_price_vals = {
@@ -316,8 +316,8 @@ class ProductTemplate(models.Model):
price = self.env['account.tax']._fix_tax_included_price_company(
price, product_taxes, taxes, company_id
)
- show_tax_excluded = self.user_has_groups('account.group_show_line_subtotals_tax_excluded')
- tax_display = 'total_excluded' if show_tax_excluded else 'total_included'
+ show_tax = self.env.company.show_line_subtotals_tax_selection
+ tax_display = 'total_excluded' if show_tax == 'tax_excluded' else 'total_included'
# The list_price is always the price of one.
return taxes.compute_all(price, currency, 1, product, partner)[tax_display]
diff --git a/addons/website_sale/models/res_company.py b/addons/website_sale/models/res_company.py
index cc9df3497d6..c65d4af64aa 100644
--- a/addons/website_sale/models/res_company.py
+++ b/addons/website_sale/models/res_company.py
@@ -7,6 +7,11 @@ from odoo import api, fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
+ 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',
+ )
website_sale_onboarding_payment_provider_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the website sale onboarding payment provider step", default='not_done')
@api.model
diff --git a/addons/website_sale/models/res_config_settings.py b/addons/website_sale/models/res_config_settings.py
index 3a95347ab14..03926a2a538 100644
--- a/addons/website_sale/models/res_config_settings.py
+++ b/addons/website_sale/models/res_config_settings.py
@@ -63,6 +63,11 @@ class ResConfigSettings(models.TransientModel):
website_sale_prevent_zero_price_sale = fields.Boolean(string="Prevent Sale of Zero Priced Product", related='website_id.prevent_zero_price_sale', readonly=False)
website_sale_contact_us_button_url = fields.Char(string="Button URL", related='website_id.contact_us_button_url', readonly=False)
website_sale_enabled_portal_reorder_button = fields.Boolean(string="Re-order From Portal", related='website_id.enabled_portal_reorder_button', readonly=False)
+ show_line_subtotals_tax_selection = fields.Selection(
+ required=True,
+ readonly=False,
+ related="company_id.show_line_subtotals_tax_selection",
+ )
@api.depends('website_id')
def _compute_terms_url(self):
diff --git a/addons/website_sale/static/tests/tours/website_sale_complete_flow.js b/addons/website_sale/static/tests/tours/website_sale_complete_flow.js
index ae3c489a3f9..b1955edd4fa 100644
--- a/addons/website_sale/static/tests/tours/website_sale_complete_flow.js
+++ b/addons/website_sale/static/tests/tours/website_sale_complete_flow.js
@@ -188,8 +188,6 @@ odoo.define('website_sale_tour.tour', function (require) {
args: [{
'auth_signup_uninvited': 'b2b',
'show_line_subtotals_tax_selection': 'tax_included',
- 'group_show_line_subtotals_tax_excluded': false,
- 'group_show_line_subtotals_tax_included': true,
}],
});
var def2 = def1.then(function (resId) {
diff --git a/addons/website_sale/tests/__init__.py b/addons/website_sale/tests/__init__.py
index c7cbc0fc02d..7ac9705aaff 100644
--- a/addons/website_sale/tests/__init__.py
+++ b/addons/website_sale/tests/__init__.py
@@ -21,5 +21,6 @@ from . import test_website_sale_visitor
from . import test_website_sale_product
from . import test_website_sale_shop_variant_exclusion
from . import test_website_editor
+from . import test_setting
from . import test_website_sale_reorder_from_portal
from . import test_website_sale_snippets
diff --git a/addons/website_sale/tests/test_sale_process.py b/addons/website_sale/tests/test_sale_process.py
index 6555944fb63..fc9eb6bc4be 100644
--- a/addons/website_sale/tests/test_sale_process.py
+++ b/addons/website_sale/tests/test_sale_process.py
@@ -119,8 +119,6 @@ class TestUi(HttpCaseWithUserDemo):
self.env['res.config.settings'].create({
'auth_signup_uninvited': 'b2c',
'show_line_subtotals_tax_selection': 'tax_excluded',
- 'group_show_line_subtotals_tax_excluded': True,
- 'group_show_line_subtotals_tax_included': False,
}).execute()
self.start_tour("/", 'website_sale_tour_1')
diff --git a/addons/account/tests/test_settings.py b/addons/website_sale/tests/test_setting.py
similarity index 53%
rename from addons/account/tests/test_settings.py
rename to addons/website_sale/tests/test_setting.py
index ecd4870025f..6fb1d58806e 100644
--- a/addons/account/tests/test_settings.py
+++ b/addons/website_sale/tests/test_setting.py
@@ -15,26 +15,9 @@ class TestSettings(AccountTestInvoicingCommon):
# at each setting change, all users should be removed from one group and added to the other
# so picking an arbitrary witness should be equivalent to checking that everything worked.
config = self.env['res.config.settings'].create({})
- self.switch_tax_settings(config)
-
- def switch_tax_settings(self, config):
- config.show_line_subtotals_tax_selection = "tax_excluded"
- config.flush_recordset()
- config.execute()
- self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_excluded'), True)
- self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_included'), False)
-
config.show_line_subtotals_tax_selection = "tax_included"
- config.flush_recordset()
- config.execute()
- self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_excluded'), False)
- self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_included'), True)
+ self.assertEqual(self.env.user.company_id.show_line_subtotals_tax_selection, "tax_included")
- config.show_line_subtotals_tax_selection = "tax_excluded"
- config.flush_recordset()
- config.execute()
- self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_excluded'), True)
- self.assertEqual(self.env.user.has_group('account.group_show_line_subtotals_tax_included'), False)
def test_switch_taxB2B_taxB2C_multicompany(self):
"""
@@ -43,15 +26,15 @@ class TestSettings(AccountTestInvoicingCommon):
if one is done in SQL and the other via the ORM.
Because the latter automatically takes into account record rules that
might make some users invisible.
-
This one is identical to the previous, except that we do the actions
with a non-superuser user, and in a new company with one user in common
with another company which has a different taxB2X setting.
"""
- user = self.env.ref('base.user_admin')
- company = self.env['res.company'].create({'name': 'oobO'})
- user.write({'company_ids': [(4, company.id)], 'company_id': company.id})
- Settings = self.env['res.config.settings'].with_user(user.id)
- config = Settings.create({})
- self.switch_tax_settings(config)
+ Settings = self.env['res.config.settings'].with_user(self.env.user.id)
+ config = Settings.create({})
+ config.show_line_subtotals_tax_selection = "tax_included"
+ self.assertEqual(self.env.user.company_id.show_line_subtotals_tax_selection, "tax_included")
+
+ self.env.user.company_id = self.company_data_2["company"].id
+ self.assertEqual(self.env.user.company_id.show_line_subtotals_tax_selection, "tax_excluded")
diff --git a/addons/website_sale/tests/test_website_sale_product_attribute_value_config.py b/addons/website_sale/tests/test_website_sale_product_attribute_value_config.py
index 6a89f4c8ea2..57d8ff8c032 100644
--- a/addons/website_sale/tests/test_website_sale_product_attribute_value_config.py
+++ b/addons/website_sale/tests/test_website_sale_product_attribute_value_config.py
@@ -58,10 +58,7 @@ class TestWebsiteSaleProductAttributeValueConfig(AccountTestInvoicingCommon, Tes
self.assertEqual(combination_info['has_discounted_price'], False)
# CASE: B2C setting
- group_tax_included = self.env.ref('account.group_show_line_subtotals_tax_included').with_context(active_test=False)
- group_tax_excluded = self.env.ref('account.group_show_line_subtotals_tax_excluded').with_context(active_test=False)
- group_tax_excluded.users -= self.env.user
- group_tax_included.users |= self.env.user
+ self.env.company.show_line_subtotals_tax_selection = 'tax_included'
combination_info = product_template._get_combination_info(pricelist=pricelist)
self.assertEqual(combination_info['price'], 2222 * discount_rate * currency_ratio * tax_ratio)
@@ -119,10 +116,7 @@ class TestWebsiteSaleProductAttributeValueConfig(AccountTestInvoicingCommon, Tes
computer_ssd_attribute_lines.product_template_value_ids[0].price_extra = 200
# Enable tax included
- group_tax_included = self.env.ref('account.group_show_line_subtotals_tax_included').with_context(active_test=False)
- group_tax_excluded = self.env.ref('account.group_show_line_subtotals_tax_excluded').with_context(active_test=False)
- group_tax_excluded.users -= self.env.user
- group_tax_included.users |= self.env.user
+ self.env.company.show_line_subtotals_tax_selection = 'tax_included'
combination_info = product._get_combination_info(pricelist=pricelist)
self.assertEqual(combination_info['price'], 575, "500$ + 15% tax")
diff --git a/addons/website_sale/views/res_config_settings_views.xml b/addons/website_sale/views/res_config_settings_views.xml
index eb0e471f3db..6ea8c88f92f 100644
--- a/addons/website_sale/views/res_config_settings_views.xml
+++ b/addons/website_sale/views/res_config_settings_views.xml
@@ -77,8 +77,6 @@
diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml
index 39793a9b836..65c78b4f15d 100644
--- a/addons/website_sale/views/templates.xml
+++ b/addons/website_sale/views/templates.xml
@@ -1141,10 +1141,10 @@
-
+
VAT Excluded
-
+
VAT Included
@@ -1450,10 +1450,10 @@
-
+
-
+
@@ -2117,8 +2117,8 @@
-
-
+
+
|
|