This question has been flagged
1 Reply
2163 Views

hello

I am creating my first module that add simple expiry date on Purchase order and in Inventory adjustment

  I have (product.py)

from odoo import fields, models,tools,api


class product_template(models.Model):
_inherit = 'product.template'

pro_exp_date = fields.Datetime(string="Expiry Date")
description = fields.Char(string="Description", index=True)


class stock_inventory_line(models.Model):

_inherit = 'stock.inventory.line'
pro_exp_date_inventory = fields.Many2one("product.template")
pro_exp_date2 = fields.Datetime(string="Expiry Date", related="pro_exp_date_inventory.pro_exp_date")


class purchase_order_line(models.Model):
_inherit = 'purchase.order.line'
pro_exp_date_purchase = fields.Many2one("product.template")
pro_exp_date3 = fields.Datetime(string="Expiry Date", related="pro_exp_date_purchase.pro_exp_date")


and its now working , am sorry if its too simple but can any one help me with this ?

Avatar
Discard
Best Answer

just give store = True attribute. That will be stored in DB, so you can retrieve easily.

Avatar
Discard