44 lines
2.2 KiB
XML
44 lines
2.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Inherit the stock move form view to add purchase order linking field -->
|
|
<record id="view_stock_move_form_inherit_subcontracting_inventory_move_first" model="ir.ui.view">
|
|
<field name="name">stock.move.form.inherit.subcontracting.inventory.move.first</field>
|
|
<field name="model">stock.move</field>
|
|
<field name="inherit_id" ref="stock.view_move_form"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//group[@name='origin_grp']" position="after">
|
|
<group name="subcontracting_purchase_link" string="Subcontracting Purchase Link"
|
|
invisible="not is_subcontract">
|
|
<field name="purchase_order_id"
|
|
invisible="not is_subcontract"
|
|
domain="[('state', 'in', ['draft', 'sent', 'to approve'])]"/>
|
|
<field name="linked_purchase_order_count" invisible="1"/>
|
|
</group>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Inherit the stock move tree view to show purchase order column -->
|
|
<record id="view_stock_move_tree_inherit_subcontracting_inventory_move_first" model="ir.ui.view">
|
|
<field name="name">stock.move.tree.inherit.subcontracting.inventory.move.first</field>
|
|
<field name="model">stock.move</field>
|
|
<field name="inherit_id" ref="stock.view_move_tree"/>
|
|
<field name="arch" type="xml">
|
|
<field name="product_uom_qty" position="after">
|
|
<field name="purchase_order_id"
|
|
invisible="not is_subcontract"
|
|
groups="purchase.group_purchase_user"/>
|
|
</field>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Add action to link moves to purchase orders -->
|
|
<record id="action_view_linked_purchase_order" model="ir.actions.server">
|
|
<field name="name">View Linked Purchase Order</field>
|
|
<field name="model_id" ref="stock.model_stock_move"/>
|
|
<field name="binding_model_id" ref="stock.model_stock_move"/>
|
|
<field name="state">code</field>
|
|
<field name="code">action = record.action_view_linked_purchase_order()</field>
|
|
</record>
|
|
</odoo>
|