Skip to Content
Menu
This question has been flagged
1 Reply
2400 Views

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



Avatar
Discard
Best Answer

Hi,

In the model sale.order.line the field named order_id is required field, as the value for that field is not supplied you are getting the error message.


To solve this you have to supply value for the field, or alter your logic accordingly.


Thanks

Avatar
Discard