Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3981 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
4
เม.ย. 20
9084
3
ต.ค. 19
7839
2
ก.พ. 18
14014
0
ม.ค. 18
8718
App is not appearing in the list แก้ไขแล้ว
3
มิ.ย. 24
4227