[FIX] purchase: prevent traceback when creating PO without company_id
when the user removes the company_id and add a line in the purchase order then the issue is generated. Steps to reproduce: - Create a new purchase order. - Remove the company_id in the Purchase order. - Now add a line in PO. Select a product with the consumable product type. - Traceback will be generated. Applying these changes will resolve this issue. Sentry-4215579151 closes odoo/odoo#124035 X-original-commit: 75edec6f73b70c4b9b86ad67bc838f468c2574b7 Signed-off-by: Tiffany Chang <tic@odoo.com>
This commit is contained in:
@@ -1227,10 +1227,10 @@ class PurchaseOrderLine(models.Model):
|
||||
return {'warning': warning}
|
||||
return {}
|
||||
|
||||
@api.depends('product_qty', 'product_uom')
|
||||
@api.depends('product_qty', 'product_uom', 'company_id')
|
||||
def _compute_price_unit_and_date_planned_and_name(self):
|
||||
for line in self:
|
||||
if not line.product_id or line.invoice_lines:
|
||||
if not line.product_id or line.invoice_lines or not line.company_id:
|
||||
continue
|
||||
params = {'order_id': line.order_id}
|
||||
seller = line.product_id._select_seller(
|
||||
|
||||
Reference in New Issue
Block a user