Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 additions & 20 deletions purchase_order_secondary_unit/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=============================
Purchase Order Secondary Unit
=============================
Expand All @@ -17,7 +13,7 @@ Purchase Order Secondary Unit
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |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%2Fpurchase--workflow-lightgray.png?logo=github
Expand Down Expand Up @@ -54,6 +50,23 @@ For configuration of displaying secondary unit information in purchase
reports and the Purchase Order portal, see the guidelines provided in
product_secondary_unit.

Settings Visibility
-------------------

When installing this module, all internal users are automatically added
to the ``product_secondary_unit.group_purchase_secondary_unit`` security
group. This makes the Purchase-related "Hide Secondary Qty Column" and
"Secondary Unit Price Display" settings visible in **Settings > Units of
Measure**.

If you installed this module before these report presentation settings
were introduced in ``product_secondary_unit``, users may not see these
configuration options. To fix this:

1. Go to **Settings > Users & Companies > Groups**
2. Search for "Purchase Secondary Unit"
3. Add the relevant users to that group

Usage
=====

Expand All @@ -68,13 +81,13 @@ To use this module you need to:

**Vendor Pricelist Integration**

- When adding a vendor to a product's pricelist (via *Purchase tab >
Vendors*), the secondary unit of measure is automatically defaulted
from the product variant's purchase secondary UOM, or from the product
template if not set on the variant.
- When a new vendor pricelist record is created from purchase order
confirmation, the secondary UOM from the purchase order line is
automatically stored in the vendor pricelist entry.
- When adding a vendor to a product's pricelist (via *Purchase tab >
Vendors*), the secondary unit of measure is automatically defaulted
from the product variant's purchase secondary UOM, or from the
product template if not set on the variant.
- When a new vendor pricelist record is created from purchase order
confirmation, the secondary UOM from the purchase order line is
automatically stored in the vendor pricelist entry.

Known issues / Roadmap
======================
Expand Down Expand Up @@ -105,17 +118,17 @@ Authors
Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Sergio Teruel
- Ernesto Tejeda
- Sergio Teruel
- Ernesto Tejeda

- Nikul Chaudhary <nikulchaudhary2112@gmail.com>
- Pimolnat Suntian <pimolnats@ecosoft.co.th>
- Miguel Ángel Gómez <miguel.gomez@braintec.com>
- `Quartile <https://www.quartile.co>`__:
- Nikul Chaudhary <nikulchaudhary2112@gmail.com>
- Pimolnat Suntian <pimolnats@ecosoft.co.th>
- Miguel Ángel Gómez <miguel.gomez@braintec.com>
- `Quartile <https://www.quartile.co>`__:

- Yoshi Tashiro
- Yoshi Tashiro

