Browse Source

Jan 11 [UPDT] : Updated 'margin_product_sale_invoice'

pull/301/head
AjmalCybro 1 year ago
parent
commit
b14e094cb8
  1. 12
      margin_product_sale_invoice/models/sale_order.py

12
margin_product_sale_invoice/models/sale_order.py

@ -27,7 +27,7 @@ class SaleOrderLine(models.Model):
_inherit = 'sale.order.line' _inherit = 'sale.order.line'
cost_price_sale = fields.Float(string='Cost', cost_price_sale = fields.Float(string='Cost',
compute='compute_cost_price_amount', compute='compute_cost_price',
store=True, help='Field for cost price') store=True, help='Field for cost price')
margin_amount_sale = fields.Float(string='Margin Amount', margin_amount_sale = fields.Float(string='Margin Amount',
compute='compute_margin_amount', compute='compute_margin_amount',
@ -42,16 +42,6 @@ class SaleOrderLine(models.Model):
if record.product_id: if record.product_id:
record.cost_price_sale = record.product_id.standard_price record.cost_price_sale = record.product_id.standard_price
@api.depends('product_id')
def compute_cost_price_amount(self):
for record in self:
converted_amount = record.product_id.currency_id._convert(
from_amount=record.product_id.standard_price,
to_currency=record.env.company.currency_id, company=record.company_id,
date=fields.Date.today()
)
record.cost_price_sale = converted_amount
@api.depends('product_id') @api.depends('product_id')
def compute_margin_amount(self): def compute_margin_amount(self):
""" Compute the margin amount of the line. """ """ Compute the margin amount of the line. """

Loading…
Cancel
Save