70 lines
3.6 KiB
XML
70 lines
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Add auto-generate lots button to subcontracting receipt forms -->
|
|
<record id="view_picking_form_inherit_subcontract_lots" model="ir.ui.view">
|
|
<field name="name">stock.picking.form.inherit.subcontract.lots</field>
|
|
<field name="model">stock.picking</field>
|
|
<field name="inherit_id" ref="stock.view_picking_form"/>
|
|
<field name="arch" type="xml">
|
|
<!-- Add invisible fields for computed values -->
|
|
<xpath expr="//form" position="inside">
|
|
<field name="has_subcontract_moves" invisible="1"/>
|
|
</xpath>
|
|
<!-- Add the auto-generate button in the header for subcontract receipts -->
|
|
<xpath expr="//header" position="inside">
|
|
<button name="action_auto_generate_lots_subcontract"
|
|
type="object"
|
|
string="Auto Generate Lots"
|
|
class="btn-secondary"
|
|
icon="fa-plus"
|
|
invisible="picking_type_code != 'incoming' or not has_subcontract_moves"
|
|
help="Automatically generate lot/serial numbers for subcontracted products"/>
|
|
<button name="action_open_subcontract_lot_wizard"
|
|
type="object"
|
|
string="Advanced Lot Generation"
|
|
class="btn-secondary"
|
|
icon="fa-cogs"
|
|
invisible="picking_type_code != 'incoming' or not has_subcontract_moves"
|
|
help="Advanced lot generation with custom options"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Enhance the move lines view to show auto-generate option -->
|
|
<record id="view_stock_move_line_detailed_operation_inherit" model="ir.ui.view">
|
|
<field name="name">stock.move.line.detailed.operation.inherit.subcontract</field>
|
|
<field name="model">stock.move.line</field>
|
|
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
|
|
<field name="arch" type="xml">
|
|
<!-- Add a button in the move line tree for individual lot generation -->
|
|
<xpath expr="//field[@name='lot_name']" position="after">
|
|
<button name="action_open_lot_generator"
|
|
type="object"
|
|
icon="fa-plus"
|
|
class="btn-link"
|
|
context="{'default_product_id': product_id, 'default_move_id': move_id}"
|
|
invisible="not product_id"
|
|
help="Generate lot/serial numbers"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Add a smart button to show generated lots for subcontract moves -->
|
|
<record id="view_picking_form_subcontract_lots_smart_button" model="ir.ui.view">
|
|
<field name="name">stock.picking.form.subcontract.lots.smart.button</field>
|
|
<field name="model">stock.picking</field>
|
|
<field name="inherit_id" ref="stock.view_picking_form"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//div[@name='button_box']" position="inside">
|
|
<button type="object"
|
|
name="action_view_generated_lots"
|
|
class="oe_stat_button"
|
|
icon="fa-barcode"
|
|
invisible="picking_type_code != 'incoming' or not has_subcontract_moves">
|
|
<field name="subcontract_lot_count" widget="statinfo" string="Generated Lots"/>
|
|
</button>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
</odoo>
|