58 lines
2.8 KiB
XML
58 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Inherit the purchase order form view to add smart button and subcontracting moves section -->
|
|
<record id="view_purchase_order_form_inherit_subcontracting_inventory_move_first" model="ir.ui.view">
|
|
<field name="name">purchase.order.form.inherit.subcontracting.inventory.move.first</field>
|
|
<field name="model">purchase.order</field>
|
|
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//div[@name='button_box']" position="inside">
|
|
<!-- Smart button to view linked subcontracting moves -->
|
|
<button name="action_view_subcontracting_moves"
|
|
type="object"
|
|
class="oe_stat_button"
|
|
icon="fa-truck"
|
|
invisible="subcontracting_move_count == 0">
|
|
<field name="subcontracting_move_count" widget="statinfo" string="Subcontracting Moves"/>
|
|
</button>
|
|
|
|
<!-- Button to link existing subcontracting moves -->
|
|
<button name="action_link_subcontracting_moves"
|
|
type="object"
|
|
class="oe_stat_button"
|
|
icon="fa-link"
|
|
invisible="state not in ['draft', 'sent', 'to approve']">
|
|
<div>Link Subcontracting Moves</div>
|
|
</button>
|
|
</xpath>
|
|
|
|
<!-- Add subcontracting moves section in the form body -->
|
|
<xpath expr="//notebook" position="inside">
|
|
<page string="Subcontracting Moves"
|
|
invisible="subcontracting_move_count == 0">
|
|
<field name="subcontracting_move_ids"
|
|
nolabel="1"
|
|
readonly="1"/>
|
|
</page>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Add menu item for viewing subcontracting inventory moves -->
|
|
<record id="action_subcontracting_moves_tree" model="ir.actions.act_window">
|
|
<field name="name">Subcontracting Inventory Moves</field>
|
|
<field name="type">ir.actions.act_window</field>
|
|
<field name="res_model">stock.move</field>
|
|
<field name="view_mode">list,form</field>
|
|
<field name="domain">[('location_dest_id.name', '=', 'Subcontracting Location')]</field>
|
|
<field name="context">{'search_default_location_dest_id_name': 'Subcontracting Location'}</field>
|
|
</record>
|
|
|
|
<!-- Add menu item to the Purchase menu -->
|
|
<menuitem id="menu_subcontracting_moves"
|
|
name="Subcontracting Moves"
|
|
action="action_subcontracting_moves_tree"
|
|
parent="purchase.menu_purchase_root"
|
|
sequence="15"/>
|
|
|
|
</odoo> |