Skip to content

Commit

Permalink
[IMP] product_replenishment_cost: improve the update of last_date_pri…
Browse files Browse the repository at this point in the history
…ce_updated

closes #505

Signed-off-by: Bruno Zanotti <bz@adhoc.com.ar>
  • Loading branch information
augusto-weiss authored and bruno-zanotti committed Apr 11, 2023
1 parent ef0f3f8 commit 32cb633
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion product_replenishment_cost/__manifest__.py
@@ -1,6 +1,6 @@
{
'name': 'Replenishment Cost',
'version': "15.0.1.2.0",
'version': "15.0.1.3.0",
'author': "ADHOC SA, Odoo Community Association (OCA)",
'license': 'AGPL-3',
'category': 'Products',
Expand Down
10 changes: 6 additions & 4 deletions product_replenishment_cost/models/product_supplierinfo.py
Expand Up @@ -9,6 +9,8 @@ class ProductSupplierinfo(models.Model):
_inherit = 'product.supplierinfo'

last_date_price_updated = fields.Datetime(string="Last date price updated",
compute='_compute_last_date_price_updated',
store=True,
default=lambda self: fields.Datetime.now())

replenishment_cost_rule_id = fields.Many2one(
Expand All @@ -25,10 +27,10 @@ class ProductSupplierinfo(models.Model):
help="Net Price",
)

def write(self, vals):
if vals.get('price') and not vals.get('last_date_price_updated'):
vals.update(last_date_price_updated=fields.Datetime.now())
return super(ProductSupplierinfo, self).write(vals)
@api.depends('price', 'min_qty')
def _compute_last_date_price_updated(self):
for rec in self:
rec.last_date_price_updated = fields.Datetime.now()

def _inverse_net_price(self):
""" For now we only implement when product_tmpl_id is set
Expand Down

0 comments on commit 32cb633

Please sign in to comment.