openerp - How to update one2many in customers from accounting invoice -
i have created one2many customer form. so, when validating (button validate) invoice trying pass values in one2many. have tried many ways , followed odoo forums, having trouble that. using following code: one2many field 'customer_status' in 'res.partner' :
@api.multi @api.model def invoice_validate(self): customer_obj=self.env['res.partner'] customer_id=customer_obj.search([('id','=',self.partner_id.id)]) customer_line=customer_obj.browse(customer_id) dd = {'policy_number': self.policy_no,} customer_stat_add = customer_obj.write([customer_line.id],{ 'customer_status': [(0, 0, dd)] }) state_change = self.write({'state': 'open'}) return state_change, customer_stat_add
it gives me error:
valueerror: "invoice_validate() takes 2 arguments (1 given)" while evaluating u'invoice_validate()'
thanks.
buttons w/ new api need @api.multi
, if want work on single object can use self.ensure_one()
;
@api.multi def foo(self): self.ensure_one() print self.my_field
also, don't need browse object browse objects w/ new api.
bear in mind if feature odoo base feature must call super().method_name not break ;)
Comments
Post a Comment