Skip to content

Commit

Permalink
[16.0][MIG] purchase_order_secondary_unit
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea committed Aug 11, 2023
1 parent 50cb959 commit c3e443d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion purchase_order_secondary_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Purchase Order Secondary Unit",
"summary": "Purchase product in a secondary unit",
"version": "15.0.1.1.0",
"version": "16.0.1.1.0",
"development_status": "Beta",
"category": "Purchase",
"website": "https://github.com/OCA/purchase-workflow",
Expand Down
2 changes: 0 additions & 2 deletions purchase_order_secondary_unit/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class PurchaseOrderLine(models.Model):

@api.depends("secondary_uom_qty", "secondary_uom_id")
def _compute_product_qty(self):
if hasattr(super(), "_compute_product_qty"):
return super()._compute_product_qty()
return self._compute_helper_target_field_qty()

@api.onchange("product_uom")
Expand Down
8 changes: 6 additions & 2 deletions purchase_order_secondary_unit/views/product_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
<field name="name">Product template Secondary Unit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<field name="uom_po_id" position="after">
<field name="purchase_secondary_uom_id" options="{'no_create': True}" />
<t groups="uom.group_uom">
<field
name="purchase_secondary_uom_id"
options="{'no_create': True}"
/>
</t>
</field>
</field>
</record>
Expand Down
23 changes: 12 additions & 11 deletions purchase_order_secondary_unit/views/purchase_order_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@
<field name="name">Purchase Order Secondary Unit</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='order_line']/form//field[@name='product_qty']"
position="before"
>
<t groups="uom.group_uom">
<field
name="secondary_uom_qty"
class="oe_inline oe_no_button"
attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}"
/>
name="secondary_uom_qty"
class="oe_inline oe_no_button"
attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}"
/>
<field
name="secondary_uom_id"
class="oe_inline"
domain="['|', ('product_id', '=', product_id),
name="secondary_uom_id"
class="oe_inline"
domain="['|', ('product_id', '=', product_id),
'&amp;', ('product_tmpl_id.product_variant_ids', 'in', [product_id]),
('product_id', '=', False)]"
options="{'no_create': True}"
attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}"
/>
options="{'no_create': True}"
attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}"
/>
</t>
</xpath>
<xpath
expr="//field[@name='order_line']/tree//field[@name='product_qty']"
Expand Down
6 changes: 6 additions & 0 deletions setup/purchase_order_secondary_unit/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit c3e443d

Please sign in to comment.