I have some strange behavior when I inherit the sales order form view into my model/view.
I inherited the view into my model without changing the original view.
---
<record id="work_order_form" model="ir.ui.view">
<field name="name">Extend the Sale Order</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="payment_term_id" position="after">
<field name='my_field'/>
</field>
</field>
</record>
---
Therefore I used the primary field (see my code) and I get what I want. Well...
My new view shows the extended field (my_field) and the sales order form view does not, as it should.
Within the sales module so, if I open a quotation, I can see that the quotation form also have the additional field (my_field). But if I am correct both (sales order & quotations use the same view i.e. sale.order.form)
For some reason quotations now also use the extended view.
Some of the code for completeness:
---
To open the view I added:
<!-- Action to open the Workorder list -->
<act_window id="action_yacht_service" name="Workorders"
res_model="sale.order" view_mode="tree,form"/>
<!-- Menu item to open the Workorder list -->
<menuitem id="menu_yacht_service" name="Workorder"
parent="menu_yachtservice" action="action_yacht_service" sequence="2"/>
---
code to inherit the model:
from odoo import fields, models
class YachtService(models.Model):
_name = 'yacht.service'
_description = 'Workorder Data'
name = fields.Char(string="Name")
description = fields.Text(string="Description")
cost = fields.Float(string="Cost")
class WorkorderInheritSale(models.Model):
_inherit = 'sale.order'
my_field = fields.Boolean(string="Is Workorder")
my_field_2 = fields.Boolean(string="Is Platzhalter 2")
Really confusing, pls help.