Skip to content

Commit ac81417

Browse files
[ADD] purchase_return_picking_type
1 parent 415e1d8 commit ac81417

File tree

13 files changed

+645
-0
lines changed

13 files changed

+645
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
============================
2+
Purchase Return Picking Type
3+
============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:4aaf8a2b6dedc23ab40ebf59403c611a8e55964c2b1ecb1e788453c546c6cd17
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Alpha
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_return_picking_type
21+
:alt: OCA/purchase-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_return_picking_type
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows to define an Operation Type in Purchase Return Orders.
32+
33+
.. IMPORTANT::
34+
This is an alpha version, the data model and design can change at any time without warning.
35+
Only for development or testing purpose, do not use in production.
36+
`More details on development status <https://odoo-community.org/page/development-status>`_
37+
38+
**Table of contents**
39+
40+
.. contents::
41+
:local:
42+
43+
Bug Tracker
44+
===========
45+
46+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
47+
In case of trouble, please check there if your issue has already been reported.
48+
If you spotted it first, help us to smash it by providing a detailed and welcomed
49+
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_return_picking_type%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
50+
51+
Do not contact contributors directly about support or help with technical issues.
52+
53+
Credits
54+
=======
55+
56+
Authors
57+
~~~~~~~
58+
59+
* ForgeFlow
60+
61+
Contributors
62+
~~~~~~~~~~~~
63+
64+
* ForgeFlow, S.L.
65+
66+
* Alex Paris <[email protected]>
67+
68+
Maintainers
69+
~~~~~~~~~~~
70+
71+
This module is maintained by the OCA.
72+
73+
.. image:: https://odoo-community.org/logo.png
74+
:alt: Odoo Community Association
75+
:target: https://odoo-community.org
76+
77+
OCA, or the Odoo Community Association, is a nonprofit organization whose
78+
mission is to support the collaborative development of Odoo features and
79+
promote its widespread use.
80+
81+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_return_picking_type>`_ project on GitHub.
82+
83+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2025 ForgeFlow, S.L. (https://www.forgeflow.com)
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
{
4+
"name": "Purchase Return Picking Type",
5+
"summary": "Manage return orders and operation types.",
6+
"version": "16.0.1.0.0",
7+
"category": "Purchases",
8+
"website": "https://github.com/OCA/purchase-workflow",
9+
"author": "ForgeFlow, Odoo Community Association (OCA)",
10+
"license": "LGPL-3",
11+
"application": False,
12+
"installable": True,
13+
"depends": ["purchase_return", "purchase_stock"],
14+
"data": [
15+
"views/purchase_return_views.xml",
16+
],
17+
"development_status": "Alpha",
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import purchase_return_order
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2025 ForgeFlow, S.L. (https://www.forgeflow.com)
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
from odoo import api, fields, models
5+
6+
from odoo.addons.purchase_return.models.purchase_return_order import (
7+
PurchaseOrderReturn as PurchaseReturn,
8+
)
9+
10+
11+
class PurchaseOrderReturn(models.Model):
12+
_inherit = "purchase.return.order"
13+
14+
picking_type_id = fields.Many2one(
15+
"stock.picking.type",
16+
"Deliver To",
17+
states=PurchaseReturn.READONLY_STATES,
18+
required=True,
19+
default=lambda self: self._default_picking_type(),
20+
domain="['|', ('warehouse_id', '=', False), "
21+
"('warehouse_id.company_id', '=', company_id)]",
22+
help="This will determine operation type of incoming shipment",
23+
)
24+
25+
@api.model
26+
def _get_picking_type(self, company_id):
27+
picking_type = self.env["stock.picking.type"].search(
28+
[("code", "=", "incoming"), ("warehouse_id.company_id", "=", company_id)]
29+
)
30+
if not picking_type:
31+
picking_type = self.env["stock.picking.type"].search(
32+
[("code", "=", "incoming"), ("warehouse_id", "=", False)]
33+
)
34+
return picking_type[:1]
35+
36+
@api.model
37+
def _default_picking_type(self):
38+
return self._get_picking_type(
39+
self.env.context.get("company_id") or self.env.company.id
40+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* ForgeFlow, S.L.
2+
3+
* Alex Paris <[email protected]>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module allows to define an Operation Type in Purchase Return Orders.

0 commit comments

Comments
 (0)