diff --git a/README.md b/README.md
index 3934742795..d44b5f2280 100644
--- a/README.md
+++ b/README.md
@@ -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 |
| 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 |
| 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 |
| Access all OUs' Purchase Requests
diff --git a/purchase_operating_unit/README.rst b/purchase_operating_unit/README.rst
index b9dc6464aa..8dd73bec70 100644
--- a/purchase_operating_unit/README.rst
+++ b/purchase_operating_unit/README.rst
@@ -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
=================================
@@ -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
diff --git a/purchase_operating_unit/__manifest__.py b/purchase_operating_unit/__manifest__.py
index f5aca7d82e..597ddaa4d1 100644
--- a/purchase_operating_unit/__manifest__.py
+++ b/purchase_operating_unit/__manifest__.py
@@ -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)",
diff --git a/purchase_operating_unit/models/purchase_order.py b/purchase_operating_unit/models/purchase_order.py
index 20da03e87f..9886f08e3f 100644
--- a/purchase_operating_unit/models/purchase_order.py
+++ b/purchase_operating_unit/models/purchase_order.py
@@ -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(
_(
diff --git a/purchase_operating_unit/static/description/index.html b/purchase_operating_unit/static/description/index.html
index d3f9afcbcb..4dd810de21 100644
--- a/purchase_operating_unit/static/description/index.html
+++ b/purchase_operating_unit/static/description/index.html
@@ -3,15 +3,16 @@
-Operating Unit in Purchase Orders
+README.rst
-
-
Operating Unit in Purchase Orders
+
+
+
+
+
+
-
+
- Create a PO: the Default Operating Unit is assigned to the PO. If you want,
you can change to another Operating Unit.
@@ -402,13 +408,13 @@
-
+
Procurement Orders were removed. Procurement Operating Unit module is
deprecated. Stock Operating Unit ensures consistency between the operating unit
from different models.
-
+
Bugs are tracked on GitHub Issues.
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
@@ -416,16 +422,16 @@
Do not contact contributors directly about support or help with technical issues.
-
+
-
+
- ForgeFlow
- Serpent Consulting Services Pvt. Ltd.
-
+
This module is maintained by the OCA.
-

+
+
+
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.
@@ -451,5 +459,6 @@
+