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

[16.0][MIG] company_default_partner_pricelist #1946

Open
wants to merge 12 commits into
base: 16.0
Choose a base branch
from

Conversation

geomer198
Copy link

Migration to 16.0

@geomer198 geomer198 force-pushed the 16.0-t4218-company_default_partner_pricelist-mig branch from a382afa to ffbfa74 Compare January 1, 2025 16:00

@openupgrade.migrate()
def migrate(env, version):
company = env["res.company"]

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"]

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([]):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for record in company.search([]):
for company in company.search([]):

class ResCompany(models.Model):
_inherit = "res.company"

default_property_product_pricelist = fields.Many2one(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default_property_product_pricelist = fields.Many2one(
default_property_product_pricelist_id = fields.Many2one(

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"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ir_property = self.env["ir.property"]
IrProperty = self.env["ir.property"]

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

@geomer198 geomer198 force-pushed the 16.0-t4218-company_default_partner_pricelist-mig branch from d1a1f90 to d48a280 Compare January 6, 2025 17:22
field = self.env["ir.model.fields"]._get(
"res.partner", "property_product_pricelist"
)
ppty = ir_property_obj.sudo().search(

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants