[14.0][IMP] mrp_subcontracting_inhibit: add posibility to skip subcontract flow on manual purchase order created

This commit is contained in:
Christopher Ormaza
2022-10-06 11:39:27 -05:00
parent 4c4748f907
commit 62c3e79990
4 changed files with 26 additions and 0 deletions

View File

@@ -12,6 +12,7 @@
"data": [ "data": [
"views/product_supplierinfo_view.xml", "views/product_supplierinfo_view.xml",
"views/stock_location_route_view.xml", "views/stock_location_route_view.xml",
"views/purchase_order_view.xml",
], ],
"maintainers": ["victoralmau"], "maintainers": ["victoralmau"],
} }

View File

@@ -27,6 +27,10 @@ class PurchaseOrderLine(models.Model):
res.update({"subcontracting_inhibit": subcontracting_inhibit_value}) res.update({"subcontracting_inhibit": subcontracting_inhibit_value})
return res return res
@api.onchange("subcontracting_inhibit")
def _onchange_subcontracting_inhibit(self):
return self._onchange_quantity()
def _onchange_quantity(self): def _onchange_quantity(self):
"""We need to inject the context to set the right price""" """We need to inject the context to set the right price"""
_self = self.with_context(subcontracting_inhibit=self.subcontracting_inhibit) _self = self.with_context(subcontracting_inhibit=self.subcontracting_inhibit)

View File

@@ -2,3 +2,5 @@
* Víctor Martínez * Víctor Martínez
* Pedro M. Baeza * Pedro M. Baeza
* Christopher Ormaza <chris.ormaza@forgeflow.com>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_order_form_inherit_purchase_order" model="ir.ui.view">
<field name="name">purchase.order.view.form.inherit</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='order_line']/tree/field[@name='product_id']"
position="after"
>
<field name="subcontracting_inhibit" optional="show" />
</xpath>
</field>
</record>
</odoo>