Hii,
From a custom module I am passing the following default values to account.invoice when clicking create button.
Custom Field Id
Vendor
Journal
Following is the code how I passing default values in the context and it set default values successfully to account.invoice.
@api.multi
def show_insurance_invoices(self):
return {
'name': _('Insurance Bills'),
'domain': [('shipment_id', '=', self.id), ('journal_id', '=', self.insurance_journal_id.id)],
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'type': 'ir.actions.act_window',
'context': {
'default_shipment_id': self.id,
'default_journal_id': self.insurance_journal_id.id,
'default_partner_id': self.insurance_partner_id.id
},
}
Is there a way to pass default product id or some other values in the above context and line auto created and values assigned on account.invoice.line model?
Look how to use context: http://learnopenerp.blogspot.com/2018/01/get-parent-form-value-in-one2many-form.html