[MERGE] forward port branch 9.0 up to aa7d1ab

This commit is contained in:
Christophe Simonis
2016-11-24 18:24:29 +01:00
3 changed files with 7 additions and 6 deletions
@@ -25,7 +25,8 @@ class AccountAnalyticLine(models.Model):
partner_id = fields.Many2one('res.partner', related='account_id.partner_id', string='Partner', store=True, readonly=True)
def _get_analytic_amount_currency(self):
self.analytic_amount_currency = abs(self.amount_currency) * copysign(1, self.amount)
for line in self:
line.analytic_amount_currency = abs(line.amount_currency) * copysign(1, line.amount)
@api.v8
@api.onchange('product_id', 'product_uom_id', 'unit_amount', 'currency_id')
+2 -2
View File
@@ -49,7 +49,7 @@ class AccountInvoice(models.Model):
self.amount_total = self.amount_untaxed + self.amount_tax
amount_total_company_signed = self.amount_total
amount_untaxed_signed = self.amount_untaxed
if self.currency_id and self.currency_id != self.company_id.currency_id:
if self.currency_id and self.company_id and self.currency_id != self.company_id.currency_id:
currency_id = self.currency_id.with_context(date=self.date_invoice)
amount_total_company_signed = currency_id.compute(self.amount_total, self.company_id.currency_id)
amount_untaxed_signed = currency_id.compute(self.amount_untaxed, self.company_id.currency_id)
@@ -1112,7 +1112,7 @@ class AccountInvoiceLine(models.Model):
if self.invoice_line_tax_ids:
taxes = self.invoice_line_tax_ids.compute_all(price, currency, self.quantity, product=self.product_id, partner=self.invoice_id.partner_id)
self.price_subtotal = price_subtotal_signed = taxes['total_excluded'] if taxes else self.quantity * price
if self.invoice_id.currency_id and self.invoice_id.currency_id != self.invoice_id.company_id.currency_id:
if self.invoice_id.currency_id and self.invoice_id.company_id and self.invoice_id.currency_id != self.invoice_id.company_id.currency_id:
price_subtotal_signed = self.invoice_id.currency_id.compute(price_subtotal_signed, self.invoice_id.company_id.currency_id)
sign = self.invoice_id.type in ['in_refund', 'out_refund'] and -1 or 1
self.price_subtotal_signed = price_subtotal_signed * sign
@@ -143,7 +143,7 @@ $('.oe_website_sale').each(function () {
if ($input.data('update_change')) {
return;
}
var value = parseInt($input.val(), 10);
var value = parseInt($input.val() || 0, 10);
var $dom = $(this).closest('tr');
var default_price = parseFloat($dom.find('.text-danger > span.oe_currency_value').text());
var $dom_optional = $dom.nextUntil(':not(.optional_product.info)');
@@ -164,7 +164,7 @@ $('.oe_website_sale').each(function () {
'set_qty': value})
.then(function (data) {
$input.data('update_change', false);
if (value !== parseInt($input.val(), 10)) {
if (value !== parseInt($input.val() || 0, 10)) {
$input.trigger('change');
return;
}
@@ -211,7 +211,7 @@ $('.oe_website_sale').each(function () {
var product_id = +$input.closest('*:has(input[name="product_id"])').find('input[name="product_id"]').val();
var min = parseFloat($input.data("min") || 0);
var max = parseFloat($input.data("max") || Infinity);
var quantity = ($link.has(".fa-minus").length ? -1 : 1) + parseFloat($input.val(),10);
var quantity = ($link.has(".fa-minus").length ? -1 : 1) + parseFloat($input.val() || 0, 10);
// if they are more of one input for this product (eg: option modal)
$('input[name="'+$input.attr("name")+'"]').add($input).filter(function () {
var $prod = $(this).closest('*:has(input[name="product_id"])');