[IMP] purchase: use product cost when no pricelist

Before the commit, when there is no pricelist, we set the unit price to be 0
on the PO. After the commit, when in the same situation, we use the cost
set on the product form.

Task 2072560
PR #49067

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
yhu-odoo
2020-04-07 10:51:57 +00:00
parent baf891a304
commit 6b41dbf683
2 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -864,8 +864,7 @@ class PurchaseOrderLine(models.Model):
self.date_planned = self._get_date_planned(seller).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
if not seller:
if self.product_id.seller_ids.filtered(lambda s: s.name.id == self.partner_id.id):
self.price_unit = 0.0
self.price_unit = self.product_id.standard_price
return
price_unit = self.env['account.tax']._fix_tax_included_price_company(seller.price, self.product_id.supplier_taxes_id, self.taxes_id, self.company_id) if seller else 0.0
@@ -257,8 +257,8 @@ class TestStockValuationLCFIFOVB(TestStockValuationLCCommon):
with rfq.order_line.new() as po_line:
po_line.product_id = self.product1
po_line.price_unit = 10
po_line.product_qty = 10
po_line.price_unit = 10
po_line.taxes_id.clear()
rfq = rfq.save()
@@ -344,8 +344,8 @@ class TestStockValuationLCFIFOVB(TestStockValuationLCCommon):
with rfq.order_line.new() as po_line:
po_line.product_id = self.product1
po_line.price_unit = 10
po_line.product_qty = 10
po_line.price_unit = 10
po_line.taxes_id.clear()
rfq = rfq.save()
@@ -397,8 +397,8 @@ class TestStockValuationLCFIFOVB(TestStockValuationLCCommon):
with rfq.order_line.new() as po_line:
po_line.product_id = self.product1
po_line.price_unit = 10
po_line.product_qty = 10
po_line.price_unit = 10
po_line.taxes_id.clear()
rfq = rfq.save()