コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
3993 ビュー

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


アバター
破棄
最善の回答

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

アバター
破棄
著作者

thank you i am grateful

関連投稿 返信 ビュー 活動
4
4月 20
9091
3
10月 19
7848
2
2月 18
14025
0
1月 18
8725
3
6月 24
4233