I'm write code for python to inherit res.partner.
This code is when user click save button to update record, it will set state into draft (state = 'draft') if state = approved.
Any idea or clue to write this code?
class res_partner(models.Model):
_inherit = 'res.partner'
print "write procedure inherit awal"
STATE_SELECTION = [
('draft', 'Draft'),
('approved', 'Approved'),
]
state = fields.Selection(STATE_SELECTION, 'Status', readonly=True,
help="Draft Record "
"Approved Record. ",
select=True,default='draft')
def write(self, vals):
if vals.get('state'):
if vals.get('state')=='approved':
state = 'draft'
return super(res_partner, self).write(vals)
it doesn't work.
Thanks.
Did you get it?
Yup. Thanks Akhil P Sivan