fix the bugs

This commit is contained in:
Suherdy Yacob 2025-10-04 11:52:00 +07:00
parent 97ae58fb55
commit 3697d7f785
2 changed files with 19 additions and 18 deletions

View File

@ -55,22 +55,4 @@
parent="purchase.menu_purchase_root" parent="purchase.menu_purchase_root"
sequence="15"/> 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> </odoo>

View File

@ -1,5 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <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 --> <!-- Custom list view for linking subcontracting moves to purchase orders -->
<record id="view_stock_move_link_subcontracting_tree" model="ir.ui.view"> <record id="view_stock_move_link_subcontracting_tree" model="ir.ui.view">
<field name="name">stock.move.link.subcontracting.tree</field> <field name="name">stock.move.link.subcontracting.tree</field>