mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] scrap_reason_code: Migration to 17.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
{
|
||||
"name": "Scrap Reason Code",
|
||||
"version": "16.0.1.1.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Reason code for scrapping",
|
||||
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
||||
|
||||
@@ -12,7 +12,6 @@ class StockScrap(models.Model):
|
||||
|
||||
reason_code_id = fields.Many2one(
|
||||
comodel_name="scrap.reason.code",
|
||||
states={"done": [("readonly", True)]},
|
||||
domain="[('id', 'in', allowed_reason_code_ids)]",
|
||||
)
|
||||
allowed_reason_code_ids = fields.Many2many(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -106,17 +106,17 @@ class StockScrap(TransactionCase):
|
||||
scrapped_move = picking.move_ids.filtered(lambda m: m.state == "done")
|
||||
self.assertTrue(scrapped_move, "No scrapped move created.")
|
||||
self.assertEqual(
|
||||
scrapped_move.scrap_ids.ids, [scrap.id], "Wrong scrap linked to the move."
|
||||
scrapped_move.scrap_id.id, scrap.id, "Wrong scrap linked to the move."
|
||||
)
|
||||
self.assertEqual(
|
||||
scrap.scrap_qty,
|
||||
5,
|
||||
"Scrap quantity has been modified and is not " "correct anymore.",
|
||||
)
|
||||
move = scrap.move_id
|
||||
self.assertEqual(move.reason_code_id.id, self.reason_code.id)
|
||||
moves = scrap.move_ids
|
||||
self.assertEqual(moves.mapped("reason_code_id.id"), [self.reason_code.id])
|
||||
|
||||
scrapped_move.quantity_done = 8
|
||||
scrapped_move.quantity = 8
|
||||
self.assertEqual(scrap.scrap_qty, 8, "Scrap quantity is not updated.")
|
||||
|
||||
def test_scrap_reason_code_write(self):
|
||||
@@ -170,17 +170,17 @@ class StockScrap(TransactionCase):
|
||||
scrapped_move = picking2.move_ids.filtered(lambda m: m.state == "done")
|
||||
self.assertTrue(scrapped_move, "No scrapped move created.")
|
||||
self.assertEqual(
|
||||
scrapped_move.scrap_ids.ids, [scrap2.id], "Wrong scrap linked to the move."
|
||||
scrapped_move.scrap_id.id, scrap2.id, "Wrong scrap linked to the move."
|
||||
)
|
||||
self.assertEqual(
|
||||
scrap2.scrap_qty,
|
||||
5,
|
||||
"Scrap quantity has been modified and is not " "correct anymore.",
|
||||
)
|
||||
move = scrap2.move_id
|
||||
self.assertEqual(move.reason_code_id.id, self.reason_code.id)
|
||||
moves = scrap2.move_ids
|
||||
self.assertEqual(moves.mapped("reason_code_id.id"), [self.reason_code.id])
|
||||
|
||||
scrapped_move.quantity_done = 8
|
||||
scrapped_move.quantity = 8
|
||||
self.assertEqual(scrap2.scrap_qty, 8, "Scrap quantity is not updated.")
|
||||
|
||||
def test_allowed_reason_codes(self):
|
||||
|
||||
@@ -8,10 +8,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@name='origin_grp']" position='after'>
|
||||
<field name="scrapped" invisible="1" />
|
||||
<group
|
||||
string="Reason Code"
|
||||
attrs="{'invisible': [('scrapped', '!=', True)]}"
|
||||
>
|
||||
<group string="Reason Code" invisible="not scrapped">
|
||||
<field name="reason_code_id" />
|
||||
</group>
|
||||
</xpath>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<field name="inherit_id" ref="stock.stock_scrap_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group/group" position='inside'>
|
||||
<field name="reason_code_id" />
|
||||
<field name="allowed_reason_code_ids" invisible="1" />
|
||||
<field name="reason_code_id" readonly="state == 'done'" />
|
||||
<field name="allowed_reason_code_ids" invisible="True" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -19,8 +19,8 @@
|
||||
<field name="inherit_id" ref="stock.stock_scrap_tree_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='product_uom_id']" position='after'>
|
||||
<field name="reason_code_id" />
|
||||
<field name="allowed_reason_code_ids" invisible="1" />
|
||||
<field name="reason_code_id" readonly="state == 'done'" />
|
||||
<field name="allowed_reason_code_ids" invisible="True" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -30,8 +30,8 @@
|
||||
<field name="inherit_id" ref="stock.stock_scrap_form_view2" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group/group" position='inside'>
|
||||
<field name="reason_code_id" />
|
||||
<field name="allowed_reason_code_ids" invisible="1" />
|
||||
<field name="reason_code_id" readonly="state == 'done'" />
|
||||
<field name="allowed_reason_code_ids" invisible="True" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user