Vauxoo / odoo

Fork of Odoo (formerly OpenERP). [This project is not publically mantained just born for internal usage with some little patches] go to official repository on github.com/odoo/odoo
https://www.odoo.com
Other
9 stars 9 forks source link

[FIX] purchase,stock: Don't access orderpoint's related and not stored field #398

Closed luisg123v closed 3 years ago

luisg123v commented 3 years ago

Due to an issue in the ORM, this field is not always retrieved correctly from cache. The usual process is:

  1. Try to retrieve the value
  2. If not present, retrieve from database and try again
  3. If still not present, it means the value is actually not present

The issue is, when this field is accessed, step 2 needs to be performed twice (and it actually exists), in order for the value to be retrieved correctly.

This issue is evident when the scheduler is run and there are pending purchase orders, because it needs to convert the PO's UoM into product's UoM.

To solve the above, the related field is not accessed directly, but the original field is used.

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

-- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr