mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[MIG] rma_sale_mrp: Migration to 16.0
- Standard procedure. - Rename changed fields. TT44949
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
# Copyright 2020 Tecnativa - David Vidal
|
# Copyright 2020 Tecnativa - David Vidal
|
||||||
|
# Copyright 2023 Tecnativa - Pedro M. Baeza
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
{
|
{
|
||||||
"name": "Return Merchandise Authorization Management - Link with MRP Kits",
|
"name": "Return Merchandise Authorization Management - Link with MRP Kits",
|
||||||
"summary": "Allow doing RMAs from MRP kits",
|
"summary": "Allow doing RMAs from MRP kits",
|
||||||
"version": "15.0.1.0.1",
|
"version": "16.0.1.0.0",
|
||||||
"development_status": "Beta",
|
"development_status": "Beta",
|
||||||
"category": "RMA",
|
"category": "RMA",
|
||||||
"website": "https://github.com/OCA/rma",
|
"website": "https://github.com/OCA/rma",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Copyright 2020 Tecnativa - David Vidal
|
# Copyright 2020 Tecnativa - David Vidal
|
||||||
# Copyright 2022 Tecnativa - Víctor Martínez
|
# Copyright 2022 Tecnativa - Víctor Martínez
|
||||||
|
# Copyright 2023 Tecnativa - Pedro M. Baeza
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
from odoo.tests import Form
|
from odoo.tests import Form
|
||||||
@@ -49,7 +50,7 @@ class TestRmaSaleMrp(TestRmaSaleBase):
|
|||||||
cls.order_out_picking = cls.sale_order.picking_ids
|
cls.order_out_picking = cls.sale_order.picking_ids
|
||||||
# Confirm but leave a backorder to split moves so we can test that
|
# Confirm but leave a backorder to split moves so we can test that
|
||||||
# the wizard correctly creates the RMAs with the proper quantities
|
# the wizard correctly creates the RMAs with the proper quantities
|
||||||
for line in cls.order_out_picking.move_lines:
|
for line in cls.order_out_picking.move_ids:
|
||||||
line.quantity_done = line.product_uom_qty - 7
|
line.quantity_done = line.product_uom_qty - 7
|
||||||
wiz_act = cls.order_out_picking.button_validate()
|
wiz_act = cls.order_out_picking.button_validate()
|
||||||
wiz = Form(
|
wiz = Form(
|
||||||
@@ -57,7 +58,7 @@ class TestRmaSaleMrp(TestRmaSaleBase):
|
|||||||
).save()
|
).save()
|
||||||
wiz.process()
|
wiz.process()
|
||||||
cls.backorder = cls.sale_order.picking_ids - cls.order_out_picking
|
cls.backorder = cls.sale_order.picking_ids - cls.order_out_picking
|
||||||
for line in cls.backorder.move_lines:
|
for line in cls.backorder.move_ids:
|
||||||
line.quantity_done = line.product_uom_qty
|
line.quantity_done = line.product_uom_qty
|
||||||
cls.backorder.button_validate()
|
cls.backorder.button_validate()
|
||||||
|
|
||||||
@@ -78,10 +79,10 @@ class TestRmaSaleMrp(TestRmaSaleBase):
|
|||||||
)
|
)
|
||||||
rma_1 = rmas.filtered(lambda x: x.product_id == self.product_kit_comp_1)
|
rma_1 = rmas.filtered(lambda x: x.product_id == self.product_kit_comp_1)
|
||||||
rma_2 = rmas.filtered(lambda x: x.product_id == self.product_kit_comp_2)
|
rma_2 = rmas.filtered(lambda x: x.product_id == self.product_kit_comp_2)
|
||||||
move_1 = out_pickings.mapped("move_lines").filtered(
|
move_1 = out_pickings.mapped("move_ids").filtered(
|
||||||
lambda x: x.product_id == self.product_kit_comp_1
|
lambda x: x.product_id == self.product_kit_comp_1
|
||||||
)
|
)
|
||||||
move_2 = out_pickings.mapped("move_lines").filtered(
|
move_2 = out_pickings.mapped("move_ids").filtered(
|
||||||
lambda x: x.product_id == self.product_kit_comp_2
|
lambda x: x.product_id == self.product_kit_comp_2
|
||||||
)
|
)
|
||||||
self.assertEqual(sum(rma_1.mapped("product_uom_qty")), 8)
|
self.assertEqual(sum(rma_1.mapped("product_uom_qty")), 8)
|
||||||
@@ -146,8 +147,8 @@ class TestRmaSaleMrp(TestRmaSaleBase):
|
|||||||
res = wizard.create_and_open_rma()
|
res = wizard.create_and_open_rma()
|
||||||
rmas = self.env["rma"].search(res["domain"])
|
rmas = self.env["rma"].search(res["domain"])
|
||||||
for rma in rmas:
|
for rma in rmas:
|
||||||
res = self.report_model._get_report_from_name(
|
res = self.env["ir.actions.report"]._render_qweb_html(
|
||||||
"rma.report_rma"
|
"rma.report_rma", rma.ids
|
||||||
)._render_qweb_text(rma.ids, False)
|
)
|
||||||
self.assertRegex(str(res[0]), self.product_kit_comp_1.name)
|
self.assertRegex(str(res[0]), self.product_kit_comp_1.name)
|
||||||
self.assertRegex(str(res[0]), self.product_kit_comp_2.name)
|
self.assertRegex(str(res[0]), self.product_kit_comp_2.name)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Copyright 2020 Tecnativa - David Vidal
|
# Copyright 2020 Tecnativa - David Vidal
|
||||||
|
# Copyright 2023 Tecnativa - Pedro M. Baeza
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
@@ -108,7 +109,7 @@ class SaleOrderLineRmaWizard(models.TransientModel):
|
|||||||
)
|
)
|
||||||
res = super(SaleOrderLineRmaWizard, not_kit)._compute_move_id()
|
res = super(SaleOrderLineRmaWizard, not_kit)._compute_move_id()
|
||||||
for line in self.filtered(lambda x: x.phantom_bom_product and x.picking_id):
|
for line in self.filtered(lambda x: x.phantom_bom_product and x.picking_id):
|
||||||
line.move_id = line.picking_id.move_lines.filtered(
|
line.move_id = line.picking_id.move_ids.filtered(
|
||||||
lambda ml: (
|
lambda ml: (
|
||||||
ml.product_id == line.product_id
|
ml.product_id == line.product_id
|
||||||
and ml.sale_line_id == line.sale_line_id
|
and ml.sale_line_id == line.sale_line_id
|
||||||
|
|||||||
Reference in New Issue
Block a user