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
36 changes: 16 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 @@ -68,13 +64,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 +101,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
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 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 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>
34 changes: 14 additions & 20 deletions purchase_order_secondary_unit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Purchase Order Secondary Unit</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="purchase-order-secondary-unit">
<h1 class="title">Purchase Order Secondary Unit</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="purchase-order-secondary-unit">
<h1>Purchase Order Secondary Unit</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2b71909b287e9e5c437aea172c4c165ed1bee7b3e981d1c44d99c8bfaae5740d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/purchase-workflow/tree/18.0/purchase_order_secondary_unit"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-purchase_order_secondary_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/purchase-workflow/tree/18.0/purchase_order_secondary_unit"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-purchase_order_secondary_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of purchase orders to allow buy
products in secondary unit of distinct category.</p>
<p>Users can enter quantities and prices in secondary units on purchase
Expand All @@ -398,13 +393,13 @@ <h1>Purchase Order Secondary Unit</h1>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>For configuration of displaying secondary unit information in purchase
reports and the Purchase Order portal, see the guidelines provided in
product_secondary_unit.</p>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module you need to:</p>
<ol class="arabic simple">
<li>Go to a <em>Product &gt; General Information tab</em>.</li>
Expand All @@ -418,38 +413,38 @@ <h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<ul class="simple">
<li>When adding a vendor to a product’s pricelist (via <em>Purchase tab &gt;
Vendors</em>), 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.</li>
from the product variant’s purchase secondary UOM, or from the
product template if not set on the variant.</li>
<li>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.</li>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<p>Updating existing vendor pricelist records from purchase order
confirmation does not currently support secondary UOM or secondary UOM
pricing. This is not included in the current scope and may be considered
in future improvements.</p>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_secondary_unit%0Aversion:%2018.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">
<h2><a class="toc-backref" href="#toc-entry-5">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-6">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Sergio Teruel</li>
Expand All @@ -466,7 +461,7 @@ <h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -479,6 +474,5 @@ <h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Loading