Skip to Content

Welcome!

human made "AI" (advises & inputs) forum by Odoo professionals, experts and enthusiasts challenging real use cases with standard solutions!

-> solutions should be applicable for Odoo community or online (at the limit with Studio), all without custom modules.

This question has been flagged

solution to set warranty for products tracked by unique serial number

Avatar
Discard
Author

using studio:

  • add a date type field "warranty date" to lot
  • add an integer type field "warranty months" to products
  • add an related field "warranty months" to variants

    • the warranty is set on product tamplate, but the field is needed on variants (kann be hidden) for the moves

move_lines = record.move_line_ids
for line in move_lines:
if line.lot_id:
months = line.product_id.x_studio_warranty_months or 0
if months > 0:
today = datetime.date.today()
warranty_date = today + dateutil.relativedelta.relativedelta(months=months)
line.lot_id.write({'x_studio_warranty_date': warranty_date})
Avatar
Discard
Related Posts Replies Views Activity
1
Apr 26
145
1
Sep 25
221
1
Aug 25
150
1
Aug 25
137
1
Sep 25
156