Skip to content

Commit

Permalink
[FIX] Cost computation
Browse files Browse the repository at this point in the history
  • Loading branch information
max3903 authored and Freni-OSI committed Apr 14, 2021
1 parent 4aea7f7 commit d893f51
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fieldservice_account/models/account_invoice.py
Expand Up @@ -39,16 +39,16 @@ def onchange_product_id(self):
raise ValidationError(
_("Please set the field service worker"))
fpos = partner.property_account_position_id
prices = partner.property_product_pricelist
tmpl = line.product_id.product_tmpl_id
if line.product_id:
accounts = tmpl.get_product_accounts()
cost = prices.get_product_price(product=line.product_id,
quantity=line.quantity,
partner=partner,
date=False,
uom_id=False)
line.price_unit = cost
supinfo = self.env['product.supplierinfo'].search(
[('name', '=', partner.id),
('product_tmpl_id', '=', tmpl.id),
('min_qty', '<=', line.quantity)],
order='min_qty DESC')
line.price_unit = \
supinfo and supinfo[0].price or tmpl.standard_price
line.account_id = accounts['expense']
line.invoice_line_tax_ids = fpos.\
map_tax(tmpl.supplier_taxes_id)
Expand Down

0 comments on commit d893f51

Please sign in to comment.