I needed to add some fields (15 in total) to sale.order.form's order lines. I inherited the original form and added the additional fields, but after I did it, the Product, Description and Taxes (product_id, name and tax_id) fields dissappeared.
When creating a new Quotation/SO, the mentioned fields aren't visible, but the Add a product/section/note buttons can still be used.
If I add a product, by using the arrow keys after clicking Add a product, and then save the quotation, when I edit the quotation the three missing fields appear magically.
The same happenned when I tried to add the fields with Odoo Studio, so I thought that trying to code it myself would avoid the problem.
Why does this happen? How can I make the fields visible again when creating Quotations/SO, not only when editing them?
Edit: Here´s my code:
This is the XML where I added the fields:
<odoo>
<data>
<record model="ir.ui.view" id="sale_order_view_inherit">
<field name="name">sale.order.view.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="after">
<field name="list_price"/>
<field name="vendor_discount" widget="percentage"/>
<field name="vendor_discounted" widget="monetary"/>
<field name="fob_total" widget="monetary"/>
<field name="tariff" widget="percentage"/>
<field name="tariff_cost" widget="monetary"/>
<field name="total_tariff_cost" widget="monetary"/>
<field name="cost" widget="monetary"/>
<field name="admin_cost" widget="monetary"/>
<field name="final_cost" widget="monetary"/>
<field name="total_final_cost" widget="monetary"/>
<field name="margin" widget="percentage"/>
<field name="profit_margin" widget="monetary"/>
<field name="profit" widget="monetary"/>
<field name="sell_price" widget="monetary"/>
</xpath>
</field>
</record>
The model code:
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
list_price = fields.Float('List Price', compute='_compute_list_price', readonly=True, store=True)
vendor_discount = fields.Float('Vendor Discount', store=True)
# ...# More field declarations of the same kind
# ...
@api.depends('product_id')
def _compute_list_price(self):
for line in self:
line.list_price = line.product_id.standard_price
# ...
# More compute functions
# ...
As imran told, please add the code along with the question for better understanding
Okay, I just added the XML and a fragment of the model.