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
83 changes: 83 additions & 0 deletions purchase_return_picking_type/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
============================
Purchase Return Picking Type
============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4aaf8a2b6dedc23ab40ebf59403c611a8e55964c2b1ecb1e788453c546c6cd17
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-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%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_return_picking_type
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_return_picking_type
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to define an Operation Type in Purchase Return Orders.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/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
`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**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* ForgeFlow, S.L.

* Alex Paris <alex.paris@forgeflow.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

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.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions purchase_return_picking_type/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions purchase_return_picking_type/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 ForgeFlow, S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Purchase Return Picking Type",
"summary": "Manage return orders and operation types.",
"version": "16.0.1.0.0",
"category": "Purchases",
"website": "https://github.com/OCA/purchase-workflow",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["purchase_return", "purchase_stock"],
"data": [
"views/purchase_return_views.xml",
],
"development_status": "Alpha",
}
1 change: 1 addition & 0 deletions purchase_return_picking_type/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_return_order
40 changes: 40 additions & 0 deletions purchase_return_picking_type/models/purchase_return_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2025 ForgeFlow, S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from odoo import api, fields, models

from odoo.addons.purchase_return.models.purchase_return_order import (
PurchaseOrderReturn as PurchaseReturn,
)


class PurchaseOrderReturn(models.Model):
_inherit = "purchase.return.order"

picking_type_id = fields.Many2one(
"stock.picking.type",
"Delivered To",
states=PurchaseReturn.READONLY_STATES,
required=True,
default=lambda self: self._default_picking_type(),
domain="['|', ('warehouse_id', '=', False), "
"('warehouse_id.company_id', '=', company_id)]",
help="This will determine operation type of incoming shipment",
)

@api.model
def _get_picking_type(self, company_id):
picking_type = self.env["stock.picking.type"].search(
[("code", "=", "incoming"), ("warehouse_id.company_id", "=", company_id)]
)
if not picking_type:
picking_type = self.env["stock.picking.type"].search(
[("code", "=", "incoming"), ("warehouse_id", "=", False)]
)
return picking_type[:1]

@api.model
def _default_picking_type(self):
return self._get_picking_type(
self.env.context.get("company_id") or self.env.company.id
)
3 changes: 3 additions & 0 deletions purchase_return_picking_type/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* ForgeFlow, S.L.

* Alex Paris <alex.paris@forgeflow.com>
1 change: 1 addition & 0 deletions purchase_return_picking_type/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows to define an Operation Type in Purchase Return Orders.
Loading
Loading