[FIX] sale_management: optional product

- Activate 'Multiple prices per product'
- Create a Product A, and add an entry in the 'Pricing' section of the
  product form
- Create a SO, a product, and add A in the 'Optional Products' tab.
- Click on 'Add to order lines'

A crash occurs at currency conversion.

When getting the conversion rate, the company is empty in method
`_get_conversion_rate`. This is because the company is a stored related
field, which is computed after creation. However, the method
`_prepare_add_missing_fields` is called before creation. This method
calls several onchange methods, one of them computing a price
conversion.

We explicitly add the company when creating the SO line.

opw-1939106

closes odoo/odoo#31455
This commit is contained in:
Nicolas Martinelli
2019-02-27 09:39:32 +00:00
parent 2181a9fb96
commit 70c8fd7f75
@@ -209,4 +209,5 @@ class SaleOrderOption(models.Model):
'product_uom_qty': self.quantity,
'product_uom': self.uom_id.id,
'discount': self.discount,
'company_id': self.order_id.company_id.id,
}