[MIG] rma_sale: Migration to 13.0

This commit is contained in:
Ernesto Tejeda
2020-10-28 17:04:17 -04:00
committed by Chafique
parent 0cbca17df5
commit 4a9259b23b
9 changed files with 24 additions and 29 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
: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/12.0/rma_sale
:target: https://github.com/OCA/rma/tree/13.0/rma_sale
:alt: OCA/rma
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/rma-12-0/rma-12-0-rma_sale
:target: https://translation.odoo-community.org/projects/rma-13-0/rma-13-0-rma_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/145/12.0
:target: https://runbot.odoo-community.org/runbot/145/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -79,7 +79,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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/rma/issues/new?body=module:%20rma_sale%0Aversion:%2012.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:%2013.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.
@@ -121,6 +121,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-ernestotejeda|
This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/12.0/rma_sale>`_ project on GitHub.
This module is part of the `OCA/rma <https://github.com/OCA/rma/tree/13.0/rma_sale>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,14 +3,14 @@
{
"name": "Return Merchandise Authorization Management - Link with Sales",
"summary": "Sale Order - Return Merchandise Authorization (RMA)",
"version": "12.0.1.5.2",
"development_status": "Beta",
"version": "13.0.1.0.0",
"development_status": "Production/Stable",
"category": "RMA",
"website": "https://github.com/OCA/rma",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["ernestotejeda"],
"license": "AGPL-3",
"depends": ["rma", "sale_stock",],
"depends": ["rma", "sale_stock"],
"data": [
"views/assets.xml",
"views/report_rma.xml",

View File

@@ -20,15 +20,15 @@ class Rma(models.Model):
allowed_picking_ids = fields.Many2many(
comodel_name="stock.picking", compute="_compute_allowed_picking_ids",
)
picking_id = fields.Many2one(domain="[('id', 'in', allowed_picking_ids)]",)
picking_id = fields.Many2one(domain="[('id', 'in', allowed_picking_ids)]")
allowed_move_ids = fields.Many2many(
comodel_name="sale.order.line", compute="_compute_allowed_move_ids",
)
move_id = fields.Many2one(domain="[('id', 'in', allowed_move_ids)]",)
move_id = fields.Many2one(domain="[('id', 'in', allowed_move_ids)]")
allowed_product_ids = fields.Many2many(
comodel_name="product.product", compute="_compute_allowed_product_ids",
)
product_id = fields.Many2one(domain="[('id', 'in', allowed_product_ids)]",)
product_id = fields.Many2one(domain="[('id', 'in', allowed_product_ids)]")
@api.depends("partner_id", "order_id")
def _compute_allowed_picking_ids(self):
@@ -81,5 +81,5 @@ class Rma(models.Model):
"""Inject salesman from sales order (if any)"""
res = super()._prepare_refund(invoice_form, origin)
if self.order_id:
invoice_form.user_id = self.order_id.user_id
invoice_form.invoice_user_id = self.order_id.user_id
return res

View File

@@ -12,7 +12,7 @@ class SaleOrder(models.Model):
rma_ids = fields.One2many(
comodel_name="rma", inverse_name="order_id", string="RMAs", copy=False,
)
rma_count = fields.Integer(string="RMA count", compute="_compute_rma_count",)
rma_count = fields.Integer(string="RMA count", compute="_compute_rma_count")
def _compute_rma_count(self):
rma_data = self.env["rma"].read_group(
@@ -48,7 +48,6 @@ class SaleOrder(models.Model):
return {
"name": _("Create RMA"),
"type": "ir.actions.act_window",
"view_type": "form",
"view_mode": "form",
"res_model": "sale.order.rma.wizard",
"res_id": wizard.id,

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/rma/tree/12.0/rma_sale"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/rma-12-0/rma-12-0-rma_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/145/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/rma/tree/13.0/rma_sale"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/rma-13-0/rma-13-0-rma_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/145/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to link a sales order to an RMA.
This can be done by creating an RMA from scratch and selecting the sales
order, creating one or more RMAs from a sales order form view or from a sales
@@ -430,7 +430,7 @@ number greater than the order line product quantity.</li>
<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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/rma/issues/new?body=module:%20rma_sale%0Aversion:%2012.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_sale%0Aversion:%2013.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">
@@ -461,7 +461,7 @@ mission is to support the collaborative development of Odoo features and
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" href="https://github.com/ernestotejeda"><img alt="ernestotejeda" src="https://github.com/ernestotejeda.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/rma/tree/12.0/rma_sale">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/13.0/rma_sale">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>

View File

@@ -13,12 +13,12 @@ class TestRmaSale(SavepointCase):
cls.sale_order = cls.env["sale.order"]
cls.product_1 = cls.product_product.create(
{"name": "Product test 1", "type": "product",}
{"name": "Product test 1", "type": "product"}
)
cls.product_2 = cls.product_product.create(
{"name": "Product test 2", "type": "product",}
{"name": "Product test 2", "type": "product"}
)
cls.partner = cls.res_partner.create({"name": "Partner test",})
cls.partner = cls.res_partner.create({"name": "Partner test"})
order_form = Form(cls.sale_order)
order_form.partner_id = cls.partner
with order_form.order_line.new() as line_form:
@@ -41,6 +41,7 @@ class TestRmaSale(SavepointCase):
rma_form.order_id = self.sale_order
rma_form.product_id = self.product_1
rma_form.product_uom_qty = 5
rma_form.location_id = self.sale_order.warehouse_id.rma_loc_id
rma = rma_form.save()
rma.action_confirm()
self.assertTrue(rma.reception_move_id)
@@ -69,7 +70,7 @@ class TestRmaSale(SavepointCase):
)
# Refund the RMA
user = self.env["res.users"].create(
{"login": "test_refund_with_so", "name": "Test",}
{"login": "test_refund_with_so", "name": "Test"}
)
order.user_id = user.id
rma.action_confirm()

View File

@@ -6,7 +6,7 @@
<field name="inherit_id" ref="sale.view_order_form" />
<field name="groups_id" eval="[(4, ref('rma.rma_group_user_own'))]" />
<field name="arch" type="xml">
<button name="action_done" position="after">
<button name="action_draft" position="after">
<button
name="action_create_rma"
type="object"

View File

@@ -3,8 +3,6 @@
from odoo import _, api, fields, models
from odoo.addons import decimal_precision as dp
class SaleOrderRmaWizard(models.TransientModel):
_name = "sale.order.rma.wizard"
@@ -71,7 +69,7 @@ class SaleOrderLineRmaWizard(models.TransientModel):
_name = "sale.order.line.rma.wizard"
_description = "Sale Order Line Rma Wizard"
wizard_id = fields.Many2one(comodel_name="sale.order.rma.wizard", string="Wizard",)
wizard_id = fields.Many2one(comodel_name="sale.order.rma.wizard", string="Wizard")
order_id = fields.Many2one(
comodel_name="sale.order",
default=lambda self: self.env["sale.order"].browse(
@@ -91,9 +89,7 @@ class SaleOrderLineRmaWizard(models.TransientModel):
comodel_name="uom.category", related="product_id.uom_id.category_id",
)
quantity = fields.Float(
string="Quantity",
digits=dp.get_precision("Product Unit of Measure"),
required=True,
string="Quantity", digits="Product Unit of Measure", required=True,
)
uom_id = fields.Many2one(
comodel_name="uom.uom",

View File

@@ -3,7 +3,6 @@
<record id="sale_order_create_rma_action" model="ir.actions.act_window">
<field name="name">Create RMAs</field>
<field name="res_model">sale.order.rma.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>