Maintainers
-----------
Expand Down
1 change: 1 addition & 0 deletions purchase_order_secondary_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"auto_install": True,
"depends": ["purchase", "product_secondary_unit"],
"data": [
"security/purchase_order_secondary_unit_groups.xml",
"views/product_views.xml",
"views/product_supplierinfo_views.xml",
"views/purchase_order_portal_templates.xml",
Expand Down
14 changes: 14 additions & 0 deletions purchase_order_secondary_unit/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
For configuration of displaying secondary unit information in purchase reports and
the Purchase Order portal, see the guidelines provided in product_secondary_unit.

## Settings Visibility

When installing this module, all internal users are automatically added to the
`product_secondary_unit.group_purchase_secondary_unit` security group. This makes
the Purchase-related "Hide Secondary Qty Column" and "Secondary Unit Price Display"
settings visible in **Settings > Units of Measure**.

If you installed this module before these report presentation settings were introduced
in `product_secondary_unit`, users may not see these configuration options. To fix this:

1. Go to **Settings > Users & Companies > Groups**
2. Search for "Purchase Secondary Unit"
3. Add the relevant users to that group
52 changes: 50 additions & 2 deletions purchase_order_secondary_unit/reports/purchase_order_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,64 @@
>
<!-- Header data -->
<th name="th_quantity" position="before">
<th name="th_secondary_unit" class="text-end">
<th
name="th_secondary_unit"
class="text-end"
t-if="not o.company_id.hide_secondary_uom_column(o)"
>
<strong>Second Qty</strong>
</th>
</th>
<!-- Content data -->
<xpath expr="//span[@t-field='line.product_qty']/.." position="before">
<td id="secondary_unit" class="text-end">
<td
id="secondary_unit"
class="text-end"
t-if="not o.company_id.hide_secondary_uom_column(o)"
>
<span t-field="line.secondary_uom_qty" />
<span t-field="line.secondary_uom_id" />
</td>
</xpath>
<!-- Quantity: hide primary when secondary is prioritized -->
<xpath expr="//span[@t-field='line.product_qty']" position="attributes">
<attribute
name="t-if"
>line.get_secondary_uom_display_mode() != 'secondary'</attribute>
</xpath>
<xpath expr="//span[@t-field='line.product_uom.name']" position="attributes">
<attribute
name="t-if"
>line.get_secondary_uom_display_mode() != 'secondary'</attribute>
</xpath>
<!-- Quantity: add secondary qty ('secondary' mode) -->
<xpath expr="//span[@t-field='line.product_uom.name']" position="after">
<t t-if="line.get_secondary_uom_display_mode() == 'secondary'">
<span t-field="line.secondary_uom_qty" />
<span t-field="line.secondary_uom_id.name" />
</t>
</xpath>
<!-- Quantity: add secondary qty ('both' mode) -->
<xpath expr="//span[@t-field='line.product_qty']/.." position="inside">
<t t-if="line.get_secondary_uom_display_mode() == 'both'">
<br />
<span id="secondary_uom_qty" class="text-muted">
(<span t-field="line.secondary_uom_qty" />
<span
t-field="line.secondary_uom_id.name"
groups="uom.group_uom"
/>)
</span>
</t>
</xpath>
<!-- Unit price: hide primary ('secondary' mode) -->
<xpath expr="//span[@t-field='line.price_unit']" position="attributes">
<attribute
name="t-if"
>line.get_secondary_uom_display_mode() != 'secondary'</attribute>
</xpath>
<xpath expr="//span[@t-field='line.price_unit']" position="after">
<t t-call="purchase_order_secondary_unit.purchase_uom_price" />
</xpath>
</template>
</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,57 @@
id="report_purchasequotation_document"
inherit_id="purchase.report_purchasequotation_document"
>
<!-- Header data -->
<!-- Header: Second Qty column (hidden when hide_secondary_uom_column() is True) -->
<th name="th_quantity" position="before">
<th name="secondary_unit" class="text-end">
<th
name="secondary_unit"
class="text-end"
t-if="not o.company_id.hide_secondary_uom_column(o)"
>
<strong>Second Qty</strong>
</th>
</th>
<!-- Content data -->
<!-- Content: Second Qty cell (hidden when hide_secondary_uom_column is True) -->
<xpath expr="//span[@t-field='order_line.product_qty']/.." position="before">
<td id="secondary_unit" class="text-end">
<td
id="secondary_unit"
class="text-end"
t-if="not o.company_id.hide_secondary_uom_column(o)"
>
<span t-field="order_line.secondary_uom_qty" />
<span t-field="order_line.secondary_uom_id" />
</td>
</xpath>
<!-- Quantity: hide primary when secondary is prioritized -->
<xpath expr="//span[@t-field='order_line.product_qty']" position="attributes">
<attribute
name="t-if"
>order_line.get_secondary_uom_display_mode() != 'secondary'</attribute>
</xpath>
<xpath expr="//span[@t-field='order_line.product_uom']" position="attributes">
<attribute
name="t-if"
>order_line.get_secondary_uom_display_mode() != 'secondary'</attribute>
</xpath>
<!-- Quantity: add secondary qty ('secondary' mode) -->
<xpath expr="//span[@t-field='order_line.product_uom']" position="after">
<t t-if="order_line.get_secondary_uom_display_mode() == 'secondary'">
<span t-field="order_line.secondary_uom_qty" />
<span t-field="order_line.secondary_uom_id.name" />
</t>
</xpath>
<!-- Quantity: add secondary qty ('both' mode) -->
<xpath expr="//span[@t-field='order_line.product_qty']/.." position="inside">
<t t-if="order_line.get_secondary_uom_display_mode() == 'both'">
<br />
<span id="secondary_uom_qty" class="text-muted">
(<span t-field="order_line.secondary_uom_qty" />
<span
t-field="order_line.secondary_uom_id.name"
groups="uom.group_uom"
/>)
</span>
</t>
</xpath>
</template>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="base.group_user" model="res.groups">
<field
name="implied_ids"
eval="[Command.link(ref('product_secondary_unit.group_purchase_secondary_unit'))]"
/>
</record>
</odoo>
Loading
Loading