# -*- Coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError, UserError
class PickingType(models.Model):
_inherit = 'stock.picking.type'
@api.multi
def date_done(self):
temp_pickings = self.env['stock.picking'].search([(partner_id, '=', self.partner_id.id)], order='date_done desc', limit=1)
for picking in temp_pickings:
picking.partner_id.last_delivery_date = picking.date_done
super(PickingType, self).date_done(self)
Above Code is write but not working.
is the function getting executed ? if so try writing into database using the write
picking.partner_id.write({'last_delivery_date': picking.date_done})
Sent: Thursday, May 23, 2019 8:42 PM
To: Sueb
Subject: Re: How to write the date_done of picking in res_partner as last_delivery_date?
is the function getting executed ? if so try writing into database using the write
picking.partner_id.write({'last_delivery_date': picking.date_done})
Sent by Odoo S.A. using Odoo.