Files
odoo_source/addons/purchase_requisition/views/product_views.xml
T
Rémy Voet (ryv) bec794f776 [REF] stock,purchase(_*),mrp: clean related fields
Related fields are by default readonly and they should be when it
is possible. A editable related field will write on the related
model and will cause extra unwanted write of data. These unwanted write
can cause performance issues in some case (see odoo/odoo#63865).

Then remove the `readonly=False` of some related fields
(where it is useless):

- In 'mrp.workorder' (mrp): `working_state` and `production_date`
should be readonly.
- In 'purchase.order' (purchase): `product_id` should be readonly.
- In 'purchase.order.line' (purchase): `state` should be readonly.
- In 'product.supplierinfo' (purchase_requisition):
`purchase_requisition_id` should be readonly.
- In 'purchase.requisition' (purchase_requisition):
`product_id` should be readonly.
- In 'product.template' (stock):
`route_from_categ_ids` should be readonly.
- In 'stock.move.line' (stock):
`is_initial_demand_editable` should be readonly.
- In 'stock.move' (stock):
`product_tmpl_id` should be readonly.
- In 'stock.production.lot' (stock):
`product_uom_id` should be readonly.
- In 'stock.quant' (stock):
`product_tmpl_id` should be readonly.
- In 'stock.rule' (stock):
`route_sequence` should be readonly.
- In 'stock.change.product.qty' (stock):
`product_variant_count` should be readonly.
- In 'stock.return.picking.line' (stock):
`uom_id` should be readonly and also because it
is forced by `_prepare_stock_return_picking_line_vals_from_move`,
it should be related to the product uom not the one on the move.

task-2424248
2021-01-21 11:09:58 +00:00

51 lines
2.2 KiB
XML

<?xml version="1.0"?>
<odoo>
<record id="product_supplierinfo_tree_view_inherit" model="ir.ui.view">
<field name="name">product.template.product.form.inherit</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name="purchase_requisition_id" optional="hide"/>
</xpath>
</field>
</record>
<record id="supplier_info_form_inherit" model="ir.ui.view">
<field name="name">product.supplierinfo.requisition.view</field>
<field name="model">product.supplierinfo</field>
<field name="priority">20</field>
<field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
<field name="arch" type="xml">
<field name="product_code" position="after">
<field name="purchase_requisition_id"
attrs="{'invisible': [('purchase_requisition_id', '=', False)]}"/>
</field>
</field>
</record>
<record id="product_template_form_view_inherit" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="purchase.view_product_supplier_inherit"/>
<field name="arch" type="xml">
<group name="bill" position="before">
<group string="Reordering" attrs="{'invisible': [('type', '=', 'service')]}">
<field name="purchase_requisition" widget="radio"/>
</group>
</group>
</field>
</record>
<record id="act_res_partner_2_purchase_order" model="ir.actions.act_window">
<field name="name">Purchase orders</field>
<field name="res_model">purchase.order</field>
<field name="domain">[('requisition_id', '=', active_id)]</field>
<field name="context">{'default_requisition_id': active_id}</field>
<field name="binding_model_id" ref="model_purchase_requisition"/>
<field name="binding_view_types">form</field>
</record>
</odoo>