[MERGE] forward port branch 9.0 up to 6c996723b2
This commit is contained in:
@@ -869,7 +869,7 @@ class AccountTax(models.Model):
|
||||
incl_fixed_amount = incl_percent_amount = 0
|
||||
if tax.price_include:
|
||||
if tax.amount_type == 'fixed':
|
||||
incl_fixed_amount += tax.amount
|
||||
incl_fixed_amount += quantity * tax.amount
|
||||
elif tax.amount_type == 'percent':
|
||||
incl_percent_amount += tax.amount
|
||||
# Start the computation of accumulated amounts at the total_excluded value.
|
||||
|
||||
@@ -232,6 +232,22 @@ class TestTax(AccountTestUsers):
|
||||
res
|
||||
)
|
||||
|
||||
self.fixed_tax.price_include = True
|
||||
self.fixed_tax.include_base_amount = False
|
||||
res = self.fixed_tax.compute_all(100.0, quantity=2.0)
|
||||
self._check_compute_all_results(
|
||||
180, # 'base'
|
||||
200, # 'total_included'
|
||||
180, # 'total_excluded'
|
||||
[
|
||||
# base , amount | seq | amount | incl | incl_base
|
||||
# ---------------------------------------------------
|
||||
(180.0, 20.0), # | 1 | 20 | | t
|
||||
# ---------------------------------------------------
|
||||
],
|
||||
res
|
||||
)
|
||||
|
||||
def test_tax_include_base_amount_2(self):
|
||||
self.percent_tax.price_include = True
|
||||
self.percent_tax.amount = 21.0
|
||||
|
||||
@@ -1502,7 +1502,7 @@ exports.Orderline = Backbone.Model.extend({
|
||||
}
|
||||
if(tax.price_include){
|
||||
if(tax.amount_type === 'fixed')
|
||||
incl_fixed_amount += tax.amount;
|
||||
incl_fixed_amount += quantity * tax.amount;
|
||||
else if(tax.amount_type === 'percent')
|
||||
incl_percent_amount += tax.amount;
|
||||
}
|
||||
@@ -1518,7 +1518,7 @@ exports.Orderline = Backbone.Model.extend({
|
||||
var amount = self._compute_all(tax, base, quantity, false);
|
||||
|
||||
if(!tax.price_include || base_gaps.length == 0)
|
||||
return tax_amount;
|
||||
return amount;
|
||||
|
||||
var new_gap = base_gaps[base_gaps.length - 1] - amount;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user