Skip to content

Commit

Permalink
Failsafe partner key for price updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ammonleslie authored and gdgellatly committed Sep 23, 2021
1 parent 8536e15 commit e4f4d5f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions product_list_price_change/models/product_product.py
Expand Up @@ -94,10 +94,13 @@ def _compute_product_lst_price(self):
effective_date = fields.Date.context_today(self)
if isinstance(effective_date, datetime):
effective_date = fields.Date.context_today(self, effective_date)
if self._context.get("partner_id"):
partner_id = self._context.get("partner_id", self._context.get("partner", False))
if partner_id and isinstance(partner_id, models.BaseModel):
partner_id = partner_id.id
if partner_id:
commercial_partner_id = (
self.env["res.partner"]
.browse(self._context.get("partner_id"))
.browse(partner_id)
.commercial_partner_id.id
)
fld = "partner_effective_date"
Expand Down

0 comments on commit e4f4d5f

Please sign in to comment.