Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] sale_stock: default warehouse_id #48378

Closed

Conversation

@fw-bot
Copy link
Contributor

fw-bot commented Mar 25, 2020

The warehouse_id default is incorrectly using self.user_id on an empty recordset.

But as the ir_model_fields of the property_warehouse_id field on res_users isn't already created, reading the field crashes when trying to fetch the properties from the database. To avoid this problem at database initialization, we only use the search fallback of the default as default warehouse_id for all existing Sales Order.

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

Forward-Port-Of: #47834

Finetuning of
b30e280
:

self.user_id is always an empty recordset in a default function call,
use self.env.user instead, it is the default value for user_id.

The _init_column override is needed to ensure the new property field on
res_users isn't read at module installation, because its ir.model.fields
doesn't exist already, leading to a wrong sql query in ir_property.

X-original-commit: 6c6bd01
@fw-bot

This comment has been minimized.

Copy link
Contributor Author

fw-bot commented Mar 25, 2020

Ping @Feyensv
This PR targets master and is the last of the forward-port chain.

To merge the full chain, say

@fw-bot r+

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@Feyensv

This comment has been minimized.

Copy link
Contributor

Feyensv commented Mar 25, 2020

@fw-bot r+

@C3POdoo C3POdoo added the RD label Mar 25, 2020
robodoo pushed a commit that referenced this pull request Mar 25, 2020
Finetuning of
b30e280
:

self.user_id is always an empty recordset in a default function call,
use self.env.user instead, it is the default value for user_id.

The _init_column override is needed to ensure the new property field on
res_users isn't read at module installation, because its ir.model.fields
doesn't exist already, leading to a wrong sql query in ir_property.

closes #48378

X-original-commit: 6c6bd01
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
@robodoo robodoo closed this Mar 25, 2020
@robodoo robodoo deployed to merge Mar 25, 2020 Active
vtu-odoo added a commit to odoo-dev/odoo that referenced this pull request Mar 30, 2020
Finetuning of
odoo@b30e280
:

self.user_id is always an empty recordset in a default function call,
use self.env.user instead, it is the default value for user_id.

The _init_column override is needed to ensure the new property field on
res_users isn't read at module installation, because its ir.model.fields
doesn't exist already, leading to a wrong sql query in ir_property.

closes odoo#48378

X-original-commit: 6c6bd01
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.