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?