[MIG] stock_secondary_unit: Migration to 13.0

This commit is contained in:
ps-tubtim
2019-12-18 17:13:00 +07:00
committed by Rocío Vega
parent c6226ce391
commit 5939375391
13 changed files with 160 additions and 110 deletions

View File

@@ -7,20 +7,20 @@ Stock Secondary Unit
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_secondary_unit
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_secondary_unit
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_secondary_unit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/12.0
:target: https://runbot.odoo-community.org/runbot/153/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -51,7 +51,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -69,6 +69,7 @@ Contributors
* Carlos Dauden <carlos.dauden@tecnativa.com>
* Sergio Teruel <sergio.teruel@tecnativa.com>
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
Maintainers
~~~~~~~~~~~
@@ -83,6 +84,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_secondary_unit>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,8 +3,8 @@
{
"name": "Stock Secondary Unit",
"summary": "Get product quantities in a secondary unit",
"version": "13.0.1.0.2",
"development_status": "Beta",
"version": "13.0.1.0.0",
"development_status": "Production/Stable",
"category": "stock",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Tecnativa, Odoo Community Association (OCA)",

View File

@@ -97,7 +97,6 @@ msgstr ""
#. module: stock_secondary_unit
#: model:ir.model,name:stock_secondary_unit.model_stock_product_secondary_unit
#, fuzzy
#| msgid "Secondary unit"
msgid "Stock Product Secondary Unit"
msgstr "Unidad Secundaria"

View File

@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_secondary_unit
# * stock_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -97,4 +97,3 @@ msgstr ""
#: model:ir.model,name:stock_secondary_unit.model_stock_secondary_unit_mixin
msgid "Stock Secondary Unit Mixin"
msgstr ""

View File

@@ -3,8 +3,6 @@
from odoo import fields, models
from odoo.tools.float_utils import float_round
from odoo.addons import decimal_precision as dp
class StockProductSecondaryUnit(models.AbstractModel):
_name = "stock.product.secondary.unit"
@@ -13,15 +11,20 @@ class StockProductSecondaryUnit(models.AbstractModel):
secondary_unit_qty_available = fields.Float(
string="Quantity On Hand (2Unit)",
compute="_compute_secondary_unit_qty_available",
digits=dp.get_precision("Product Unit of Measure"),
digits="Product Unit of Measure",
)
def _compute_secondary_unit_qty_available(self):
for product in self.filtered("stock_secondary_uom_id"):
qty = product.qty_available / (product.stock_secondary_uom_id.factor or 1.0)
product.secondary_unit_qty_available = float_round(
qty, precision_rounding=product.uom_id.rounding
)
for product in self:
if not product.stock_secondary_uom_id:
product.secondary_unit_qty_available = 0.0
else:
qty = product.qty_available / (
product.stock_secondary_uom_id.factor or 1.0
)
product.secondary_unit_qty_available = float_round(
qty, precision_rounding=product.uom_id.rounding
)
class ProductTemplate(models.Model):

View File

@@ -3,8 +3,6 @@
from odoo import api, fields, models
from odoo.tools.float_utils import float_round
from odoo.addons import decimal_precision as dp
class StockSecondaryUnitMixin(models.AbstractModel):
_name = "stock.secondary.unit.mixin"
@@ -14,7 +12,7 @@ class StockSecondaryUnitMixin(models.AbstractModel):
comodel_name="product.secondary.unit", string="Second unit"
)
secondary_uom_qty = fields.Float(
string="Secondary Qty", digits=dp.get_precision("Product Unit of Measure")
string="Secondary Qty", digits="Product Unit of Measure"
)
@@ -23,7 +21,7 @@ class StockMove(models.Model):
_name = "stock.move"
def _merge_moves_fields(self):
res = super(StockMove, self)._merge_moves_fields()
res = super()._merge_moves_fields()
res["secondary_uom_qty"] = self[-1:].secondary_uom_qty
return res

View File

@@ -1,3 +1,4 @@
* Carlos Dauden <carlos.dauden@tecnativa.com>
* Sergio Teruel <sergio.teruel@tecnativa.com>
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>

36
stock_secondary_unit/report/report_deliveryslip.xml Executable file → Normal file
View File

