diff --git a/rma_scrap/__manifest__.py b/rma_scrap/__manifest__.py
index cb8c5e88..16984e5a 100644
--- a/rma_scrap/__manifest__.py
+++ b/rma_scrap/__manifest__.py
@@ -1,6 +1,6 @@
{
"name": "RMA Scrap",
- "version": "16.0.1.0.0",
+ "version": "17.0.1.0.0",
"license": "LGPL-3",
"category": "RMA",
"summary": "Allows to scrap the received/ordered products in odoo",
diff --git a/rma_scrap/models/rma_order_line.py b/rma_scrap/models/rma_order_line.py
index cd241444..4dcd6228 100644
--- a/rma_scrap/models/rma_order_line.py
+++ b/rma_scrap/models/rma_order_line.py
@@ -92,7 +92,7 @@ class RmaOrderLine(models.Model):
@api.onchange("operation_id")
def _onchange_operation_id(self):
- res = super(RmaOrderLine, self)._onchange_operation_id()
+ res = super()._onchange_operation_id()
if self.operation_id:
self.scrap_policy = self.operation_id.scrap_policy or "no"
return res
diff --git a/rma_scrap/models/stock_scrap.py b/rma_scrap/models/stock_scrap.py
index d2ad889f..2b258359 100644
--- a/rma_scrap/models/stock_scrap.py
+++ b/rma_scrap/models/stock_scrap.py
@@ -19,14 +19,14 @@ class StockScrap(models.Model):
)
def do_scrap(self):
- res = super(StockScrap, self).do_scrap()
+ res = super().do_scrap()
if self.is_rma_scrap:
- self.move_id.is_rma_scrap = True
- self.rma_line_id.move_ids |= self.move_id
+ self.move_ids.is_rma_scrap = True
+ self.rma_line_id.move_ids |= self.move_ids
return res
def _prepare_move_values(self):
- res = super(StockScrap, self)._prepare_move_values()
+ res = super()._prepare_move_values()
res["rma_line_id"] = self.rma_line_id.id
return res
diff --git a/rma_scrap/tests/test_rma_scrap.py b/rma_scrap/tests/test_rma_scrap.py
index 5e776562..0187547b 100644
--- a/rma_scrap/tests/test_rma_scrap.py
+++ b/rma_scrap/tests/test_rma_scrap.py
@@ -4,7 +4,7 @@ from odoo.tests import common
class TestRmaScrap(common.SingleTransactionCase):
@classmethod
def setUpClass(cls):
- super(TestRmaScrap, cls).setUpClass()
+ super().setUpClass()
cls.rma_obj = cls.env["rma.order"]
cls.rma_line_obj = cls.env["rma.order.line"]
@@ -108,7 +108,7 @@ class TestRmaScrap(common.SingleTransactionCase):
action_picking = wizard.action_create_picking()
picking = self.env["stock.picking"].browse([action_picking["res_id"]])
- picking.move_line_ids[0].qty_done = rma.qty_to_receive
+ picking.move_line_ids[0].quantity = rma.qty_to_receive
picking.button_validate()
rma._compute_qty_to_scrap()
@@ -137,9 +137,9 @@ class TestRmaScrap(common.SingleTransactionCase):
action = wizard.action_create_scrap()
scrap = self.env["stock.scrap"].browse([action["res_id"]])
self.assertEqual(scrap.location_id.id, self.stock_rma_location.id)
- self.assertEqual(scrap.move_id.id, False)
+ self.assertEqual(scrap.move_ids.id, False)
scrap.action_validate()
- move = scrap.move_id
+ move = scrap.move_ids
self.assertEqual(move.product_id.id, self.product_1.id)
self.assertFalse(rma.qty_to_scrap)
self.assertEqual(rma.qty_scrap, 1.00)
@@ -187,7 +187,7 @@ class TestRmaScrap(common.SingleTransactionCase):
action = wizard.action_create_scrap()
scrap = self.env["stock.scrap"].browse([action["res_id"]])
self.assertEqual(scrap.location_id.id, self.stock_rma_location.id)
- self.assertEqual(scrap.move_id.id, False)
+ self.assertEqual(scrap.move_ids.id, False)
self.assertEqual(rma.qty_in_scrap, 1.00)
res = scrap.action_validate()
scrap.do_scrap()
diff --git a/rma_scrap/views/rma_order_line_view.xml b/rma_scrap/views/rma_order_line_view.xml
index 0d6c0505..8411b90e 100644
--- a/rma_scrap/views/rma_order_line_view.xml
+++ b/rma_scrap/views/rma_order_line_view.xml
@@ -13,7 +13,7 @@
class="oe_stat_button"
icon="fa-truck"
groups="stock.group_stock_user"
- attrs="{'invisible':['|', ('scrap_count', '=', 0), ('state', '=', 'draft')]}"
+ invisible="scrap_count == 0 or state == 'draft'"
>
diff --git a/rma_scrap/views/rma_order_view.xml b/rma_scrap/views/rma_order_view.xml
index 0b6a59ab..b1134826 100644
--- a/rma_scrap/views/rma_order_view.xml
+++ b/rma_scrap/views/rma_order_view.xml
@@ -12,7 +12,7 @@
class="oe_stat_button"
icon="fa-truck"
groups="stock.group_stock_user"
- attrs="{'invisible': [('scrap_count', '=', 0)]}"
+ invisible="scrap_count == 0"
>
diff --git a/rma_scrap/views/stock_scrap_view.xml b/rma_scrap/views/stock_scrap_view.xml
index 4eda2969..05479ec6 100644
--- a/rma_scrap/views/stock_scrap_view.xml
+++ b/rma_scrap/views/stock_scrap_view.xml
@@ -13,7 +13,7 @@
icon="fa-eject"
string="RMA Line"
groups="stock.group_stock_user"
- attrs="{'invisible': [('rma_line_id', '=', False)]}"
+ invisible="rma_line_id == False"
>
diff --git a/rma_scrap/wizards/rma_make_scrap.py b/rma_scrap/wizards/rma_make_scrap.py
index 1c393ace..747efc45 100644
--- a/rma_scrap/wizards/rma_make_scrap.py
+++ b/rma_scrap/wizards/rma_make_scrap.py
@@ -33,7 +33,7 @@ class RmaMakeScrap(models.TransientModel):
@api.model
def default_get(self, fields_list):
context = self._context.copy()
- res = super(RmaMakeScrap, self).default_get(fields_list)
+ res = super().default_get(fields_list)
rma_line_obj = self.env["rma.order.line"]
rma_line_ids = self.env.context["active_ids"] or []
active_model = self.env.context["active_model"]
@@ -107,7 +107,8 @@ class RmaMakeScrapItem(models.TransientModel):
"stock.location",
string="Source Location",
required=True,
- domain="[('usage', '=', 'internal'), ('company_id', 'in', [company_id, False])]",
+ domain="[('usage', '=', 'internal'),"
+ "('company_id', 'in', [company_id, False])]",
)
scrap_location_id = fields.Many2one(
"stock.location",
diff --git a/rma_scrap/wizards/rma_scrap_view.xml b/rma_scrap/wizards/rma_scrap_view.xml
index ac6eda1b..9f5537d3 100644
--- a/rma_scrap/wizards/rma_scrap_view.xml
+++ b/rma_scrap/wizards/rma_scrap_view.xml
@@ -58,14 +58,14 @@
name="%(action_rma_scrap)d"
string="Scrap"
class="oe_highlight"
- attrs="{'invisible':['|', ('qty_to_scrap', '=', 0), ('state', '!=', 'approved')]}"
+ invisible="qty_to_scrap == 0 or state != 'approved'"
type="action"
groups="stock.group_stock_user"
/>