summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-11-06 12:42:56 +0100
committerChristophe Simonis <chs@odoo.com>2017-11-06 12:42:56 +0100
commit88c641e6dce74791c85537dc2d1f1da48da88cbc (patch)
tree7c130f56ec8dc1914400fbe1b4255e5eeea05492
parentd8888bdbaea0d3f708dd26eac933604b5f5f0046 (diff)
parent6c1c1f6e9e03322771169b920d3c14c5e33111e9 (diff)
[MERGE] forward port branch 10.0 up to 6c1c1f6e9e0
-rw-r--r--addons/account/models/account.py2
-rw-r--r--addons/account/tests/test_tax.py16
-rw-r--r--addons/point_of_sale/static/src/js/models.js12
-rw-r--r--addons/sale_stock/static/src/js/tour.js4
4 files changed, 26 insertions, 8 deletions
diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index 27b51150809..88c674a3810 100644
--- a/addons/account/models/account.py
+++ b/addons/account/models/account.py
@@ -835,7 +835,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.
diff --git a/addons/account/tests/test_tax.py b/addons/account/tests/test_tax.py
index cfd5470981b..806c0e5cda4 100644
--- a/addons/account/tests/test_tax.py
+++ b/addons/account/tests/test_tax.py
@@ -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
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 2beafcd30ae..b268e88571c 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -725,10 +725,10 @@ exports.PosModel = Backbone.Model.extend({
// generate the pdf and download it
self.chrome.do_action('point_of_sale.pos_invoice_report',{additional_context:{
active_ids:order_server_id,
- }});
-
- invoiced.resolve();
- done.resolve();
+ }}).done(function () {
+ invoiced.resolve();
+ done.resolve();
+ });
});
return done;
@@ -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;
diff --git a/addons/sale_stock/static/src/js/tour.js b/addons/sale_stock/static/src/js/tour.js
index cb10a00c5ef..690150677de 100644
--- a/addons/sale_stock/static/src/js/tour.js
+++ b/addons/sale_stock/static/src/js/tour.js
@@ -20,7 +20,9 @@ odoo.define("sale_stock.tour", function (require) {
auto: true,
in_modal: false,
run: function (actions) {
- actions.auto(".modal-footer .btn-primary");
+ if ($('.modal-footer .btn-primary').length){
+ actions.auto(".modal-footer .btn-primary");
+ }
},
});
});