[IMP] website_(*)sale: configure tax display by website
task-3221549 closes odoo/odoo#120813 Related: odoo/upgrade#4643 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
<td width="15%" align="center"><span style="font-weight:bold;">Quantity</span></td>
|
||||
<td width="20%" align="right">
|
||||
<span style="font-weight:bold;">
|
||||
<t t-if="object.company_id.tax_calculation_rounding_method == 'round_per_line'">
|
||||
<t t-if="object.website_id.show_line_subtotals_tax_selection == 'tax_excluded'">
|
||||
VAT Excl.
|
||||
</t>
|
||||
<t t-else="">
|
||||
@@ -123,7 +123,7 @@
|
||||
<td align="left" t-out="line.product_id.name or ''"> Taking care of Trees Course</td>
|
||||
<td width="15%" align="center" t-out="line.product_uom_qty or ''">1</td>
|
||||
<td width="20%" align="right"><span style="font-weight:bold;">
|
||||
<t t-if="object.company_id.tax_calculation_rounding_method == 'round_per_line'">
|
||||
<t t-if="object.website_id.show_line_subtotals_tax_selection == 'tax_excluded'">
|
||||
<t t-out="format_amount(line.price_reduce_taxexcl, object.currency_id) or ''">$ 10.00</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
|
||||
@@ -13,47 +13,48 @@ from odoo.tests.common import tagged
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestWebsiteEventBoothSale(HttpCase, TestWebsiteEventSaleCommon):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.env["res.company"].sudo().search([]).show_line_subtotals_tax_selection = 'tax_included'
|
||||
self.tax = self.env['account.tax'].sudo().create({
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env['website'].sudo().search([]).show_line_subtotals_tax_selection = 'tax_included'
|
||||
cls.tax = cls.env['account.tax'].sudo().create({
|
||||
'name': 'Tax 10',
|
||||
'amount': 10,
|
||||
})
|
||||
self.booth_product = self.env['product.product'].create({
|
||||
cls.booth_product = cls.env['product.product'].create({
|
||||
'name': 'Test Booth Product',
|
||||
'description_sale': 'Mighty Booth Description',
|
||||
'list_price': 20,
|
||||
'standard_price': 60.0,
|
||||
'taxes_id': [(6, 0, [self.tax.id])],
|
||||
'taxes_id': [(6, 0, [cls.tax.id])],
|
||||
'detailed_type': 'event_booth',
|
||||
})
|
||||
self.event_booth_category = self.env['event.booth.category'].create({
|
||||
cls.event_booth_category = cls.env['event.booth.category'].create({
|
||||
'name': 'Standard',
|
||||
'description': '<p>Standard</p>',
|
||||
'product_id': self.booth_product.id,
|
||||
'product_id': cls.booth_product.id,
|
||||
'price': 100.0,
|
||||
})
|
||||
self.event_type = self.env['event.type'].create({
|
||||
cls.event_type = cls.env['event.type'].create({
|
||||
'name': 'Booth Type',
|
||||
'event_type_booth_ids': [
|
||||
Command.create({
|
||||
'name': 'Standard 1',
|
||||
'booth_category_id': self.event_booth_category.id,
|
||||
'booth_category_id': cls.event_booth_category.id,
|
||||
}),
|
||||
Command.create({
|
||||
'name': 'Standard 2',
|
||||
'booth_category_id': self.event_booth_category.id,
|
||||
'booth_category_id': cls.event_booth_category.id,
|
||||
}),
|
||||
Command.create({
|
||||
'name': 'Standard 3',
|
||||
'booth_category_id': self.event_booth_category.id,
|
||||
'booth_category_id': cls.event_booth_category.id,
|
||||
}),
|
||||
],
|
||||
})
|
||||
self.env['event.event'].create({
|
||||
cls.env['event.event'].create({
|
||||
'name': 'Test Event Booths',
|
||||
'event_type_id': self.event_type.id,
|
||||
'event_type_id': cls.event_type.id,
|
||||
'date_begin': fields.Datetime.to_string(datetime.today() + timedelta(days=1)),
|
||||
'date_end': fields.Datetime.to_string(datetime.today() + timedelta(days=15)),
|
||||
'website_published': True,
|
||||
|
||||
@@ -1,34 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo><data>
|
||||
<odoo>
|
||||
|
||||
<template id="event_booth_registration" inherit_id="website_event_booth.event_booth_registration">
|
||||
<xpath expr="//h5[@name='booth_category_name']" position="after">
|
||||
<t t-if="booth_category.price">
|
||||
<t t-if="(booth_category.price - booth_category.price_reduce) > 0 and website.get_current_pricelist().discount_policy == 'without_discount'">
|
||||
<del class="text-danger me-1"
|
||||
<t t-if="(booth_category.price - booth_category.price_reduce) > 0 and website.pricelist_id.discount_policy == 'without_discount'">
|
||||
<del t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
class="text-danger me-1"
|
||||
t-field="booth_category.price"
|
||||
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'"/>
|
||||
<del class="text-danger me-1"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<del t-else=""
|
||||
class="text-danger me-1"
|
||||
t-field="booth_category.price_incl"
|
||||
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_included'"/>
|
||||
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
</t>
|
||||
<span t-field="booth_category.price_reduce" class="fw-normal text-muted"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
|
||||
<span t-field="booth_category.price_reduce_taxinc" class="fw-normal text-muted"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
|
||||
<span t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
t-field="booth_category.price_reduce" class="fw-normal text-muted"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<span t-else=""
|
||||
t-field="booth_category.price_reduce_taxinc" class="fw-normal text-muted"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
</t>
|
||||
<span t-else="" class="fw-normal text-muted">Free</span>
|
||||
</xpath>
|
||||
<xpath expr="//input[@name='booth_category_id']" position="attributes">
|
||||
<attribute name="t-att-data-price">
|
||||
event.company_id.sudo().currency_id._convert(
|
||||
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,
|
||||
booth_category.price_reduce_taxinc if website.show_line_subtotals_tax_selection == 'tax_included' else booth_category.price_reduce,
|
||||
website.currency_id,
|
||||
event.company_id,
|
||||
datetime.date.today()
|
||||
) or '0'
|
||||
@@ -47,4 +46,4 @@
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</data></odoo>
|
||||
</odoo>
|
||||
|
||||
@@ -15,22 +15,22 @@
|
||||
<!-- Add price information on tickets (multi tickets, aka in collapse) -->
|
||||
<xpath expr="//div[hasclass('o_wevent_registration_multi_select')]" position="inside">
|
||||
<t t-if="ticket.price">
|
||||
<t t-if="(ticket.price - ticket.price_reduce) > 0 and website.pricelist_id and website.pricelist_id.discount_policy == 'without_discount'">
|
||||
<del class="text-danger me-1"
|
||||
<t t-if="(ticket.price - ticket.price_reduce) > 0 and website.pricelist_id.discount_policy == 'without_discount'">
|
||||
<del t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
class="text-danger me-1"
|
||||
t-field="ticket.price"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
|
||||
<del class="text-danger me-1"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<del t-else=""
|
||||
class="text-danger me-1"
|
||||
t-field="ticket.price_incl"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
</t>
|
||||
<span t-field="ticket.price_reduce"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
|
||||
<span t-field="ticket.price_reduce_taxinc"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
|
||||
<span t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
t-field="ticket.price_reduce"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<span t-else=""
|
||||
t-field="ticket.price_reduce_taxinc"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<span itemprop="price" class="d-none" t-out="ticket.price"/>
|
||||
<span itemprop="priceCurrency" class="d-none" t-out="website.currency_id.name"/>
|
||||
</t>
|
||||
@@ -55,22 +55,22 @@
|
||||
<xpath expr="//div[hasclass('o_wevent_registration_single')]//h6" position="after">
|
||||
<div class="px-2 text-dark d-flex align-items-center align-self-stretch">
|
||||
<t t-if="tickets.price">
|
||||
<t t-if="(tickets.price - tickets.price_reduce) >0 and website.pricelist_id and website.get_current_pricelist().discount_policy == 'without_discount'">
|
||||
<del class="text-danger me-1"
|
||||
<t t-if="(tickets.price - tickets.price_reduce) >0 and website.pricelist_id.discount_policy == 'without_discount'">
|
||||
<del t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
class="text-danger me-1"
|
||||
t-field="tickets.price"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
|
||||
<del class="text-danger me-1"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<del t-else=""
|
||||
class="text-danger me-1"
|
||||
t-field="tickets.price_incl"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
</t>
|
||||
<span t-field="tickets.price_reduce"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
|
||||
<span t-field="tickets.price_reduce_taxinc"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"
|
||||
t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
|
||||
<span t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
t-field="tickets.price_reduce"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<span t-else=""
|
||||
t-field="tickets.price_reduce_taxinc"
|
||||
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.currency_id}"/>
|
||||
<span itemprop="price" class="d-none" t-out="tickets.price"/>
|
||||
<span itemprop="priceCurrency" class="d-none" t-out="website.currency_id.name"/>
|
||||
</t>
|
||||
|
||||
@@ -181,7 +181,7 @@ class WebsiteSaleDelivery(WebsiteSale):
|
||||
product=carrier.product_id,
|
||||
partner=order.partner_shipping_id,
|
||||
)
|
||||
if not is_express_checkout_flow and request.env.company.show_line_subtotals_tax_selection == 'tax_excluded':
|
||||
if not is_express_checkout_flow and request.website.show_line_subtotals_tax_selection == 'tax_excluded':
|
||||
rate['price'] = taxes['total_excluded']
|
||||
else:
|
||||
rate['price'] = taxes['total_included']
|
||||
|
||||
@@ -99,7 +99,8 @@ class Product(models.Model):
|
||||
def _get_contextual_price_tax_selection(self):
|
||||
self.ensure_one()
|
||||
price = self._get_contextual_price()
|
||||
line_tax_type = self.env.company.show_line_subtotals_tax_selection
|
||||
website = self.env['website'].get_current_website()
|
||||
line_tax_type = website.show_line_subtotals_tax_selection
|
||||
company_taxes = self.taxes_id.filtered(lambda tax: tax.company_id == self.env.company)
|
||||
if line_tax_type == "tax_included" and company_taxes:
|
||||
price = company_taxes.compute_all(price, product=self, partner=self.env['res.partner'])['total_included']
|
||||
|
||||
@@ -178,6 +178,11 @@ class ProductTemplate(models.Model):
|
||||
show_discount = pricelist and pricelist.discount_policy == 'without_discount'
|
||||
|
||||
base_sales_prices = self._price_compute('list_price', currency=currency)
|
||||
website = self.env['website'].get_current_website()
|
||||
if website.show_line_subtotals_tax_selection == 'tax_excluded':
|
||||
tax_display = 'total_excluded'
|
||||
else:
|
||||
tax_display = 'total_included'
|
||||
|
||||
res = {}
|
||||
for template in self:
|
||||
@@ -185,7 +190,6 @@ class ProductTemplate(models.Model):
|
||||
|
||||
product_taxes = template.sudo().taxes_id.filtered(lambda t: t.company_id == t.env.company)
|
||||
taxes = fiscal_position.map_tax(product_taxes)
|
||||
tax_display = 'total_excluded' if self.env.company.show_line_subtotals_tax_selection == 'tax_excluded' else 'total_included'
|
||||
|
||||
template_price_vals = {
|
||||
'price_reduce': price_reduce
|
||||
@@ -312,10 +316,11 @@ class ProductTemplate(models.Model):
|
||||
def _price_with_tax_computed(
|
||||
self, price, product_taxes, taxes, company_id, currency, product, partner
|
||||
):
|
||||
website = self.env['website'].get_current_website()
|
||||
price = self.env['account.tax']._fix_tax_included_price_company(
|
||||
price, product_taxes, taxes, company_id
|
||||
)
|
||||
show_tax = self.env.company.show_line_subtotals_tax_selection
|
||||
show_tax = website.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]
|
||||
|
||||
@@ -7,11 +7,6 @@ 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
|
||||
|
||||
@@ -52,9 +52,8 @@ class ResConfigSettings(models.TransientModel):
|
||||
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",
|
||||
related='website_id.show_line_subtotals_tax_selection',
|
||||
)
|
||||
|
||||
@api.depends('website_id')
|
||||
|
||||
@@ -30,9 +30,7 @@ class SaleOrder(models.Model):
|
||||
amount_delivery = fields.Monetary(
|
||||
string="Delivery Amount",
|
||||
compute='_compute_amount_delivery',
|
||||
help="The amount without tax.",
|
||||
store=True,
|
||||
tracking=True,
|
||||
help="Tax included or excluded depending on the website configuration.",
|
||||
)
|
||||
access_point_address = fields.Json("Delivery Point Address")
|
||||
|
||||
@@ -79,13 +77,15 @@ class SaleOrder(models.Model):
|
||||
order.cart_quantity = int(sum(order.mapped('website_order_line.product_uom_qty')))
|
||||
order.only_services = all(l.product_id.type == 'service' for l in order.website_order_line)
|
||||
|
||||
@api.depends('order_line.price_unit', 'order_line.tax_id', 'order_line.discount', 'order_line.product_uom_qty')
|
||||
@api.depends('order_line.price_total', 'order_line.price_subtotal')
|
||||
def _compute_amount_delivery(self):
|
||||
for order in self:
|
||||
if self.env.company.show_line_subtotals_tax_selection == 'tax_excluded':
|
||||
order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_subtotal'))
|
||||
self.amount_delivery = 0.0
|
||||
for order in self.filtered('website_id'):
|
||||
delivery_lines = order.order_line.filtered('is_delivery')
|
||||
if order.website_id.show_line_subtotals_tax_selection == 'tax_excluded':
|
||||
order.amount_delivery = sum(delivery_lines.mapped('price_subtotal'))
|
||||
else:
|
||||
order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_total'))
|
||||
order.amount_delivery = sum(delivery_lines.mapped('price_total'))
|
||||
|
||||
@api.depends('website_id', 'date_order', 'order_line', 'state', 'partner_id')
|
||||
def _compute_abandoned_cart(self):
|
||||
|
||||
@@ -26,6 +26,14 @@ class Website(models.Model):
|
||||
salesteam_id = fields.Many2one('crm.team',
|
||||
string='Sales Team', ondelete="set null",
|
||||
default=_default_salesteam_id)
|
||||
show_line_subtotals_tax_selection = fields.Selection(
|
||||
selection=[
|
||||
('tax_excluded', "Tax Excluded"),
|
||||
('tax_included', "Tax Included"),
|
||||
],
|
||||
string="Line Subtotals Tax Display",
|
||||
required=True, default='tax_excluded',
|
||||
)
|
||||
|
||||
pricelist_id = fields.Many2one(
|
||||
'product.pricelist', compute='_compute_pricelist_id', string="Default Pricelist if any")
|
||||
|
||||
@@ -24,6 +24,5 @@ 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
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestSettings(AccountTestInvoicingCommon):
|
||||
|
||||
def test_switch_taxB2B_taxB2C(self):
|
||||
"""
|
||||
Since having users both in the tax B2B and tax B2C groups raise,
|
||||
modifications of the settings must be done in the right order;
|
||||
otherwise it is impossible to change the settings.
|
||||
"""
|
||||
# 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({})
|
||||
config.show_line_subtotals_tax_selection = "tax_included"
|
||||
self.assertEqual(self.env.user.company_id.show_line_subtotals_tax_selection, "tax_included")
|
||||
|
||||
|
||||
def test_switch_taxB2B_taxB2C_multicompany(self):
|
||||
"""
|
||||
Contrarily to the (apparently reasonable) assumption that adding users
|
||||
to group and removing them was symmetrical, it may not be the case
|
||||
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.
|
||||
"""
|
||||
|
||||
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")
|
||||
@@ -58,7 +58,7 @@ class TestWebsiteSaleProductAttributeValueConfig(AccountTestInvoicingCommon, Tes
|
||||
self.assertEqual(combination_info['has_discounted_price'], False)
|
||||
|
||||
# CASE: B2C setting
|
||||
self.env.company.show_line_subtotals_tax_selection = 'tax_included'
|
||||
website.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)
|
||||
@@ -116,7 +116,7 @@ class TestWebsiteSaleProductAttributeValueConfig(AccountTestInvoicingCommon, Tes
|
||||
computer_ssd_attribute_lines.product_template_value_ids[0].price_extra = 200
|
||||
|
||||
# Enable tax included
|
||||
self.env.company.show_line_subtotals_tax_selection = 'tax_included'
|
||||
website.show_line_subtotals_tax_selection = 'tax_included'
|
||||
|
||||
combination_info = product._get_combination_info(pricelist=pricelist)
|
||||
self.assertEqual(combination_info['price'], 575, "500$ + 15% tax")
|
||||
|
||||
@@ -73,9 +73,14 @@
|
||||
</block>
|
||||
|
||||
<block title="Shop - Products" id="sale_product_catalog_settings">
|
||||
<setting id="website_tax_inclusion_setting" string="Display Product Prices" help="Prices displayed on your eCommerce">
|
||||
<setting id="website_tax_inclusion_setting">
|
||||
<label for="show_line_subtotals_tax_selection" string="Display Product Prices"/>
|
||||
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
|
||||
<div class="text-muted">
|
||||
Prices displayed on your eCommerce
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="mt16">
|
||||
<div class="row mt16">
|
||||
<field name="show_line_subtotals_tax_selection" class="o_light_label" widget="radio"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1141,10 +1141,10 @@
|
||||
</template>
|
||||
|
||||
<template id="website_sale.tax_indication" active="False">
|
||||
<span t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'" class="h6 text-muted">
|
||||
<span t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'" class="h6 text-muted">
|
||||
VAT Excluded
|
||||
</span>
|
||||
<span t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'" class="h6 text-muted">
|
||||
<span t-else="" class="h6 text-muted">
|
||||
VAT Included
|
||||
</span>
|
||||
</template>
|
||||
@@ -1454,12 +1454,12 @@
|
||||
<t t-set="combination" t-value="line.product_id.product_template_attribute_value_ids + line.product_no_variant_attribute_value_ids"/>
|
||||
<t t-set="combination_info" t-value="line.product_id.product_tmpl_id._get_combination_info(combination, pricelist=website_sale_order.pricelist_id, add_qty=line.product_uom_qty)"/>
|
||||
|
||||
<t t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'">
|
||||
<span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/>
|
||||
</t>
|
||||
<t t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'">
|
||||
<span t-field="line.price_reduce_taxinc" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/>
|
||||
</t>
|
||||
<span t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
t-field="line.price_reduce_taxexcl" style="white-space: nowrap;"
|
||||
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/>
|
||||
<span t-else=""
|
||||
t-field="line.price_reduce_taxinc" style="white-space: nowrap;"
|
||||
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/>
|
||||
<t t-if="line.discount">
|
||||
<del t-attf-class="#{'text-danger mr8'}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}" />
|
||||
</t>
|
||||
@@ -2121,8 +2121,12 @@
|
||||
</t>
|
||||
</td>
|
||||
<td class="text-center td-price">
|
||||
<span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}" t-if="env.company.show_line_subtotals_tax_selection == 'tax_excluded'"/>
|
||||
<span t-field="line.price_reduce_taxinc" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}" t-if="env.company.show_line_subtotals_tax_selection == 'tax_included'"/>
|
||||
<span t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'"
|
||||
t-field="line.price_reduce_taxexcl" style="white-space: nowrap;"
|
||||
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/>
|
||||
<span t-else=""
|
||||
t-field="line.price_reduce_taxinc" style="white-space: nowrap;"
|
||||
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user