mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[MIG] rma_scrap: migration to v17
This commit is contained in:
committed by
JasminSForgeFlow
parent
df976cbca5
commit
fc83285b6e
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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'"
|
||||
>
|
||||
<field name="scrap_count" widget="statinfo" string="Scraps" />
|
||||
</button>
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
<field name="scrap_count" widget="statinfo" string="Scraps" />
|
||||
</button>
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
</button>
|
||||
<field name="rma_line_id" invisible="1" />
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
<button
|
||||
name="%(action_rma_scrap)d"
|
||||
string="Scrap"
|
||||
attrs="{'invisible':['|', ('qty_to_scrap', '!=', 0), ('state', '!=', 'approved')]}"
|
||||
invisible="qty_to_scrap != 0 or state != 'approved'"
|
||||
type="action"
|
||||
groups="stock.group_stock_user"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user