Skip to content

Commit

Permalink
[16.0][MIG] rma_delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
sbejaoui committed Oct 18, 2024
1 parent 02fb0c4 commit bbf680f
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 16 deletions.
12 changes: 7 additions & 5 deletions rma_delivery/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Return Merchandise Authorization Management - Link with deliveries
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github
:target: https://github.com/OCA/rma/tree/15.0/rma_delivery
:target: https://github.com/OCA/rma/tree/16.0/rma_delivery
:alt: OCA/rma
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/rma-15-0/rma-15-0-rma_delivery
:target: https://translation.odoo-community.org/projects/rma-16-0/rma-16-0-rma_delivery
: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/rma&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/rma&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -67,7 +67,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/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/rma/issues/new?body=module:%20rma_delivery%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/rma/issues/new?body=module:%20rma_delivery%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.

Expand All @@ -86,6 +86,8 @@ Contributors

* David Vidal

* Souheil Bejaoui - ACSONE SA/NV <[email protected]>

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

Expand All @@ -107,6 +109,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-chienandalu|

This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/15.0/rma_delivery>`_ project on GitHub.
This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/16.0/rma_delivery>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion rma_delivery/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Return Merchandise Authorization Management - Link with deliveries",
"summary": "Allow to choose a default delivery carrier for returns",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "RMA",
"website": "https://github.com/OCA/rma",
Expand Down
18 changes: 13 additions & 5 deletions rma_delivery/models/rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ def _prepare_returning_picking(self, picking_form, origin=None):
)
return res

Check warning on line 33 in rma_delivery/models/rma.py

View check run for this annotation

Codecov / codecov/patch

rma_delivery/models/rma.py#L33

Added line #L33 was not covered by tests

def create_replace(self, scheduled_date, warehouse, product, qty, uom):
existing_pickings = self.delivery_move_ids.mapped("picking_id")
res = super().create_replace(scheduled_date, warehouse, product, qty, uom)
new_pickings = self.delivery_move_ids.mapped("picking_id") - existing_pickings
for picking in new_pickings:
def _set_carrier(self, pickings):
for picking in pickings:
picking.carrier_id = self._get_default_carrier_id(
picking.company_id, picking.partner_id
)

def create_replace(self, scheduled_date, warehouse, product, qty, uom):
existing_pickings = self.delivery_move_ids.picking_id
res = super().create_replace(scheduled_date, warehouse, product, qty, uom)
self._set_carrier(self.delivery_move_ids.picking_id - existing_pickings)
return res

def create_return(self, scheduled_date, qty=None, uom=None):
existing_pickings = self.delivery_move_ids.picking_id
res = super().create_return(scheduled_date, qty=qty, uom=uom)
self._set_carrier(self.delivery_move_ids.picking_id - existing_pickings)
return res
2 changes: 2 additions & 0 deletions rma_delivery/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* David Vidal

* Souheil Bejaoui - ACSONE SA/NV <[email protected]>
8 changes: 4 additions & 4 deletions rma_delivery/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -369,7 +368,7 @@ <h1 class="title">Return Merchandise Authorization Management - Link with delive
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:70d83c2e2b826b0e4aee27f02ab2f1c8e37167477320a5faa88e70587c425c97
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rma/tree/15.0/rma_delivery"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rma-15-0/rma-15-0-rma_delivery"><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/rma&amp;target_branch=15.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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rma/tree/16.0/rma_delivery"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rma-16-0/rma-16-0-rma_delivery"><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/rma&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of the RMA module to allow to choose a default
behavior for the shipping method used on the RMA returns to the customer.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -417,7 +416,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/rma/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/rma/issues/new?body=module:%20rma_delivery%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/rma/issues/new?body=module:%20rma_delivery%0Aversion:%2016.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">
Expand All @@ -435,6 +434,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>David Vidal</li>
</ul>
</li>
<li>Souheil Bejaoui - ACSONE SA/NV &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -446,7 +446,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/chienandalu"><img alt="chienandalu" src="https://github.com/chienandalu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/rma/tree/15.0/rma_delivery">OCA/rma</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/rma/tree/16.0/rma_delivery">OCA/rma</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion rma_delivery/tests/test_rma_delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from odoo.addons.rma.tests.test_rma import TestRma


class TestRmaDelivery(TestRma):
class TestRmaDeliveryBase(TestRma):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -46,6 +46,8 @@ def _return_to_customer(self, rma, delivery_type="return"):
delivery_wizard.action_deliver()
return rma.delivery_move_ids.picking_id


class TestRmaDelivery(TestRmaDeliveryBase):
def test_01_fixed_method(self):
"""Fixed method. RMA gets the company default carrier"""
# Return picking
Expand Down
1 change: 1 addition & 0 deletions setup/rma_delivery/odoo/addons/rma_delivery
6 changes: 6 additions & 0 deletions setup/rma_delivery/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit bbf680f

Please sign in to comment.