Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ addon | version | maintainers | summary
[pos_operating_unit](pos_operating_unit/) | 14.0.1.0.0 | | POS Operating Unit Access
[product_operating_unit](product_operating_unit/) | 14.0.1.0.3 | | Adds the concept of operating unit (OU) in products
[project_operating_unit](project_operating_unit/) | 14.0.1.0.0 | <a href='https://github.com/max3903'><img src='https://github.com/max3903.png' width='32' height='32' style='border-radius:50%;' alt='max3903'/></a> | This module adds operating unit information to projects and tasks.
[purchase_operating_unit](purchase_operating_unit/) | 14.0.2.0.0 | | Adds the concecpt of operating unit (OU) in purchase order management
[purchase_operating_unit](purchase_operating_unit/) | 14.0.2.0.1 | | Adds the concecpt of operating unit (OU) in purchase order management
[purchase_operating_unit_access_all](purchase_operating_unit_access_all/) | 14.0.1.0.0 | <a href='https://github.com/kittiu'><img src='https://github.com/kittiu.png' width='32' height='32' style='border-radius:50%;' alt='kittiu'/></a> | Access all OUs' Purchase Orders
[purchase_request_operating_unit](purchase_request_operating_unit/) | 14.0.1.0.0 | | Operating Unit in Purchase Requests
[purchase_request_operating_unit_access_all](purchase_request_operating_unit_access_all/) | 14.0.1.0.0 | <a href='https://github.com/kittiu'><img src='https://github.com/kittiu.png' width='32' height='32' style='border-radius:50%;' alt='kittiu'/></a> | Access all OUs' Purchase Requests
Expand Down
8 changes: 6 additions & 2 deletions purchase_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================================
Operating Unit in Purchase Orders
=================================
Expand All @@ -7,13 +11,13 @@ Operating Unit in Purchase Orders
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e55a5e02f3bf5c1506a46e825cdaa355b74a8ecbad1aefc092dead7702a36d09
!! source digest: sha256:63641e999c084c008514c20a1f7524f89227c1c629f0a8264c951f886780117f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/licence-LGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
Expand Down
2 changes: 1 addition & 1 deletion purchase_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Operating Unit in Purchase Orders",
"summary": "Adds the concecpt of operating unit (OU) in purchase order "
"management",
"version": "14.0.2.0.0",
"version": "14.0.2.0.1",
"author": "ForgeFlow, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
Expand Down
13 changes: 10 additions & 3 deletions purchase_operating_unit/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@ def _onchange_operating_unit_id(self):
types = type_obj.search(
[
("code", "=", "incoming"),
("warehouse_id.operating_unit_id", "=", self.operating_unit_id.id),
]
(
"warehouse_id.operating_unit_id",
"in",
[self.operating_unit_id.id, False],
),
],
)
if types:
self.picking_type_id = types[:1]
# Prefer types with an operating unit, if multiple are available
self.picking_type_id = types.sorted(
lambda x: x.warehouse_id.operating_unit_id
)[:1]
else:
raise UserError(
_(
Expand Down
41 changes: 25 additions & 16 deletions purchase_operating_unit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Operating Unit in Purchase Orders</title>
<title>README.rst</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -359,16 +360,21 @@
</style>
</head>
<body>
<div class="document" id="operating-unit-in-purchase-orders">
<h1 class="title">Operating Unit in Purchase Orders</h1>
<div class="document">


<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="operating-unit-in-purchase-orders">
<h1>Operating Unit in Purchase Orders</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e55a5e02f3bf5c1506a46e825cdaa355b74a8ecbad1aefc092dead7702a36d09
!! source digest: sha256:63641e999c084c008514c20a1f7524f89227c1c629f0a8264c951f886780117f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/operating-unit/tree/14.0/purchase_operating_unit"><img alt="OCA/operating-unit" src="https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/operating-unit-14-0/operating-unit-14-0-purchase_operating_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/operating-unit&amp;target_branch=14.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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/operating-unit/tree/14.0/purchase_operating_unit"><img alt="OCA/operating-unit" src="https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/operating-unit-14-0/operating-unit-14-0-purchase_operating_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/operating-unit&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module introduces the following features:</p>
<ul class="simple">
<li>It introduces the operating unit to the purchase order.</li>
Expand All @@ -391,7 +397,7 @@ <h1 class="title">Operating Unit in Purchase Orders</h1>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<ol class="arabic simple">
<li>Create a PO: the Default Operating Unit is assigned to the PO. If you want,
you can change to another Operating Unit.</li>
Expand All @@ -402,30 +408,30 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
<p>Procurement Orders were removed. Procurement Operating Unit module is
deprecated. Stock Operating Unit ensures consistency between the operating unit
from different models.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/operating-unit/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/operating-unit/issues/new?body=module:%20purchase_operating_unit%0Aversion:%2014.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">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<ul class="simple">
<li>ForgeFlow</li>
<li>Serpent Consulting Services Pvt. Ltd.</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<ul class="simple">
<li>Jordi Ballester Alomar &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt;</li>
<li>Aaron Henriquez &lt;<a class="reference external" href="mailto:ahforgeflow&#64;forgeflow.com">ahforgeflow&#64;forgeflow.com</a>&gt;</li>
Expand All @@ -440,9 +446,11 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<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" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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>
Expand All @@ -451,5 +459,6 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
</div>
</div>
</div>
</div>
</body>
</html>
16 changes: 16 additions & 0 deletions purchase_operating_unit/tests/test_po_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# - Jordi Ballester Alomar
# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo.tests.common import Form

from . import test_purchase_operating_unit as test_po_ou # noqa


Expand Down Expand Up @@ -52,3 +54,17 @@ def test_po_ou_security(self):
.ids
)
self.assertNotEqual(invoice_ids, [])

def test_create_po_warehouse_ou(self):
# create a PO with warehouse with OU
warehouse = self.env.ref("stock.warehouse0")
self.assertEqual(warehouse.operating_unit_id, self.ou1)
with Form(self.PurchaseOrder.with_user(self.user1_id)) as f:
f.partner_id = self.partner1
self.assertEqual(f.picking_type_id.warehouse_id, warehouse)

# create a PO with warehouse without OU
warehouse.operating_unit_id = False
with Form(self.PurchaseOrder.with_user(self.user1_id)) as f:
f.partner_id = self.partner1
self.assertEqual(f.picking_type_id.warehouse_id, warehouse)