[FIX] purchase: supplier on parent company
- Create a product and set a contact as the vendor (for instance, Arthur Gomez from Asustek in the runbot) - Set a specific name and code for the supplier - Create a RFQ for this vendor (Arthur Gomez - the contact person) - Add the product, confirm the RFQ On the product, the company (Asustek) is automatically added as vendor, but there is no vendor name and code. opw-1929745 closes odoo/odoo#30891
This commit is contained in:
@@ -448,6 +448,16 @@ class PurchaseOrder(models.Model):
|
||||
'currency_id': currency.id,
|
||||
'delay': 0,
|
||||
}
|
||||
# In case the order partner is a contact address, a new supplierinfo is created on
|
||||
# the parent company. In this case, we keep the product name and code.
|
||||
seller = line.product_id._select_seller(
|
||||
partner_id=line.partner_id,
|
||||
quantity=line.product_qty,
|
||||
date=line.order_id.date_order and line.order_id.date_order[:10],
|
||||
uom_id=line.product_uom)
|
||||
if seller:
|
||||
supplierinfo['product_name'] = seller.product_name
|
||||
supplierinfo['product_code'] = seller.product_code
|
||||
vals = {
|
||||
'seller_ids': [(0, 0, supplierinfo)],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user