[6.0] product_id_change of account.invoice may fail if no company_id or currency_id is supplied.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
On trunk/6.0 the account module was updated to add multicompany support. The invoices product_id field 'on-change' method (named product_id_change) was modified to get the company_id from the context and the invoice view was modified accordingly to pass the company_id on the context.
But if a module does not pass the company_id on the context (like account_
Currently the code looks like this:
def product_
...
company_id = context.
...
if company_id:
...
...
if not company_id and not currency_id:
return res_final
company = self.pool.
currency = self.pool.
...
That means that, if currency_id is defined, but company_id is not defined the method will crash!
Also, if no currency_id is defined, but company_id is in context, it will crash too.
Instead of "if not company_id and not currency_id:" it should be "if not company_id or not currency_id:".
Related branches
summary: |
[6.0] product_id_change of account.invoice does crash if no company_id - is passed in the contex + is passed in the context |
Changed in openobject-addons: | |
status: | New → Confirmed |
summary: |
- [6.0] product_id_change of account.invoice does crash if no company_id - is passed in the context + [6.0] product_id_change of account.invoice may fail if no company_id or + currency_id is supplied. |
Fixed by revision 4544 <email address hidden>.
Thanks.