purchase-workflow icon indicating copy to clipboard operation
purchase-workflow copied to clipboard

[16.0]purchase_last_price_info:Multicompany Permission Error, what type of migration is this

Open linuxivan opened this issue 1 year ago • 4 comments

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:

  1. New DB with only 1 company
  2. Create a new purchase
  3. Add a line
  4. Change the purchase price
  5. Try to save

Additional context Tried on runboat

image

linuxivan avatar Jun 26 '24 11:06 linuxivan

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

patrickt-oforce avatar Aug 02 '24 07:08 patrickt-oforce

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...

risto42 avatar Dec 08 '24 10:12 risto42

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.

adasatorres avatar Mar 14 '25 19:03 adasatorres