class CrmInherit(models.Model):
_inherit = 'crm.lead'
crm_lead_transfer_line_ids = fields.One2many('crm.lead.transfer.line', 'crm_lead_transfer_line_id',
)
def quotation_create(self):
self.ensure_one()
inv_lines = []
sale_order = self.env['sale.order']
for line_items in self.crm_lead_transfer_line_ids:
tmp = {
"product_template_id": line_items.vehicle_name,
"name": line_items.vehicle_name,
"product_uom_qty": 2,
'price_unit': 6,
}
inv_lines.append([0, False, tmp])
order_values = {
'partner_id': self.partner_id.id,
"order_line": inv_lines,
}
self.env['sale.order'].create(order_values)
class CrmInheritLine(models.Model):
_name = 'crm.lead.transfer.line'
vehicle_name = fields.Char(string="Vehicle Name")
vehicle_category = fields.Char(string="Vehicle Category")
crm_lead_transfer_line_id = fields.Many2one('crm.lead')
The operation cannot be completed: Missing required fields on accountable sale order line.
it error show