[16.0]purchase_last_price_info:Multicompany Permission Error, what type of migration is this
Module
purchase_last_price_info
Describe the bug
If you have not multicompany, when you add a new line at a new purchase quotation, gives an permission error about multi-company rule, literaly you cannot make a purchase, this is migrated without review or what?
To Reproduce
Affected versions:
Steps to reproduce the behavior:
- New DB with only 1 company
- Create a new purchase
- Add a line
- Change the purchase price
- Try to save
Additional context Tried on runboat
The error happen because Odoo has changed the multi-company rule in this commit https://github.com/odoo/odoo/commit/a04df5cb1411a14752ba7a4d6b3c4b7b4f1d6d44#diff-268cc255bd6ec91b9684239e0ea25bf0026c67fbfe88afef6bc1fa4b8a63598cR52 a possible way is to restore that rule on module install and in case of migration, restore during migration
we're having the same issue. prior to installing oca modules the problem doesn't seem to arise.
manually setting the rule to <field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
gets over the problem for now (that is, adding + [False])
The real question is, why all of a sudden is company_id == False ? apparently it was absent before...
Hello, I have been reviewing the issue. For me, removing the domain from the last_purchase_line_ids field of product.product solves it. In the method that calculates last_purchase_line_id, I have filtered by lines with the state is purchase or done to maintain this functionality. Filtering by companies is not necessary since the global rule takes care of this.