Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3707 Lượt xem

I have 3 fields, force_date and min_date inherited from stock.picking and date_invoice from account.invoice. I want that if I update the force_date, it will execute to the date_invoice also, which in result the date_invoice will equals to force_date.



Class Picking (models.Model):

_inherit = 'stock.picking'

force_date = fields.DateTime ()
min_date = fields.Datetime ('Please Change it')


@ api.multi
def write (self, vals):
#vals ['min_date'] = self.force_date
# print ("Min_Date" + vals ['min_date'])

vals ['min_date'] = vals ['force_date']
print ("Min_date Vals" + vals ['min_date'])
print ("ForceDate Vals" + vals ['force_date'])
print ("ForceDate" + self.force_date)
print (" Test the Edit Button ")
record = super (Picking, self) .write (vals)
print (record)
return record


​class AccountInvoice(models.Model):
_name = 'stock.picking'
_inherit = 'account.invoice'

force_date = fields.Datetime("Your Force Date")
date_invoice = fields.Date("This is invoice",related="force_date")



I tried to use this but I got "KeyError: 'backorder_id'"


What should I do?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

date_invoice = fields.Date("This is invoice",related="force_date")

Please pass many2one field link of stock.picking in above field date will change.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 6 21
17924
3
thg 12 22
4588
4
thg 9 19
4960
0
thg 3 15
4378
1
thg 8 23
3970