[MERGE] forward port branch 9.0 up to 479facb783
This commit is contained in:
@@ -1101,6 +1101,7 @@ exports.Orderline = Backbone.Model.extend({
|
|||||||
orderline.quantity = this.quantity;
|
orderline.quantity = this.quantity;
|
||||||
orderline.quantityStr = this.quantityStr;
|
orderline.quantityStr = this.quantityStr;
|
||||||
orderline.discount = this.discount;
|
orderline.discount = this.discount;
|
||||||
|
orderline.price = this.price;
|
||||||
orderline.type = this.type;
|
orderline.type = this.type;
|
||||||
orderline.selected = false;
|
orderline.selected = false;
|
||||||
return orderline;
|
return orderline;
|
||||||
|
|||||||
@@ -57,7 +57,12 @@ class SaleOrderLine(models.Model):
|
|||||||
def _product_margin(self):
|
def _product_margin(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
currency = line.order_id.pricelist_id.currency_id
|
currency = line.order_id.pricelist_id.currency_id
|
||||||
line.margin = currency.round(line.price_subtotal - ((line.purchase_price or line.product_id.standard_price) * line.product_uom_qty))
|
price = line.purchase_price
|
||||||
|
if not price:
|
||||||
|
from_cur = line.env.user.company_id.currency_id.with_context(date=line.order_id.date_order)
|
||||||
|
price = from_cur.compute(line.product_id.standard_price, currency, round=False)
|
||||||
|
|
||||||
|
line.margin = currency.round(line.price_subtotal - (price * line.product_uom_qty))
|
||||||
|
|
||||||
|
|
||||||
class SaleOrder(models.Model):
|
class SaleOrder(models.Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user