summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-11-07 11:01:14 +0100
committerChristophe Simonis <chs@odoo.com>2017-11-07 11:01:14 +0100
commit5f9c3f51a8be5e9c399228d5589d86d7bec94bc8 (patch)
treed2565ad7fa6d37d2d751b47d61f091cc00a15f03 /addons
parent5fa577a14d83d96ad6740c1414fd09acf0a673da (diff)
parentdb4886d511417dd2d74bd679792c6eba337917fc (diff)
[MERGE] forward port branch saas-15 up to db4886d5114
Diffstat (limited to 'addons')
-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_expense/__init__.py2
-rw-r--r--addons/sale_expense/models/__init__.py4
-rw-r--r--addons/sale_expense/models/product_template.py13
-rw-r--r--addons/sale_stock/static/src/js/tour.js4
7 files changed, 45 insertions, 8 deletions
diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index c0fe1b3ebcd..561743fcd00 100644
--- a/addons/account/models/account.py
+++ b/addons/account/models/account.py
@@ -836,7 +836,7 @@ class AccountTax(models.Model):
incl_fixed_amount = incl_percent_amount = 0
if self._context.get('force_price_include', 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 01f43cf510e..f1f1cc46f85 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -835,10 +835,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;
@@ -1624,7 +1624,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;
}
@@ -1640,7 +1640,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_expense/__init__.py b/addons/sale_expense/__init__.py
index 67dee8c60db..dc5e6b693d1 100644
--- a/addons/sale_expense/__init__.py
+++ b/addons/sale_expense/__init__.py
@@ -1,2 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import models
diff --git a/addons/sale_expense/models/__init__.py b/addons/sale_expense/models/__init__.py
new file mode 100644
index 00000000000..3a8ca74201b
--- /dev/null
+++ b/addons/sale_expense/models/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import product_template
diff --git a/addons/sale_expense/models/product_template.py b/addons/sale_expense/models/product_template.py
new file mode 100644
index 00000000000..5e6299f2548
--- /dev/null
+++ b/addons/sale_expense/models/product_template.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, models
+
+
+class ProductTemplate(models.Model):
+ _inherit = "product.template"
+
+ @api.onchange('can_be_expensed')
+ def _onchange_can_be_expensed(self):
+ if not self.can_be_expensed:
+ self.expense_policy = 'no'
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");
+ }
},
});
});