[MERGE] forward port branch saas-15 up to db4886d511

This commit is contained in:
Christophe Simonis
2017-11-07 11:01:14 +01:00
7 changed files with 45 additions and 8 deletions
+1 -1
View File
@@ -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.
+16
View File
@@ -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
+6 -6
View File
@@ -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;
+2
View File
@@ -1,2 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
+4
View File
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import product_template
@@ -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'
+3 -1
View File
@@ -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");
}
},
});
});