@@ -1,27 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="report_delivery_document" inherit_id="stock.report_delivery_document" priority="8">
<xpath expr='//table[@t-if="o.state!=&apos;done&apos;"]/thead/tr/th' position="after">
<th><strong>Secondary Qty</strong></th>
<template
id="report_delivery_document"
inherit_id="stock.report_delivery_document"
priority="8"
>
<xpath
expr='//table[@t-if="o.state!=&apos;done&apos;"]/thead/tr/th'
position="after"
>
<th>
<strong>Secondary Qty</strong>
</th>
</xpath>
<xpath expr="//span[@t-field='move.product_id']/.." position="after">
<td>
<span t-field="move.secondary_uom_qty"/>
<span t-field="move.secondary_uom_id.name"/>
<span t-field="move.secondary_uom_qty" />
<span t-field="move.secondary_uom_id.name" />
</td>
</xpath>
<xpath expr='//table[@t-if="o.move_line_ids and o.state==&apos;done&apos;"]/thead/tr/th' position="after">
<th><strong>Secondary Qty</strong></th>
<xpath
expr='//table[@t-if="o.move_line_ids and o.state==&apos;done&apos;"]/thead/tr/th'
position="after"
>
<th>
<strong>Secondary Qty</strong>
</th>
</xpath>
<xpath expr="//span[@t-field='move_line.product_id']/.." position="after">
<td>
<span t-field="move_line.secondary_uom_qty"/>
<span t-field="move_line.secondary_uom_id"/>
<span t-field="move_line.secondary_uom_qty" />
<span t-field="move_line.secondary_uom_id" />
</td>
</xpath>
</template>
</odoo>

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_secondary_unit"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_secondary_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_secondary_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of stock module to allow define
other units with their conversion factor.</p>
<p><strong>Table of contents</strong></p>
@@ -400,7 +400,7 @@ other units with their conversion factor.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -417,6 +417,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Carlos Dauden &lt;<a class="reference external" href="mailto:carlos.dauden&#64;tecnativa.com">carlos.dauden&#64;tecnativa.com</a>&gt;</li>
<li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt;</li>
<li>Kitti Upariphutthiphong &lt;<a class="reference external" href="mailto:kittiu&#64;ecosoft.co.th">kittiu&#64;ecosoft.co.th</a>&gt;</li>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
@@ -426,7 +427,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_secondary_unit">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -68,12 +68,7 @@ class TestProductSecondaryUnit(SavepointCase):
secondary_unit = cls.env["product.secondary.unit"].search(
[("product_tmpl_id", "=", cls.product_template.id)], limit=1
)
cls.product_template.write(
{
"sale_secondary_uom_id": secondary_unit.id,
"stock_secondary_uom_id": secondary_unit.id,
}
)
cls.product_template.write({"stock_secondary_uom_id": secondary_unit.id})
StockQuant = cls.env["stock.quant"]
cls.quant_white = StockQuant.create(
{
@@ -95,7 +90,7 @@ class TestProductSecondaryUnit(SavepointCase):
def test_02_stock_secondary_unit_variant(self):
for variant in self.product_template.product_variant_ids.filtered(
"attribute_value_ids"
"product_template_attribute_value_ids"
):
self.assertEqual(variant.secondary_unit_qty_available, 20)

99
stock_secondary_unit/views/product_views.xml Executable file → Normal file
View File

@@ -1,86 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_template_property_form" model="ir.ui.view">
<field name="name">Product template Secondary Unit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.view_template_property_form"/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]"/>
<field name="inherit_id" ref="stock.view_template_property_form" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<xpath expr="//group[@name='inventory']" position="inside">
<group string="Secondary unit">
<field name="stock_secondary_uom_id"
domain="[('product_tmpl_id', '=', id)]"
options="{'no_create': True}"/>
<field
name="stock_secondary_uom_id"
domain="[('product_tmpl_id', '=', id)]"
options="{'no_create': True}"
/>
</group>
</xpath>
</field>
</record>
<record id="product_template_form_view_procurement_button" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id"
ref="stock.product_template_form_view_procurement_button"/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]"/>
<field
name="inherit_id"
ref="stock.product_template_form_view_procurement_button"
/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<xpath expr="//button[@name='action_open_quants']" position="after">
<button type="object"
<button
type="object"
name="action_open_quants"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-building-o">
class="oe_stat_button"
icon="fa-building-o"
>
<div class="o_form_field o_stat_info">
<span class="o_stat_value"><field name="secondary_unit_qty_available" widget="statinfo" nolabel="1"/></span>
<span class="o_stat_text"><field name="stock_secondary_uom_id"/></span>
<span class="o_stat_value">
<field
name="secondary_unit_qty_available"
widget="statinfo"
nolabel="1"
/>
</span>
<span class="o_stat_text">
<field name="stock_secondary_uom_id" />
</span>
</div>
</button>
</xpath>
</field>
</record>
<record id="product_form_view_procurement_button" model="ir.ui.view">
<field name="model">product.product</field>
<field name="inherit_id"
ref="stock.product_form_view_procurement_button"/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]"/>
<field name="inherit_id" ref="stock.product_form_view_procurement_button" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<xpath expr="//field[@name='qty_available']/.." position="after">
<button class="oe_stat_button"
name="%(stock.product_open_quants)d"
icon="fa-building-o"
type="action" attrs="{'invisible':[('type', '!=', 'product')]}">
<xpath expr="//button[@name='action_open_quants']" position="after">
<button
type="object"
name="action_open_quants"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button"
icon="fa-building-o"
>
<div class="o_form_field o_stat_info">
<span class="o_stat_value"><field name="secondary_unit_qty_available" widget="statinfo" nolabel="1"/></span>
<span class="o_stat_text"><field name="stock_secondary_uom_id"/></span>
<span class="o_stat_value">
<field
name="secondary_unit_qty_available"
widget="statinfo"
nolabel="1"
/>
</span>
<span class="o_stat_text">
<field name="stock_secondary_uom_id" />
</span>
</div>
</button>
</xpath>
</field>
</record>
<record id="product_template_tree_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]"/>
<field name="inherit_id" ref="product.product_template_tree_view" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<xpath expr="//field[@name='uom_id']" position="after">
<field name="secondary_unit_qty_available"/>
<field name="stock_secondary_uom_id" options="{'no_open': True, 'no_create': True}"/>
<field name="secondary_unit_qty_available" />
<field
name="stock_secondary_uom_id"
options="{'no_open': True, 'no_create': True}"
/>
</xpath>
</field>
</record>
<record id="product_product_tree_view" model="ir.ui.view">
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view"/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]"/>
<field name="inherit_id" ref="product.product_product_tree_view" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<xpath expr="//field[@name='uom_id']" position="after">
<field name="secondary_unit_qty_available"/>
<field name="stock_secondary_uom_id" options="{'no_open': True, 'no_create': True}"/>
<field name="secondary_unit_qty_available" />
<field
name="stock_secondary_uom_id"
options="{'no_open': True, 'no_create': True}"
/>
</xpath>
</field>
</record>
</odoo>

