fix the bugs
This commit is contained in:
parent
97ae58fb55
commit
3697d7f785
@ -55,22 +55,4 @@
|
||||
parent="purchase.menu_purchase_root"
|
||||
sequence="15"/>
|
||||
|
||||
<!-- Server action to link selected subcontracting move to purchase order -->
|
||||
<record id="action_link_subcontracting_move_to_po" model="ir.actions.server">
|
||||
<field name="name">Link to 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">
|
||||
if records:
|
||||
# Get the active purchase order from context
|
||||
po_id = env.context.get('default_purchase_order_id') or env.context.get('active_id')
|
||||
if po_id:
|
||||
po = env['purchase.order'].browse(po_id)
|
||||
for record in records:
|
||||
po.link_selected_subcontracting_move(record.id)
|
||||
# Close the wizard window
|
||||
action = {'type': 'ir.actions.act_window_close'}
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@ -1,5 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Server action to link selected subcontracting move to purchase order -->
|
||||
<record id="action_link_subcontracting_move_to_po" model="ir.actions.server">
|
||||
<field name="name">Link to 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">
|
||||
if records:
|
||||
# Get the active purchase order from context
|
||||
po_id = env.context.get('default_purchase_order_id') or env.context.get('active_id')
|
||||
if po_id:
|
||||
po = env['purchase.order'].browse(po_id)
|
||||
for record in records:
|
||||
po.link_selected_subcontracting_move(record.id)
|
||||
# Close the wizard window
|
||||
action = {'type': 'ir.actions.act_window_close'}
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Custom list view for linking subcontracting moves to purchase orders -->
|
||||
<record id="view_stock_move_link_subcontracting_tree" model="ir.ui.view">
|
||||
<field name="name">stock.move.link.subcontracting.tree</field>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user