mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[MIG] rma: to Odoo 15.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Hibou RMAs',
|
'name': 'Hibou RMAs',
|
||||||
'version': '14.0.1.0.1',
|
'version': '15.0.1.0.0',
|
||||||
'category': 'Warehouse',
|
'category': 'Warehouse',
|
||||||
'author': 'Hibou Corp.',
|
'author': 'Hibou Corp.',
|
||||||
'license': 'OPL-1',
|
'license': 'OPL-1',
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ class RMATemplate(models.Model):
|
|||||||
'product_uom': l.product_uom_id.id,
|
'product_uom': l.product_uom_id.id,
|
||||||
'procure_method': self.in_procure_method,
|
'procure_method': self.in_procure_method,
|
||||||
'to_refund': self.in_to_refund,
|
'to_refund': self.in_to_refund,
|
||||||
|
'location_id': self.in_location_id.id,
|
||||||
|
'location_dest_id': self.in_location_dest_id.id,
|
||||||
}) for l in rma.lines.filtered(lambda l: l.product_id.type != 'service')],
|
}) for l in rma.lines.filtered(lambda l: l.product_id.type != 'service')],
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +142,8 @@ class RMATemplate(models.Model):
|
|||||||
'product_uom': l.product_uom_id.id,
|
'product_uom': l.product_uom_id.id,
|
||||||
'procure_method': self.out_procure_method,
|
'procure_method': self.out_procure_method,
|
||||||
'to_refund': self.out_to_refund,
|
'to_refund': self.out_to_refund,
|
||||||
|
'location_id': self.out_location_id.id,
|
||||||
|
'location_dest_id': self.out_location_dest_id.id,
|
||||||
}) for l in rma.lines.filtered(lambda l: l.product_id.type != 'service')],
|
}) for l in rma.lines.filtered(lambda l: l.product_id.type != 'service')],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,15 +80,11 @@ class TestRMA(common.TransactionCase):
|
|||||||
location = self.env.ref('stock.stock_location_stock')
|
location = self.env.ref('stock.stock_location_stock')
|
||||||
location_customer = self.env.ref('stock.stock_location_customers')
|
location_customer = self.env.ref('stock.stock_location_customers')
|
||||||
|
|
||||||
adj = self.env['stock.inventory'].create({
|
adjust_to_zero_quant = self.env['stock.quant'].with_context(inventory_mode=True).create({
|
||||||
'name': 'Adjust Out',
|
'product_id': self.product1.id,
|
||||||
'product_ids': [(4, self.product1.id)],
|
'location_id': location.id,
|
||||||
})
|
'inventory_quantity': 0.0
|
||||||
adj.action_start()
|
}).action_apply_inventory()
|
||||||
adj.line_ids.write({
|
|
||||||
'product_qty': 0.0,
|
|
||||||
})
|
|
||||||
adj.action_validate()
|
|
||||||
|
|
||||||
# No Quants after moving inventory out (quant exists with qty == 0 in Odoo 14)
|
# No Quants after moving inventory out (quant exists with qty == 0 in Odoo 14)
|
||||||
quant = self.env['stock.quant'].search([('product_id', '=', self.product1.id),
|
quant = self.env['stock.quant'].search([('product_id', '=', self.product1.id),
|
||||||
@@ -106,22 +102,13 @@ class TestRMA(common.TransactionCase):
|
|||||||
'product_uom_id': self.product1.uom_id.id,
|
'product_uom_id': self.product1.uom_id.id,
|
||||||
'company_id': self.env.user.company_id.id,
|
'company_id': self.env.user.company_id.id,
|
||||||
})
|
})
|
||||||
adj = self.env['stock.inventory'].create({
|
|
||||||
'name': 'Initial',
|
adjust_to_zero_quant = self.env['stock.quant'].with_context(inventory_mode=True).create({
|
||||||
'product_ids': [(4, self.product1.id)],
|
'product_id': self.product1.id,
|
||||||
})
|
'location_id': self.env.ref('stock.warehouse0').lot_stock_id.id,
|
||||||
adj.action_start()
|
'inventory_quantity': 1.0,
|
||||||
if not adj.line_ids:
|
'lot_id': lot.id,
|
||||||
_ = self.env['stock.inventory.line'].create({
|
}).action_apply_inventory()
|
||||||
'inventory_id': adj.id,
|
|
||||||
'product_id': self.product1.id,
|
|
||||||
'location_id': self.env.ref('stock.warehouse0').lot_stock_id.id,
|
|
||||||
})
|
|
||||||
adj.line_ids.write({
|
|
||||||
'product_qty': 1.0,
|
|
||||||
'prod_lot_id': lot.id,
|
|
||||||
})
|
|
||||||
adj.action_validate()
|
|
||||||
|
|
||||||
self.assertEqual(self.product1.qty_available, 1.0)
|
self.assertEqual(self.product1.qty_available, 1.0)
|
||||||
self.assertTrue(lot.quant_ids)
|
self.assertTrue(lot.quant_ids)
|
||||||
@@ -189,6 +176,10 @@ class TestRMA(common.TransactionCase):
|
|||||||
pack_opt = rma.in_picking_id.move_line_ids[0]
|
pack_opt = rma.in_picking_id.move_line_ids[0]
|
||||||
self.assertTrue(pack_opt)
|
self.assertTrue(pack_opt)
|
||||||
|
|
||||||
|
# unlink the lot so that we can re-add it later
|
||||||
|
self.assertTrue(pack_opt.lot_id)
|
||||||
|
pack_opt.write({'lot_id': False})
|
||||||
|
|
||||||
# We cannot check this directly anymore. Instead just try to return the same lot and make sure you can.
|
# We cannot check this directly anymore. Instead just try to return the same lot and make sure you can.
|
||||||
# self.assertEqual(pack_opt.lot_id, lot)
|
# self.assertEqual(pack_opt.lot_id, lot)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user