[14.0][MIG] rma_sale module

This commit is contained in:
Chafique
2020-12-10 17:59:24 +01:00
committed by Florian da Costa
parent 8afb31c883
commit 0d98089699
7 changed files with 23 additions and 15 deletions

View File

@@ -14,13 +14,13 @@ Return Merchandise Authorization Management - Link with Sales
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github
:target: https://github.com/OCA/rma/tree/13.0/rma_sale :target: https://github.com/OCA/rma/tree/14.0/rma_sale
:alt: OCA/rma :alt: OCA/rma
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/rma-13-0/rma-13-0-rma_sale :target: https://translation.odoo-community.org/projects/rma-14-0/rma-14-0-rma_sale
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/145/13.0 :target: https://runbot.odoo-community.org/runbot/145/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -79,7 +79,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/issues>`_. 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. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/rma/issues/new?body=module:%20rma_sale%0Aversion:%2013.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_sale%0Aversion:%2014.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. Do not contact contributors directly about support or help with technical issues.
@@ -100,6 +100,8 @@ Contributors
* Pedro M. Baeza * Pedro M. Baeza
* David Vidal * David Vidal
* Chafique Delli <chafique.delli@akretion.com>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -121,6 +123,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-ernestotejeda| |maintainer-ernestotejeda|
This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/13.0/rma_sale>`_ project on GitHub. This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/14.0/rma_sale>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,7 +3,7 @@
{ {
"name": "Return Merchandise Authorization Management - Link with Sales", "name": "Return Merchandise Authorization Management - Link with Sales",
"summary": "Sale Order - Return Merchandise Authorization (RMA)", "summary": "Sale Order - Return Merchandise Authorization (RMA)",
"version": "13.0.2.0.0", "version": "14.0.1.0.0",
"development_status": "Production/Stable", "development_status": "Production/Stable",
"category": "RMA", "category": "RMA",
"website": "https://github.com/OCA/rma", "website": "https://github.com/OCA/rma",
@@ -12,6 +12,7 @@
"license": "AGPL-3", "license": "AGPL-3",
"depends": ["rma", "sale_stock"], "depends": ["rma", "sale_stock"],
"data": [ "data": [
"security/ir.model.access.csv",
"views/assets.xml", "views/assets.xml",
"views/report_rma.xml", "views/report_rma.xml",
"views/rma_views.xml", "views/rma_views.xml",

View File

@@ -40,7 +40,7 @@ class Rma(models.Model):
def _compute_allowed_picking_ids(self): def _compute_allowed_picking_ids(self):
domain = [("state", "=", "done"), ("picking_type_id.code", "=", "outgoing")] domain = [("state", "=", "done"), ("picking_type_id.code", "=", "outgoing")]
for rec in self: for rec in self:
# if rec.partner_id: if rec.partner_id:
commercial_partner = rec.partner_id.commercial_partner_id commercial_partner = rec.partner_id.commercial_partner_id
domain.append(("partner_id", "child_of", commercial_partner.id)) domain.append(("partner_id", "child_of", commercial_partner.id))
if rec.order_id: if rec.order_id:

View File

@@ -3,3 +3,5 @@
* Ernesto Tejeda * Ernesto Tejeda
* Pedro M. Baeza * Pedro M. Baeza
* David Vidal * David Vidal
* Chafique Delli <chafique.delli@akretion.com>

View File

@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sale_order_rma_wizard_user_all,sale.order.rma.wizard.user.all,model_sale_order_rma_wizard,rma.rma_group_user_all,1,1,1,1
access_sale_order_line_rma_wizard_user_all,sale.order.line.rma.wizard.user.all,model_sale_order_line_rma_wizard,rma.rma_group_user_all,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sale_order_rma_wizard_user_all sale.order.rma.wizard.user.all model_sale_order_rma_wizard rma.rma_group_user_all 1 1 1 1
3 access_sale_order_line_rma_wizard_user_all sale.order.line.rma.wizard.user.all model_sale_order_line_rma_wizard rma.rma_group_user_all 1 1 1 1

View File

@@ -79,7 +79,7 @@ class TestRmaSale(SavepointCase):
order.user_id = user.id order.user_id = user.id
rma.action_confirm() rma.action_confirm()
rma.reception_move_id.quantity_done = rma.product_uom_qty rma.reception_move_id.quantity_done = rma.product_uom_qty
rma.reception_move_id.picking_id.action_done() rma.reception_move_id.picking_id._action_done()
rma.action_refund() rma.action_refund()
self.assertEqual(rma.refund_id.user_id, user) self.assertEqual(rma.refund_id.user_id, user)
@@ -88,7 +88,7 @@ class TestRmaSale(SavepointCase):
wizard = self._rma_sale_wizard(self.sale_order) wizard = self._rma_sale_wizard(self.sale_order)
rma = self.env["rma"].browse(wizard.create_and_open_rma()["res_id"]) rma = self.env["rma"].browse(wizard.create_and_open_rma()["res_id"])
rma.reception_move_id.quantity_done = rma.product_uom_qty rma.reception_move_id.quantity_done = rma.product_uom_qty
rma.reception_move_id.picking_id.action_done() rma.reception_move_id.picking_id._action_done()
wizard = self._rma_sale_wizard(self.sale_order) wizard = self._rma_sale_wizard(self.sale_order)
self.assertEqual( self.assertEqual(
wizard.line_ids.quantity, wizard.line_ids.quantity,
@@ -106,7 +106,7 @@ class TestRmaSale(SavepointCase):
delivery_wizard.action_deliver() delivery_wizard.action_deliver()
picking = rma.delivery_move_ids.picking_id picking = rma.delivery_move_ids.picking_id
picking.move_lines.quantity_done = rma.product_uom_qty picking.move_lines.quantity_done = rma.product_uom_qty
picking.action_done() picking._action_done()
# The product is returned to the customer, so we should be able to make # The product is returned to the customer, so we should be able to make
# another RMA in the future # another RMA in the future
wizard = self._rma_sale_wizard(self.sale_order) wizard = self._rma_sale_wizard(self.sale_order)

View File

@@ -144,16 +144,16 @@ class SaleOrderLineRmaWizard(models.TransientModel):
@api.depends("picking_id") @api.depends("picking_id")
def _compute_move_id(self): def _compute_move_id(self):
for record in self: for record in self:
move_id = False
if record.picking_id: if record.picking_id:
record.move_id = record.picking_id.move_lines.filtered( move_id = record.picking_id.move_lines.filtered(
lambda r: ( lambda r: (
r.sale_line_id == record.sale_line_id r.sale_line_id == record.sale_line_id
and r.sale_line_id.product_id == record.product_id and r.sale_line_id.product_id == record.product_id
and r.sale_line_id.order_id == record.order_id and r.sale_line_id.order_id == record.order_id
) )
) )
else: record.move_id = move_id
record.move_id = False
@api.depends("order_id") @api.depends("order_id")
def _compute_allowed_product_ids(self): def _compute_allowed_product_ids(self):