Version: Odoo 12 CE
I use Janeesh method to inherit the sale.order.line.
The modified code:
class Materials(models.Model):
_inherit = 'yachtservice.checkin'
material_line_ids = fields.One2many('sale.order.line', 'yachtservice_checkin_id', 'Order Lines')
class MaterialLine(models.Model):
_inherit = 'sale.order.line'
yachtservice_checkin_id = fields.Many2one('yachtservice.checkin', 'Materials')
So far so good. In doing so I receive inside my yachtservice.checkin model exactly the line I was hoping for.
{Image}
1. flaw I discovered, the unit price is not displayed.
2. when I try to safe I get the following error message:
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set
[object with reference: order_id - order.id]
Somehow I cannot find a cause for this error.
I Noticed that order_id is a field within the sale.order.line model