37
stock_secondary_unit/views/stock_move_views.xml Executable file → Normal file
View File

@@ -1,21 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_stock_move_line_operation_tree" model="ir.ui.view">
<field name="name">Stock Move Secondary Unit</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]"/>
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<field name="product_uom_qty" position="before">
<field name="secondary_uom_qty"/>
<field name="secondary_uom_id"
domain="[('product_tmpl_id.product_variant_ids', 'in', [product_id])]"
options="{'no_create': True}"/>
<field name="secondary_uom_qty" />
<field
name="secondary_uom_id"
domain="[('product_tmpl_id.product_variant_ids', 'in', [product_id])]"
options="{'no_create': True}"
/>
</field>
</field>
</record>
<record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view">
<field name="name">stock.move.line.operations.tree</field>
<field name="model">stock.move.line</field>
<field
name="inherit_id"
ref="stock.view_stock_move_line_detailed_operation_tree"
/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<field name="product_uom_qty" position="before">
<field name="secondary_uom_qty" />
<field
name="secondary_uom_id"
domain="[('product_tmpl_id.product_variant_ids', 'in', [product_id])]"
options="{'no_create': True}"
/>
</field>
</field>
</record>
</odoo>

29
stock_secondary_unit/views/stock_picking_views.xml Executable file → Normal file
View File

@@ -1,27 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_picking_form" model="ir.ui.view">
<field name="name">Stock Picking Secondary Unit</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]"/>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="groups_id" eval="[(4, ref('uom.group_uom'))]" />
<field name="arch" type="xml">
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_uom_qty']" position="before">
<field name="secondary_uom_qty"/>
<field name="secondary_uom_id"
domain="[('product_tmpl_id.product_variant_ids', 'in', [product_id])]"
options="{'no_create': True}"/>
</xpath>
<xpath expr="//field[@name='move_line_ids_without_package']/tree/field[@name='product_uom_qty']" position="before">
<field name="secondary_uom_qty"/>
<field name="secondary_uom_id"
domain="[('product_tmpl_id.product_variant_ids', 'in', [product_id])]"
options="{'no_create': True}"/>
<xpath
expr="//field[@name='move_ids_without_package']/tree/field[@name='product_uom_qty']"
position="before"
>
<field name="secondary_uom_qty" />
<field
name="secondary_uom_id"
domain="[('product_tmpl_id.product_variant_ids', 'in', [product_id])]"
options="{'no_create': True}"
/>
</xpath>
</field>
</record>
</odoo>