-
-
Notifications
You must be signed in to change notification settings - Fork 867
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
[16.0][MIG] company_default_partner_pricelist #1946
base: 16.0
Are you sure you want to change the base?
[16.0][MIG] company_default_partner_pricelist #1946
Conversation
Odoo standard gives priority to a generic property before using the domain hook to obtain the default pricelist. Therefore, this fix manages the default pricelist in the company by utilizing a generic property.
a382afa
to
ffbfa74
Compare
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
company = env["res.company"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
company_obj or ResCompany
@openupgrade.migrate() | ||
def migrate(env, version): | ||
company = env["res.company"] | ||
ir_property = env["ir.property"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ir_property_obj or IrProperty
company = env["res.company"] | ||
ir_property = env["ir.property"] | ||
field = env["ir.model.fields"]._get("res.partner", "property_product_pricelist") | ||
for record in company.search([]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for record in company.search([]): | |
for company in company.search([]): |
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
default_property_product_pricelist = fields.Many2one( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default_property_product_pricelist = fields.Many2one( | |
default_property_product_pricelist_id = fields.Many2one( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should have a subfix as _id
for many2one
def _update_partner_pricelist_generic_property(self): | ||
self.ensure_one() | ||
default_property_pp = self.default_property_product_pricelist | ||
ir_property = self.env["ir.property"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ir_property = self.env["ir.property"] | |
IrProperty = self.env["ir.property"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and maybe set it with sudo()
here too since you use sudo for all the following calls
d1a1f90
to
d48a280
Compare
field = self.env["ir.model.fields"]._get( | ||
"res.partner", "property_product_pricelist" | ||
) | ||
ppty = ir_property_obj.sudo().search( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you help checking as if you already specify ir_property_obj with sudo, all the sudos on line 22, 33, 35 and 39 are not needed
Migration to 16.0