Skip to content

Commit d1a1f90

Browse files
committed
[FIX] company_default_partner_pricelist: field name is updated
1 parent cffc7b1 commit d1a1f90

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

company_default_partner_pricelist/models/res_company.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
class ResCompany(models.Model):
77
_inherit = "res.company"
88

9-
default_property_product_pricelist = fields.Many2one(
9+
default_property_product_pricelist_id = fields.Many2one(
1010
"product.pricelist",
1111
string="Default Account Pricelist",
1212
help="Default pricelist for this company for new partners.",
1313
)
1414

1515
def _update_partner_pricelist_generic_property(self):
1616
self.ensure_one()
17-
default_property_pp = self.default_property_product_pricelist
18-
ir_property = self.env["ir.property"]
17+
default_property_pp = self.default_property_product_pricelist_id
18+
ir_property_obj = self.env["ir.property"].sudo()
1919
field = self.env["ir.model.fields"]._get(
2020
"res.partner", "property_product_pricelist"
2121
)
22-
ppty = ir_property.sudo().search(
22+
ppty = ir_property_obj.sudo().search(
2323
[
2424
("name", "=", "property_product_pricelist"),
2525
("company_id", "=", self.id),
@@ -36,7 +36,7 @@ def _update_partner_pricelist_generic_property(self):
3636
{"value_reference": "product.pricelist,%s" % default_property_pp.id}
3737
)
3838
elif default_property_pp:
39-
ir_property.sudo().create(
39+
ir_property_obj.sudo().create(
4040
{
4141
"name": "property_product_pricelist",
4242
"value_reference": "product.pricelist,%s" % default_property_pp.id,
@@ -47,13 +47,13 @@ def _update_partner_pricelist_generic_property(self):
4747

4848
def create(self, vals):
4949
res = super(ResCompany, self).create(vals)
50-
if "default_property_product_pricelist" in vals:
50+
if "default_property_product_pricelist_id" in vals:
5151
res._update_partner_pricelist_generic_property()
5252
return res
5353

5454
def write(self, vals):
5555
res = super(ResCompany, self).write(vals)
56-
if "default_property_product_pricelist" in vals:
56+
if "default_property_product_pricelist_id" in vals:
5757
for rec in self:
5858
rec._update_partner_pricelist_generic_property()
5959
return res

company_default_partner_pricelist/tests/test_company_default_partner_pricelist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def test_company_default_partner_pricelist(self):
2525
self.assertEqual(self.partner.property_product_pricelist, self.base_pricelist)
2626
# When the default is changed for the active company, the pricelist of
2727
# the partner is the one assigned to the current company
28-
self.env.company.default_property_product_pricelist = self.pricelist_2
28+
self.env.company.default_property_product_pricelist_id = self.pricelist_2
2929
self.partner.invalidate_recordset()
3030
self.assertEqual(self.partner.property_product_pricelist, self.pricelist_2)
3131

32-
self.env.company.default_property_product_pricelist = self.pricelist_3
32+
self.env.company.default_property_product_pricelist_id = self.pricelist_3
3333
self.partner.invalidate_recordset()
3434
self.assertEqual(self.partner.property_product_pricelist, self.pricelist_3)
3535

36-
self.env.company.default_property_product_pricelist = False
36+
self.env.company.default_property_product_pricelist_id = False
3737
self.partner.invalidate_recordset()
3838
self.assertEqual(self.partner.property_product_pricelist, self.base_pricelist)
3939

0 commit comments

Comments
 (0)