Community mailing list archives

community@mail.odoo.com

Having trouble to pass value in an one2many field

by
Md. Tanzilul Hasan Khan
- 02/29/2016 12:33:26
Hello,

I have created an one2many to customer form. So, when I am validating (button validate) an invoice I am trying to pass some values in that one2many. I have tried many ways and followed odoo forums, but I am having trouble to do that. Using following code:

My one2many field is 'customer_status' in 'res.partner' :
@api.multi
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)

customer_stat_add = customer_obj.write(customer_id,
{'customer_status': [(0, 0,
{'policy_start': self.date_invoice,
}
)]
})
state_change = self.write({'state': 'open'})
return state_change, customer_stat_add
Any help will be appreciated.

Best Regards,
--
MD. Tanzilul Hasan Khan.