Skip to content

Commit 0477bbd

Browse files
[ADD] purchase_return_stock
1 parent 415e1d8 commit 0477bbd

File tree

11 files changed

+585
-0
lines changed

11 files changed

+585
-0
lines changed

purchase_return_stock/README.rst

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
=====================
2+
Purchase Return Stock
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-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
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_stock
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_stock
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+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Bug Tracker
39+
===========
40+
41+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
42+
In case of trouble, please check there if your issue has already been reported.
43+
If you spotted it first, help us to smash it by providing a detailed and welcomed
44+
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_return_stock%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
45+
46+
Do not contact contributors directly about support or help with technical issues.
47+
48+
Credits
49+
=======
50+
51+
Authors
52+
~~~~~~~
53+
54+
* ForgeFlow
55+
56+
Contributors
57+
~~~~~~~~~~~~
58+
59+
* ForgeFlow, S.L.
60+
61+
* Alex Paris <[email protected]>
62+
63+
Maintainers
64+
~~~~~~~~~~~
65+
66+
This module is maintained by the OCA.
67+
68+
.. image:: https://odoo-community.org/logo.png
69+
:alt: Odoo Community Association
70+
:target: https://odoo-community.org
71+
72+
OCA, or the Odoo Community Association, is a nonprofit organization whose
73+
mission is to support the collaborative development of Odoo features and
74+
promote its widespread use.
75+
76+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_return_stock>`_ project on GitHub.
77+
78+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

purchase_return_stock/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

purchase_return_stock/__manifest__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 Stock",
5+
"summary": "Manage return orders and stock.",
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+
}
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: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from odoo import api, fields, models
2+
3+
from odoo.addons.purchase_return.models.purchase_return_order import (
4+
PurchaseOrderReturn as PurchaseReturn,
5+
)
6+
7+
8+
class PurchaseOrderReturn(models.Model):
9+
_inherit = "purchase.return.order"
10+
11+
@api.model
12+
def _get_picking_type(self, company_id):
13+
picking_type = self.env["stock.picking.type"].search(
14+
[("code", "=", "incoming"), ("warehouse_id.company_id", "=", company_id)]
15+
)
16+
if not picking_type:
17+
picking_type = self.env["stock.picking.type"].search(
18+
[("code", "=", "incoming"), ("warehouse_id", "=", False)]
19+
)
20+
return picking_type[:1]
21+
22+
@api.model
23+
def _default_picking_type(self):
24+
return self._get_picking_type(
25+
self.env.context.get("company_id") or self.env.company.id
26+
)
27+
28+
picking_type_id = fields.Many2one(
29+
"stock.picking.type",
30+
"Deliver To",
31+
states=PurchaseReturn.READONLY_STATES,
32+
required=True,
33+
default=_default_picking_type,
34+
domain="['|', ('warehouse_id', '=', False), ('warehouse_id.company_id', '=', company_id)]",
35+
help="This will determine operation type of incoming shipment",
36+
)
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)