Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
4014 Ansichten

i want to use removal_date in tree view 

class StockProductionLot(models.Model):
_inherit = 'stock.production.lot'
removal_date = fields.Date()


Type of related field stock.quant.removal_date is inconsistent with stock.production.lot.removal_date


Avatar
Verwerfen
Beste Antwort

Hello 

Actually the datatype of the field "removal_date" in stock.production.lot is datetime, and this field is referred as related fields in the stock.quant object.

ex :


class StockProductionLot(models.Model):
_inherit = 'stock.production.lot'

removal_date = fields.Datetime(string='Removal Date',
help='This is the date on which the goods with this Serial Number should be removed from the stock.')

class StockQuant(models.Model):
    _inherit = 'stock.quant'

    removal_date = fields.Datetime(related='lot_id.removal_date', store=True)


here the issue is you are changing the datatype from datetime to date in stock.production.lot, but not in stock.quant thats the issue,

if you include this change your code will work

class StockQuant(models.Model): 
    _inherit = 'stock.quant' 

    removal_date = fields.Date(related='lot_id.removal_date', store=True)

Thanks

Avatar
Verwerfen
Autor

thank you i am grateful

Verknüpfte Beiträge Antworten Ansichten Aktivität
4
Apr. 20
9102
3
Okt. 19
7854
2
Feb. 18
14042
0
Jan. 18
8742
3
Juni 24
4257