[REF] *stock*: rename model stock.production.lot into stock.lot

Task: 2648449
Part-of: odoo/odoo#80434
This commit is contained in:
William Henrotin
2021-12-07 16:20:05 +00:00
parent 71489e8fb6
commit 6a23b9bcd6
68 changed files with 281 additions and 281 deletions
+4 -4
View File
@@ -489,24 +489,24 @@
<field name="tracking">lot</field>
</record>
<record id="lot_product_27_0" model="stock.production.lot">
<record id="lot_product_27_0" model="stock.lot">
<field name="name">0000000000030</field>
<field name="product_id" ref="product.product_product_27"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="lot_product_27_1" model="stock.production.lot">
<record id="lot_product_27_1" model="stock.lot">
<field name="name">0000000000031</field>
<field name="product_id" ref="product.product_product_27"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="lot_product_product_drawer_drawer_0" model="stock.production.lot">
<record id="lot_product_product_drawer_drawer_0" model="stock.lot">
<field name="name">0000000010001</field>
<field name="product_id" ref="product_product_drawer_drawer"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="lot_product_product_drawer_case_0" model="stock.production.lot">
<record id="lot_product_product_drawer_case_0" model="stock.lot">
<field name="name">0000000020045</field>
<field name="product_id" ref="product_product_drawer_case"/>
<field name="company_id" ref="base.main_company"/>
+1 -1
View File
@@ -15,7 +15,7 @@ from . import res_company
from . import stock_move
from . import stock_orderpoint
from . import stock_picking
from . import stock_production_lot
from . import stock_lot
from . import stock_rule
from . import stock_scrap
from . import stock_warehouse
+5 -5
View File
@@ -105,7 +105,7 @@ class MrpProduction(models.Model):
readonly=True, required=True,
states={'draft': [('readonly', False)]}, domain="[('category_id', '=', product_uom_category_id)]")
lot_producing_id = fields.Many2one(
'stock.production.lot', string='Lot/Serial Number', copy=False,
'stock.lot', string='Lot/Serial Number', copy=False,
domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]", check_company=True)
qty_producing = fields.Float(string="Quantity Producing", digits='Product Unit of Measure', copy=False)
product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id')
@@ -1129,10 +1129,10 @@ class MrpProduction(models.Model):
def action_generate_serial(self):
self.ensure_one()
self.lot_producing_id = self.env['stock.production.lot'].create({
self.lot_producing_id = self.env['stock.lot'].create({
'product_id': self.product_id.id,
'company_id': self.company_id.id,
'name': self.env['stock.production.lot']._get_next_serial(self.company_id, self.product_id) or self.env['ir.sequence'].next_by_code('stock.lot.serial'),
'name': self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env['ir.sequence'].next_by_code('stock.lot.serial'),
})
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id
@@ -1743,7 +1743,7 @@ class MrpProduction(models.Model):
message += "\n".join(component.name for component in multiple_lot_components)
if message:
raise UserError(message)
next_serial = self.env['stock.production.lot']._get_next_serial(self.company_id, self.product_id)
next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
action = self.env["ir.actions.actions"]._for_xml_id("mrp.act_assign_serial_numbers_production")
action['context'] = {
'default_production_id': self.id,
@@ -1945,7 +1945,7 @@ class MrpProduction(models.Model):
backorder.action_confirm()
production.name = self._get_name_backorder(production.name, production.backorder_sequence)
production.product_qty = 1
production.lot_producing_id = self.env['stock.production.lot'].create({
production.lot_producing_id = self.env['stock.lot'].create({
'product_id': production.product_id.id,
'company_id': production.company_id.id,
'name': serial_number,
+1 -1
View File
@@ -49,7 +49,7 @@ class MrpUnbuild(models.Model):
states={'done': [('readonly', True)]}, check_company=True)
mo_bom_id = fields.Many2one('mrp.bom', 'Bill of Material used on the Production Order', related='mo_id.bom_id')
lot_id = fields.Many2one(
'stock.production.lot', 'Lot/Serial Number',
'stock.lot', 'Lot/Serial Number',
domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]", check_company=True,
states={'done': [('readonly', True)]}, help="Lot/Serial Number of the product to unbuild.")
has_tracking=fields.Selection(related='product_id.tracking', readonly=True)
+1 -1
View File
@@ -125,7 +125,7 @@ class MrpWorkorder(models.Model):
'stock.move.line', 'workorder_id', 'Moves to Track',
help="Inventory moves for which you must scan a lot number at this work order")
finished_lot_id = fields.Many2one(
'stock.production.lot', string='Lot/Serial Number', compute='_compute_finished_lot_id',
'stock.lot', string='Lot/Serial Number', compute='_compute_finished_lot_id',
inverse='_set_finished_lot_id', domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]",
check_company=True)
time_ids = fields.One2many(
@@ -5,8 +5,8 @@ from odoo import models, _
from odoo.exceptions import UserError
class StockProductionLot(models.Model):
_inherit = 'stock.production.lot'
class StockLot(models.Model):
_inherit = 'stock.lot'
def _check_create(self):
active_mo_id = self.env.context.get('active_mo_id')
@@ -14,4 +14,4 @@ class StockProductionLot(models.Model):
active_mo = self.env['mrp.production'].browse(active_mo_id)
if not active_mo.picking_type_id.use_create_components_lots:
raise UserError(_('You are not allowed to create or edit a lot or serial number for the components with the operation type "Manufacturing". To change this, go on the operation type and tick the box "Create New Lots/Serial Numbers for Components".'))
return super(StockProductionLot, self)._check_create()
return super()._check_create()
+1 -1
View File
@@ -131,7 +131,7 @@ class StockMove(models.Model):
'Done', compute='_compute_is_done',
store=True,
help='Technical Field to order moves')
order_finished_lot_ids = fields.Many2many('stock.production.lot', string="Finished Lot/Serial Number", compute='_compute_order_finished_lot_ids')
order_finished_lot_ids = fields.Many2many('stock.lot', string="Finished Lot/Serial Number", compute='_compute_order_finished_lot_ids')
should_consume_qty = fields.Float('Quantity To Consume', compute='_compute_should_consume_qty', digits='Product Unit of Measure')
cost_share = fields.Float(
"Cost Share (%)", digits=(5, 2), # decimal = 2 is important for rounding calculations!!
+7 -7
View File
@@ -171,17 +171,17 @@ class TestMrpProductionBackorder(TestMrpCommon):
"""
nb_product_todo = 4
production, _, p_final, p1, p2 = self.generate_mo(qty_final=nb_product_todo, tracking_final='lot', tracking_base_1='lot', tracking_base_2='lot')
lot_final = self.env['stock.production.lot'].create({
lot_final = self.env['stock.lot'].create({
'name': 'lot_final',
'product_id': p_final.id,
'company_id': self.env.company.id,
})
lot_1 = self.env['stock.production.lot'].create({
lot_1 = self.env['stock.lot'].create({
'name': 'lot_consumed_1',
'product_id': p1.id,
'company_id': self.env.company.id,
})
lot_2 = self.env['stock.production.lot'].create({
lot_2 = self.env['stock.lot'].create({
'name': 'lot_consumed_2',
'product_id': p2.id,
'company_id': self.env.company.id,
@@ -229,17 +229,17 @@ class TestMrpProductionBackorder(TestMrpCommon):
production, _, p_final, p1, p2 = self.generate_mo(qty_final=nb_product_todo, tracking_final='serial', tracking_base_1='serial', tracking_base_2='serial', qty_base_1=1)
serials_final, serials_p1, serials_p2 = [], [], []
for i in range(nb_product_todo):
serials_final.append(self.env['stock.production.lot'].create({
serials_final.append(self.env['stock.lot'].create({
'name': f'lot_final_{i}',
'product_id': p_final.id,
'company_id': self.env.company.id,
}))
serials_p1.append(self.env['stock.production.lot'].create({
serials_p1.append(self.env['stock.lot'].create({
'name': f'lot_consumed_1_{i}',
'product_id': p1.id,
'company_id': self.env.company.id,
}))
serials_p2.append(self.env['stock.production.lot'].create({
serials_p2.append(self.env['stock.lot'].create({
'name': f'lot_consumed_2_{i}',
'product_id': p2.id,
'company_id': self.env.company.id,
@@ -304,7 +304,7 @@ class TestMrpProductionBackorder(TestMrpCommon):
immediate_wizard.process()
self.assertEqual(self.env['stock.quant']._get_available_quantity(p_final, self.stock_location), 2, "Incorrect number of final product produced.")
self.assertEqual(len(self.env['stock.production.lot'].search([('product_id', '=', p_final.id)])), 2, "Serial Numbers were not correctly produced.")
self.assertEqual(len(self.env['stock.lot'].search([('product_id', '=', p_final.id)])), 2, "Serial Numbers were not correctly produced.")
def test_backorder_name(self):
def produce_one(mo):
+2 -2
View File
@@ -122,7 +122,7 @@ class TestMrpMulticompany(common.TransactionCase):
component = self.env['product.product'].create({
'name': 'p2',
})
lot_b = self.env['stock.production.lot'].create({
lot_b = self.env['stock.lot'].create({
'product_id': product.id,
'company_id': self.company_b.id,
})
@@ -150,7 +150,7 @@ class TestMrpMulticompany(common.TransactionCase):
'name': 'p2',
'tracking': 'lot',
})
lot_b = self.env['stock.production.lot'].create({
lot_b = self.env['stock.lot'].create({
'product_id': component.id,
'company_id': self.company_b.id,
})
+18 -18
View File
@@ -240,12 +240,12 @@ class TestMrpOrder(TestMrpCommon):
mo, bom, p_final, p1, p2 = self.generate_mo(tracking_base_1='lot')
self.assertEqual(len(mo), 1, 'MO should have been created')
lot_1 = self.env['stock.production.lot'].create({
lot_1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': p1.id,
'company_id': self.env.company.id,
})
lot_2 = self.env['stock.production.lot'].create({
lot_2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': p1.id,
'company_id': self.env.company.id,
@@ -510,12 +510,12 @@ class TestMrpOrder(TestMrpCommon):
mo, bom, p_final, p1, p2 = self.generate_mo(tracking_base_1='serial', qty_base_1=1, qty_final=2)
self.assertEqual(len(mo), 1, 'MO should have been created')
lot_p1_1 = self.env['stock.production.lot'].create({
lot_p1_1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': p1.id,
'company_id': self.env.company.id,
})
lot_p1_2 = self.env['stock.production.lot'].create({
lot_p1_2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': p1.id,
'company_id': self.env.company.id,
@@ -569,18 +569,18 @@ class TestMrpOrder(TestMrpCommon):
mo, _, p_final, p1, p2 = self.generate_mo(tracking_base_1='lot', qty_base_1=10, qty_final=1)
self.assertEqual(len(mo), 1, 'MO should have been created')
first_lot_for_p1 = self.env['stock.production.lot'].create({
first_lot_for_p1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': p1.id,
'company_id': self.env.company.id,
})
second_lot_for_p1 = self.env['stock.production.lot'].create({
second_lot_for_p1 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': p1.id,
'company_id': self.env.company.id,
})
final_product_lot = self.env['stock.production.lot'].create({
final_product_lot = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': p_final.id,
'company_id': self.env.company.id,
@@ -883,12 +883,12 @@ class TestMrpOrder(TestMrpCommon):
'type': 'product',
'tracking': 'serial'
})
self.serial_1 = self.env['stock.production.lot'].create({
self.serial_1 = self.env['stock.lot'].create({
'product_id': self.byproduct1.id,
'name': 'serial 1',
'company_id': self.env.company.id,
})
self.serial_2 = self.env['stock.production.lot'].create({
self.serial_2 = self.env['stock.lot'].create({
'product_id': self.byproduct1.id,
'name': 'serial 2',
'company_id': self.env.company.id,
@@ -899,12 +899,12 @@ class TestMrpOrder(TestMrpCommon):
'type': 'product',
'tracking': 'lot',
})
self.lot_1 = self.env['stock.production.lot'].create({
self.lot_1 = self.env['stock.lot'].create({
'product_id': self.byproduct2.id,
'name': 'Lot 1',
'company_id': self.env.company.id,
})
self.lot_2 = self.env['stock.production.lot'].create({
self.lot_2 = self.env['stock.lot'].create({
'product_id': self.byproduct2.id,
'name': 'Lot 2',
'company_id': self.env.company.id,
@@ -1111,7 +1111,7 @@ class TestMrpOrder(TestMrpCommon):
""" produce a finished product with component tracked by serial number 2
times with the same SN. Check that an error is raised the second time"""
mo1, bom, p_final, p1, p2 = self.generate_mo(tracking_base_2='serial', qty_final=1, qty_base_1=1,)
sn = self.env['stock.production.lot'].create({
sn = self.env['stock.lot'].create({
'name': 'sn used twice',
'product_id': p2.id,
'company_id': self.env.company.id,
@@ -1167,7 +1167,7 @@ class TestMrpOrder(TestMrpCommon):
mo = mo_form.save()
mo.action_confirm()
sn = self.env['stock.production.lot'].create({
sn = self.env['stock.lot'].create({
'name': 'sn used twice',
'product_id': byproduct.id,
'company_id': self.env.company.id,
@@ -1205,7 +1205,7 @@ class TestMrpOrder(TestMrpCommon):
""" Consuming the same serial number two times should not give an error if
a repair order of the first production has been made before the second one"""
mo1, bom, p_final, p1, p2 = self.generate_mo(tracking_base_2='serial', qty_final=1, qty_base_1=1,)
sn = self.env['stock.production.lot'].create({
sn = self.env['stock.lot'].create({
'name': 'sn used twice',
'product_id': p2.id,
'company_id': self.env.company.id,
@@ -1350,7 +1350,7 @@ class TestMrpOrder(TestMrpCommon):
mo_form.product_qty = 1
mo = mo_form.save()
final_product_lot = self.env['stock.production.lot'].create({
final_product_lot = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': plastic_laminate.id,
'company_id': self.env.company.id,
@@ -1740,13 +1740,13 @@ class TestMrpOrder(TestMrpCommon):
})
# the products are tracked by lot, so we go through _generate_consumed_move_line
lot_final = self.env['stock.production.lot'].create({
self.env['stock.lot'].create({
'name': 'Lot Final',
'product_id': product_final.id,
'company_id': self.env.company.id,
})
lot_comp = self.env['stock.production.lot'].create({
lot_comp = self.env['stock.lot'].create({
'name': 'Lot Component',
'product_id': product_comp.id,
'company_id': self.env.company.id,
@@ -1803,7 +1803,7 @@ class TestMrpOrder(TestMrpCommon):
mo, _, p_final, _, _ = self.generate_mo(tracking_final='serial', qty_base_1=1, qty_final=1)
self.assertEqual(len(mo), 1, 'MO should have been created')
sn1 = self.env['stock.production.lot'].create({
sn1 = self.env['stock.lot'].create({
'name': 'serial1',
'product_id': p_final.id,
'company_id': self.env.company.id,
+3 -3
View File
@@ -96,12 +96,12 @@ class TestWarehouseMrp(common.TestMrpCommon):
self.bom_3.bom_line_ids.filtered(lambda x: x.product_id == self.product_5).unlink()
# Create Inventory Adjustment For Stick and Stone Tools with lot.
lot_product_4 = self.env['stock.production.lot'].create({
lot_product_4 = self.env['stock.lot'].create({
'name': '0000000000001',
'product_id': self.product_4.id,
'company_id': self.env.company.id,
})
lot_product_2 = self.env['stock.production.lot'].create({
lot_product_2 = self.env['stock.lot'].create({
'name': '0000000000002',
'product_id': self.product_2.id,
'company_id': self.env.company.id,
@@ -159,7 +159,7 @@ class TestWarehouseMrp(common.TestMrpCommon):
"""
self.laptop.tracking = 'serial'
mo_laptop = self.new_mo_laptop()
serial = self.env['stock.production.lot'].create({'product_id': self.laptop.id, 'company_id': self.env.company.id})
serial = self.env['stock.lot'].create({'product_id': self.laptop.id, 'company_id': self.env.company.id})
mo_form = Form(mo_laptop)
mo_form.qty_producing = 1
+12 -12
View File
@@ -24,7 +24,7 @@ class TestTraceability(TestMrpCommon):
consumed_lot = self._create_product('lot')
consumed_serial = self._create_product('serial')
stock_id = self.env.ref('stock.stock_location_stock').id
Lot = self.env['stock.production.lot']
Lot = self.env['stock.lot']
# create inventory
quants = self.env['stock.quant'].create({
'location_id': stock_id,
@@ -84,7 +84,7 @@ class TestTraceability(TestMrpCommon):
mo_form = Form(mo)
mo_form.qty_producing = 1
if finished_product.tracking != 'none':
mo_form.lot_producing_id = self.env['stock.production.lot'].create({'name': 'Serial or Lot finished', 'product_id': finished_product.id, 'company_id': self.env.company.id})
mo_form.lot_producing_id = self.env['stock.lot'].create({'name': 'Serial or Lot finished', 'product_id': finished_product.id, 'company_id': self.env.company.id})
mo = mo_form.save()
details_operation_form = Form(mo.move_raw_ids[1], view=self.env.ref('stock.view_stock_move_operations'))
@@ -178,7 +178,7 @@ class TestTraceability(TestMrpCommon):
mo.action_confirm()
mo_form = Form(mo)
mo_form.lot_producing_id = self.env['stock.production.lot'].create({
mo_form.lot_producing_id = self.env['stock.lot'].create({
'product_id': product_final.id,
'name': 'Final_lot_1',
'company_id': self.env.company.id,
@@ -187,7 +187,7 @@ class TestTraceability(TestMrpCommon):
details_operation_form = Form(mo.move_raw_ids[0], view=self.env.ref('stock.view_stock_move_operations'))
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': product_1.id,
'name': 'Raw_1_lot_1',
'company_id': self.env.company.id,
@@ -196,7 +196,7 @@ class TestTraceability(TestMrpCommon):
details_operation_form.save()
details_operation_form = Form(mo.move_raw_ids[1], view=self.env.ref('stock.view_stock_move_operations'))
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': product_2.id,
'name': 'Raw_2_lot_1',
'company_id': self.env.company.id,
@@ -208,7 +208,7 @@ class TestTraceability(TestMrpCommon):
view=self.env.ref('stock.view_stock_move_operations')
)
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': byproduct_1.id,
'name': 'Byproduct_1_lot_1',
'company_id': self.env.company.id,
@@ -220,7 +220,7 @@ class TestTraceability(TestMrpCommon):
view=self.env.ref('stock.view_stock_move_operations')
)
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': byproduct_2.id,
'name': 'Byproduct_2_lot_1',
'company_id': self.env.company.id,
@@ -233,7 +233,7 @@ class TestTraceability(TestMrpCommon):
backorder.save().action_backorder()
mo_backorder = mo.procurement_group_id.mrp_production_ids[-1]
mo_form = Form(mo_backorder)
mo_form.lot_producing_id = self.env['stock.production.lot'].create({
mo_form.lot_producing_id = self.env['stock.lot'].create({
'product_id': product_final.id,
'name': 'Final_lot_2',
'company_id': self.env.company.id,
@@ -246,7 +246,7 @@ class TestTraceability(TestMrpCommon):
view=self.env.ref('stock.view_stock_move_operations')
)
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': product_1.id,
'name': 'Raw_1_lot_2',
'company_id': self.env.company.id,
@@ -258,7 +258,7 @@ class TestTraceability(TestMrpCommon):
view=self.env.ref('stock.view_stock_move_operations')
)
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': product_2.id,
'name': 'Raw_2_lot_2',
'company_id': self.env.company.id,
@@ -270,7 +270,7 @@ class TestTraceability(TestMrpCommon):
view=self.env.ref('stock.view_stock_move_operations')
)
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': byproduct_1.id,
'name': 'Byproduct_1_lot_2',
'company_id': self.env.company.id,
@@ -282,7 +282,7 @@ class TestTraceability(TestMrpCommon):
view=self.env.ref('stock.view_stock_move_operations')
)
with details_operation_form.move_line_ids.new() as ml:
ml.lot_id = self.env['stock.production.lot'].create({
ml.lot_id = self.env['stock.lot'].create({
'product_id': byproduct_2.id,
'name': 'Byproduct_2_lot_2',
'company_id': self.env.company.id,
+12 -12
View File
@@ -84,7 +84,7 @@ class TestUnbuild(TestMrpCommon):
mo, bom, p_final, p1, p2 = self.generate_mo(tracking_final='lot')
self.assertEqual(len(mo), 1, 'MO should have been created')
lot = self.env['stock.production.lot'].create({
lot = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': p_final.id,
'company_id': self.env.company.id,
@@ -161,7 +161,7 @@ class TestUnbuild(TestMrpCommon):
mo, bom, p_final, p1, p2 = self.generate_mo(tracking_base_1='lot')
self.assertEqual(len(mo), 1, 'MO should have been created')
lot = self.env['stock.production.lot'].create({
lot = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': p1.id,
'company_id': self.env.company.id,
@@ -245,17 +245,17 @@ class TestUnbuild(TestMrpCommon):
mo, bom, p_final, p1, p2 = self.generate_mo(tracking_final='lot', tracking_base_2='lot', tracking_base_1='lot')
self.assertEqual(len(mo), 1, 'MO should have been created')
lot_final = self.env['stock.production.lot'].create({
lot_final = self.env['stock.lot'].create({
'name': 'lot_final',
'product_id': p_final.id,
'company_id': self.env.company.id,
})
lot_1 = self.env['stock.production.lot'].create({
lot_1 = self.env['stock.lot'].create({
'name': 'lot_consumed_1',
'product_id': p1.id,
'company_id': self.env.company.id,
})
lot_2 = self.env['stock.production.lot'].create({
lot_2 = self.env['stock.lot'].create({
'name': 'lot_consumed_2',
'product_id': p2.id,
'company_id': self.env.company.id,
@@ -357,17 +357,17 @@ class TestUnbuild(TestMrpCommon):
mo, bom, p_final, p1, p2 = self.generate_mo(tracking_final='none', tracking_base_2='lot', tracking_base_1='none')
self.assertEqual(len(mo), 1, 'MO should have been created')
lot_1 = self.env['stock.production.lot'].create({
lot_1 = self.env['stock.lot'].create({
'name': 'lot_1',
'product_id': p2.id,
'company_id': self.env.company.id,
})
lot_2 = self.env['stock.production.lot'].create({
lot_2 = self.env['stock.lot'].create({
'name': 'lot_2',
'product_id': p2.id,
'company_id': self.env.company.id,
})
lot_3 = self.env['stock.production.lot'].create({
lot_3 = self.env['stock.lot'].create({
'name': 'lot_3',
'product_id': p2.id,
'company_id': self.env.company.id,
@@ -419,14 +419,14 @@ class TestUnbuild(TestMrpCommon):
# Young Tom
# \ Botox - 4 - p1
# \ Old Tom - 1 - p2
lot_1 = self.env['stock.production.lot'].create({
lot_1 = self.env['stock.lot'].create({
'name': 'lot_1',
'product_id': p2.id,
'company_id': self.env.company.id,
})
self.env['stock.quant']._update_available_quantity(p2, self.stock_location, 3, lot_id=lot_1)
lot_finished_1 = self.env['stock.production.lot'].create({
lot_finished_1 = self.env['stock.lot'].create({
'name': 'lot_finished_1',
'product_id': p_final.id,
'company_id': self.env.company.id,
@@ -447,14 +447,14 @@ class TestUnbuild(TestMrpCommon):
backorder = Form(self.env[action['res_model']].with_context(**action['context']))
backorder.save().action_backorder()
lot_2 = self.env['stock.production.lot'].create({
lot_2 = self.env['stock.lot'].create({
'name': 'lot_2',
'product_id': p2.id,
'company_id': self.env.company.id,
})
self.env['stock.quant']._update_available_quantity(p2, self.stock_location, 4, lot_id=lot_2)
lot_finished_2 = self.env['stock.production.lot'].create({
lot_finished_2 = self.env['stock.lot'].create({
'name': 'lot_finished_2',
'product_id': p_final.id,
'company_id': self.env.company.id,
@@ -19,7 +19,7 @@ class StockAssignSerialNumbers(models.TransientModel):
def generate_serial_numbers_production(self):
if self.next_serial_number and self.next_serial_count:
generated_serial_numbers = "\n".join(self.env['stock.production.lot'].generate_lot_names(self.next_serial_number, self.next_serial_count))
generated_serial_numbers = "\n".join(self.env['stock.lot'].generate_lot_names(self.next_serial_number, self.next_serial_count))
self.serial_numbers = "\n".join([self.serial_numbers, generated_serial_numbers]) if self.serial_numbers else generated_serial_numbers
self._onchange_serial_numbers()
action = self.env["ir.actions.actions"]._for_xml_id("mrp.act_assign_serial_numbers_production")
@@ -41,7 +41,7 @@ class StockAssignSerialNumbers(models.TransientModel):
self.serial_numbers = ""
self.produced_qty = 0
raise UserError(_('Duplicate Serial Numbers (%s)') % ','.join(duplicate_serial_numbers))
existing_serial_numbers = self.env['stock.production.lot'].search([
existing_serial_numbers = self.env['stock.lot'].search([
('company_id', '=', self.production_id.company_id.id),
('product_id', '=', self.production_id.product_id.id),
('name', 'in', serial_numbers),
@@ -7,11 +7,11 @@ from odoo.tests.common import Form
from odoo.exceptions import UserError
class TestStockProductionLot(TestStockCommon):
class TestStockLot(TestStockCommon):
@classmethod
def setUpClass(cls):
super(TestStockProductionLot, cls).setUpClass()
super().setUpClass()
# Creates a tracked product using expiration dates.
cls.product_apple = cls.ProductObj.create({
'name': 'Apple',
+3 -3
View File
@@ -16,7 +16,7 @@ class TestRepairTraceability(TestMrpCommon):
'name': 'product first serial to act repair',
'tracking': 'serial',
})
ptrepair_lot = self.env['stock.production.lot'].create({
ptrepair_lot = self.env['stock.lot'].create({
'name': 'A1',
'product_id': product_to_repair.id,
'company_id': self.env.user.company_id.id
@@ -25,7 +25,7 @@ class TestRepairTraceability(TestMrpCommon):
'name': 'other first serial to remove with repair',
'tracking': 'serial',
})
ptremove_lot = self.env['stock.production.lot'].create({
ptremove_lot = self.env['stock.lot'].create({
'name': 'B2',
'product_id': product_to_remove.id,
'company_id': self.env.user.company_id.id
@@ -65,7 +65,7 @@ class TestRepairTraceability(TestMrpCommon):
mo2 = mo2_form.save()
mo2.action_confirm()
# Set serial to A2
mo2.lot_producing_id = self.env['stock.production.lot'].create({
mo2.lot_producing_id = self.env['stock.lot'].create({
'name': 'A2',
'product_id': product_to_repair.id,
'company_id': self.env.user.company_id.id
@@ -679,12 +679,12 @@ class TestSubcontractingTracking(TransactionCase):
self.assertEqual(len(picking), 1)
self.assertEqual(picking.picking_type_id, wh.subcontracting_resupply_type_id)
lot_id = self.env['stock.production.lot'].create({
lot_id = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.finished_product.id,
'company_id': self.env.company.id,
})
serial_id = self.env['stock.production.lot'].create({
serial_id = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.comp1_sn.id,
'company_id': self.env.company.id,
@@ -787,7 +787,7 @@ class TestSubcontractingTracking(TransactionCase):
self.assertEqual(mo.picking_type_id, wh.subcontracting_type_id)
self.assertFalse(mo.picking_type_id.active)
lot_comp2 = self.env['stock.production.lot'].create({
lot_comp2 = self.env['stock.lot'].create({
'name': 'lot_comp2',
'product_id': self.comp2.id,
'company_id': self.env.company.id,
@@ -795,12 +795,12 @@ class TestSubcontractingTracking(TransactionCase):
serials_finished = []
serials_comp1 = []
for i in range(todo_nb):
serials_finished.append(self.env['stock.production.lot'].create({
serials_finished.append(self.env['stock.lot'].create({
'name': 'serial_fin_%s' % i,
'product_id': self.finished_product.id,
'company_id': self.env.company.id,
}))
serials_comp1.append(self.env['stock.production.lot'].create({
serials_comp1.append(self.env['stock.lot'].create({
'name': 'serials_comp1_%s' % i,
'product_id': self.comp1_sn.id,
'company_id': self.env.company.id,
@@ -861,7 +861,7 @@ class TestSubcontractingTracking(TransactionCase):
bom_line.product_qty = 1
bom = bom_form.save()
finished_lot, component_lot = self.env['stock.production.lot'].create([{
finished_lot, component_lot = self.env['stock.lot'].create([{
'name': 'lot_%s' % product.name,
'product_id': product.id,
'company_id': self.env.company.id,
@@ -115,7 +115,7 @@ class TestAccountSubcontractingFlows(TestMrpSubcontractingCommon):
# We should be able to call the 'record_components' button
self.assertTrue(picking_receipt.display_action_record_components)
lot_comp2 = self.env['stock.production.lot'].create({
lot_comp2 = self.env['stock.lot'].create({
'name': 'lot_comp2',
'product_id': self.comp2.id,
'company_id': self.env.company.id,
@@ -123,12 +123,12 @@ class TestAccountSubcontractingFlows(TestMrpSubcontractingCommon):
serials_finished = []
serials_comp1 = []
for i in range(todo_nb):
serials_finished.append(self.env['stock.production.lot'].create({
serials_finished.append(self.env['stock.lot'].create({
'name': 'serial_fin_%s' % i,
'product_id': self.finished.id,
'company_id': self.env.company.id,
}))
serials_comp1.append(self.env['stock.production.lot'].create({
serials_comp1.append(self.env['stock.lot'].create({
'name': 'serials_comp1_%s' % i,
'product_id': self.comp1.id,
'company_id': self.env.company.id,
+1 -1
View File
@@ -821,7 +821,7 @@ class PosOrder(models.Model):
'lines': [[0, 0, line] for line in order.lines.export_for_ui()],
'statement_ids': [[0, 0, payment] for payment in order.payment_ids.export_for_ui()],
'name': order.pos_reference,
'uid': re.search('([0-9]|-){14}', order.pos_reference).group(0),
'uid': re.search('([0-9-] r){14}', order.pos_reference).group(0),
'amount_paid': order.amount_paid,
'amount_total': order.amount_total,
'amount_tax': order.amount_tax,
+2 -2
View File
@@ -106,13 +106,13 @@ class StockPicking(models.Model):
ml_vals = move._prepare_move_line_vals()
ml_vals.update({'qty_done':qty})
if self.picking_type_id.use_existing_lots:
existing_lot = self.env['stock.production.lot'].search([
existing_lot = self.env['stock.lot'].search([
('company_id', '=', self.company_id.id),
('product_id', '=', line.product_id.id),
('name', '=', lot.lot_name)
])
if not existing_lot and self.picking_type_id.use_create_lots:
existing_lot = self.env['stock.production.lot'].create({
existing_lot = self.env['stock.lot'].create({
'company_id': self.company_id.id,
'product_id': line.product_id.id,
'name': lot.lot_name,
@@ -101,12 +101,12 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon):
'categ_id': self.env.ref('product.product_category_all').id,
})
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': '1001',
'product_id': self.product2.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': '1002',
'product_id': self.product2.id,
'company_id': self.env.company.id,
@@ -416,7 +416,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon):
'usage': 'internal',
'location_id': wh_location.id,
})
lot = self.env['stock.production.lot'].create({
lot = self.env['stock.lot'].create({
'name': 'SuperLot',
'product_id': tracked_product.id,
'company_id': self.env.company.id,
@@ -7,7 +7,7 @@
<record id="mail_activity_type_alert_date_reached" model="mail.activity.type">
<field name="name">Alert Date Reached</field>
<field name="category">default</field>
<field name="res_model">stock.production.lot</field>
<field name="res_model">stock.lot</field>
<field name="icon">fa-tasks</field>
<field name="delay_count">0</field>
</record>
@@ -4,8 +4,8 @@ import datetime
from odoo import api, fields, models, SUPERUSER_ID, _
class StockProductionLot(models.Model):
_inherit = 'stock.production.lot'
class StockLot(models.Model):
_inherit = 'stock.lot'
use_expiration_date = fields.Boolean(
string='Use Expiration Date', related='product_id.use_expiration_date')
@@ -82,7 +82,7 @@ class StockProductionLot(models.Model):
No further activity will be generated on lots whose alert_date
has already been reached (even if the alert_date is changed).
"""
alert_lots = self.env['stock.production.lot'].search([
alert_lots = self.env['stock.lot'].search([
('alert_date', '<=', fields.Date.today()),
('product_expiry_reminded', '=', False)])
@@ -129,6 +129,6 @@ class ProcurementGroup(models.Model):
@api.model
def _run_scheduler_tasks(self, use_new_cursor=False, company_id=False):
super(ProcurementGroup, self)._run_scheduler_tasks(use_new_cursor=use_new_cursor, company_id=company_id)
self.env['stock.production.lot']._alert_date_exceeded()
self.env['stock.lot']._alert_date_exceeded()
if use_new_cursor:
self.env.cr.commit()
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_stock_production_lot
from . import test_stock_lot
@@ -10,11 +10,11 @@ from odoo.addons.stock.tests.common import TestStockCommon
from odoo.tests.common import Form
class TestStockProductionLot(TestStockCommon):
class TestStockLot(TestStockCommon):
@classmethod
def setUpClass(cls):
super(TestStockProductionLot, cls).setUpClass()
super().setUpClass()
# Creates a tracked product with expiration dates.
cls.apple_product = cls.ProductObj.create({
'name': 'Apple',
@@ -30,7 +30,7 @@ class TestStockProductionLot(TestStockCommon):
def test_00_stock_production_lot(self):
""" Test Scheduled Task on lot with an alert_date in the past creates an activity """
# create product
# create product
self.productAAA = self.ProductObj.create({
'name': 'Product AAA',
'type': 'product',
@@ -61,7 +61,7 @@ class TestStockProductionLot(TestStockCommon):
'location_id': self.supplier_location,
'location_dest_id': self.stock_location
})
self.assertEqual(picking_in.move_ids.state, 'draft', 'Wrong state of move line.')
picking_in.action_confirm()
self.assertEqual(picking_in.move_ids.state, 'assigned', 'Wrong state of move line.')
@@ -75,24 +75,24 @@ class TestStockProductionLot(TestStockCommon):
picking_in._action_done()
# run scheduled tasks
self.env['stock.production.lot']._alert_date_exceeded()
self.env['stock.lot']._alert_date_exceeded()
# check a new activity has been created
activity_id = self.env.ref('product_expiry.mail_activity_type_alert_date_reached').id
activity_count = self.env['mail.activity'].search_count([
('activity_type_id', '=', activity_id),
('res_model_id', '=', self.env.ref('stock.model_stock_production_lot').id),
('res_model_id', '=', self.env.ref('stock.model_stock_lot').id),
('res_id', '=', self.lot1_productAAA.id)
])
self.assertEqual(activity_count, 1, 'No activity created while there should be one')
# run the scheduler a second time
self.env['stock.production.lot']._alert_date_exceeded()
self.env['stock.lot']._alert_date_exceeded()
# check there is still only one activity, no additional activity is created if there is already an existing activity
activity_count = self.env['mail.activity'].search_count([
('activity_type_id', '=', activity_id),
('res_model_id', '=', self.env.ref('stock.model_stock_production_lot').id),
('res_model_id', '=', self.env.ref('stock.model_stock_lot').id),
('res_id', '=', self.lot1_productAAA.id)
])
self.assertEqual(activity_count, 1, 'There should be one and only one activity')
@@ -100,7 +100,7 @@ class TestStockProductionLot(TestStockCommon):
# mark the activity as done
mail_activity = self.env['mail.activity'].search([
('activity_type_id', '=', activity_id),
('res_model_id', '=', self.env.ref('stock.model_stock_production_lot').id),
('res_model_id', '=', self.env.ref('stock.model_stock_lot').id),
('res_id', '=', self.lot1_productAAA.id)
])
mail_activity.action_done()
@@ -108,18 +108,18 @@ class TestStockProductionLot(TestStockCommon):
# check there is no more activity (because it is already done)
activity_count = self.env['mail.activity'].search_count([
('activity_type_id', '=', activity_id),
('res_model_id', '=', self.env.ref('stock.model_stock_production_lot').id),
('res_model_id', '=', self.env.ref('stock.model_stock_lot').id),
('res_id', '=', self.lot1_productAAA.id)
])
self.assertEqual(activity_count, 0,"As activity is done, there shouldn't be any related activity")
# run the scheduler a third time
self.env['stock.production.lot']._alert_date_exceeded()
self.env['stock.lot']._alert_date_exceeded()
# check there is no activity created
activity_count = self.env['mail.activity'].search_count([
('activity_type_id', '=', activity_id),
('res_model_id', '=', self.env.ref('stock.model_stock_production_lot').id),
('res_model_id', '=', self.env.ref('stock.model_stock_lot').id),
('res_id', '=',self.lot1_productAAA.id)
])
self.assertEqual(activity_count, 0, "As there is already an activity marked as done, there shouldn't be any related activity created for this lot")
@@ -127,9 +127,9 @@ class TestStockProductionLot(TestStockCommon):
def test_01_stock_production_lot(self):
""" Test Scheduled Task on lot with an alert_date in future does not create an activity """
# create product
# create product
self.productBBB = self.ProductObj.create({
'name': 'Product BBB',
'name': 'Product BBB',
'type': 'product',
'tracking':'lot'
})
@@ -155,7 +155,7 @@ class TestStockProductionLot(TestStockCommon):
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.assertEqual(picking_in.move_ids.state, 'draft', 'Wrong state of move line.')
picking_in.action_confirm()
self.assertEqual(picking_in.move_ids.state, 'assigned', 'Wrong state of move line.')
@@ -169,13 +169,13 @@ class TestStockProductionLot(TestStockCommon):
picking_in._action_done()
# run scheduled tasks
self.env['stock.production.lot']._alert_date_exceeded()
self.env['stock.lot']._alert_date_exceeded()
# check a new activity has not been created
activity_id = self.env.ref('product_expiry.mail_activity_type_alert_date_reached').id
activity_count = self.env['mail.activity'].search_count([
('activity_type_id', '=', activity_id),
('res_model_id', '=', self.env.ref('stock.model_stock_production_lot').id),
('res_model_id', '=', self.env.ref('stock.model_stock_lot').id),
('res_id', '=', self.lot1_productBBB.id)
])
self.assertEqual(activity_count, 0, "An activity has been created while it shouldn't")
@@ -183,7 +183,7 @@ class TestStockProductionLot(TestStockCommon):
def test_02_stock_production_lot(self):
""" Test Scheduled Task on lot without an alert_date does not create an activity """
# create product
# create product
self.productCCC = self.ProductObj.create({'name': 'Product CCC', 'type': 'product', 'tracking':'lot'})
# create a new lot with with alert date in the past
@@ -202,7 +202,7 @@ class TestStockProductionLot(TestStockCommon):
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.assertEqual(picking_in.move_ids.state, 'draft', 'Wrong state of move line.')
picking_in.action_confirm()
self.assertEqual(picking_in.move_ids.state, 'assigned', 'Wrong state of move line.')
@@ -216,13 +216,13 @@ class TestStockProductionLot(TestStockCommon):
picking_in._action_done()
# run scheduled tasks
self.env['stock.production.lot']._alert_date_exceeded()
self.env['stock.lot']._alert_date_exceeded()
# check a new activity has not been created
activity_id = self.env.ref('product_expiry.mail_activity_type_alert_date_reached').id
activity_count = self.env['mail.activity'].search_count([
('activity_type_id', '=', activity_id),
('res_model_id', '=', self.env.ref('stock.model_stock_production_lot').id),
('res_model_id', '=', self.env.ref('stock.model_stock_lot').id),
('res_id', '=', self.lot1_productCCC.id)
])
self.assertEqual(activity_count, 0, "An activity has been created while it shouldn't")
@@ -302,7 +302,7 @@ class TestStockProductionLot(TestStockCommon):
receipt._action_done()
# Get back the lot created when the picking was done...
apple_lot = self.env['stock.production.lot'].search(
apple_lot = self.env['stock.lot'].search(
[('product_id', '=', self.apple_product.id)],
limit=1,
)
@@ -350,7 +350,7 @@ class TestStockProductionLot(TestStockCommon):
receipt._action_done()
# Get back the lot created when the picking was done...
apple_lot = self.env['stock.production.lot'].search(
apple_lot = self.env['stock.lot'].search(
[('product_id', '=', self.apple_product.id)],
limit=1,
)
@@ -2,7 +2,7 @@
<odoo>
<record id="view_move_form_expiry" model="ir.ui.view">
<field name="name">stock.production.lot.inherit.form</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='description']" position="before">
@@ -29,7 +29,7 @@
<record id="search_product_lot_filter_inherit_product_expiry" model="ir.ui.view">
<field name="name">stock.production.lot.search.inherit</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="inherit_id" ref="stock.search_product_lot_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
@@ -40,7 +40,7 @@
<record id="view_production_lot_view_tree" model="ir.ui.view">
<field name="name">stock.production.lot.tree.inherit.product.expiry</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='create_date']" position="after">
@@ -8,7 +8,7 @@ class ConfirmExpiry(models.TransientModel):
_name = 'expiry.picking.confirmation'
_description = 'Confirm Expiry'
lot_ids = fields.Many2many('stock.production.lot', readonly=True, required=True)
lot_ids = fields.Many2many('stock.lot', readonly=True, required=True)
picking_ids = fields.Many2many('stock.picking', readonly=True)
description = fields.Char('Description', compute='_compute_descriptive_fields')
show_lots = fields.Boolean('Show Lots', compute='_compute_descriptive_fields')
+1 -1
View File
@@ -19,7 +19,7 @@
'views/stock_rule_views.xml',
'views/res_config_settings_views.xml',
'views/res_partner_views.xml',
'views/stock_production_lot_views.xml',
'views/stock_lot_views.xml',
'views/product_category_views.xml',
'report/purchase_report_views.xml',
'report/purchase_report_templates.xml',
+2 -2
View File
@@ -274,8 +274,8 @@ class Orderpoint(models.Model):
return date
class ProductionLot(models.Model):
_inherit = 'stock.production.lot'
class StockLot(models.Model):
_inherit = 'stock.lot'
purchase_order_ids = fields.Many2many('purchase.order', string="Purchase Orders", compute='_compute_purchase_order_ids', readonly=True, store=False)
purchase_order_count = fields.Integer('Purchase order count', compute='_compute_purchase_order_ids')
@@ -2,7 +2,7 @@
<odoo>
<record id="stock_production_lot_view_form" model="ir.ui.view">
<field name="name">stock.production.lot.view.form</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_button_box')]/button" position="before">
+1 -1
View File
@@ -29,7 +29,7 @@ The following topics are covered by this module:
'wizard/stock_warn_insufficient_qty_views.xml',
'views/stock_move_views.xml',
'views/repair_views.xml',
'views/stock_production_lot_views.xml',
'views/stock_lot_views.xml',
'report/repair_reports.xml',
'report/repair_templates_repair_order.xml',
'data/ir_sequence_data.xml',
+1 -1
View File
@@ -3,5 +3,5 @@
from . import repair
from . import stock_traceability
from . import stock_production_lot
from . import stock_lot
from . import account_move
+2 -2
View File
@@ -72,7 +72,7 @@ class Repair(models.Model):
help="This is the location where the product to repair is located.",
states={'draft': [('readonly', False)], 'confirmed': [('readonly', True)]})
lot_id = fields.Many2one(
'stock.production.lot', 'Lot/Serial',
'stock.lot', 'Lot/Serial',
domain="[('product_id','=', product_id), ('company_id', '=', company_id)]", check_company=True,
help="Products repaired are all belonging to this lot")
guarantee_limit = fields.Date('Warranty Expiration', states={'confirmed': [('readonly', True)]})
@@ -655,7 +655,7 @@ class RepairLine(models.Model):
'stock.move', 'Inventory Move',
copy=False, readonly=True)
lot_id = fields.Many2one(
'stock.production.lot', 'Lot/Serial',
'stock.lot', 'Lot/Serial',
domain="[('product_id','=', product_id), ('company_id', '=', company_id)]", check_company=True)
state = fields.Selection([
('draft', 'Draft'),
@@ -3,8 +3,8 @@
from collections import defaultdict
from odoo import api, fields, models, _
class ProductionLot(models.Model):
_inherit = 'stock.production.lot'
class StockLot(models.Model):
_inherit = 'stock.lot'
repair_order_ids = fields.Many2many('repair.order', string="Repair Orders", compute="_compute_repair_order_ids")
repair_order_count = fields.Integer('Repair order count', compute="_compute_repair_order_ids")
@@ -2,7 +2,7 @@
<odoo>
<record id="stock_production_lot_view_form" model="ir.ui.view">
<field name="name">stock.production.lot.view.form</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_button_box')]/button" position="before">
+1 -1
View File
@@ -27,7 +27,7 @@ Preferences
'views/stock_views.xml',
'views/res_config_settings_views.xml',
'views/sale_stock_portal_template.xml',
'views/stock_production_lot_views.xml',
'views/stock_lot_views.xml',
'views/res_users_views.xml',
'report/report_stock_forecasted.xml',
'report/sale_order_report_templates.xml',
+2 -2
View File
@@ -151,8 +151,8 @@ class StockPicking(models.Model):
return super(StockPicking, self)._log_less_quantities_than_expected(moves)
class ProductionLot(models.Model):
_inherit = 'stock.production.lot'
class StockLot(models.Model):
_inherit = 'stock.lot'
sale_order_ids = fields.Many2many('sale.order', string="Sales Orders", compute='_compute_sale_order_ids')
sale_order_count = fields.Integer('Sale order count', compute='_compute_sale_order_ids')
@@ -2,7 +2,7 @@
<odoo>
<record id="stock_production_lot_view_form" model="ir.ui.view">
<field name="name">stock.production.lot.view.form</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_button_box')]/button" position="before">
+1 -1
View File
@@ -69,7 +69,7 @@
'views/res_partner_views.xml',
'views/product_strategy_views.xml',
'views/product_views.xml',
'views/stock_production_lot_views.xml',
'views/stock_lot_views.xml',
'views/stock_scrap_views.xml',
'views/stock_quant_views.xml',
'views/stock_location_views.xml',
+1 -1
View File
@@ -5,7 +5,7 @@
<record id="base.user_demo" model="res.users">
<field eval="[(4, ref('group_stock_user'))]" name="groups_id"/>
</record>
<record id="lot_product_27" model="stock.production.lot">
<record id="lot_product_27" model="stock.lot">
<field name="name">0000000000029</field>
<field name="product_id" ref="product.product_product_27"/>
<field name="company_id" ref="base.main_company"/>
+3 -3
View File
@@ -39,19 +39,19 @@
<field name="image_1920" type="base64" file="stock/static/img/cable_management.png"/>
</record>
<record id="lot_product_cable_management" model="stock.production.lot">
<record id="lot_product_cable_management" model="stock.lot">
<field name="name">LOT-000001</field>
<field name="product_id" ref="stock.product_cable_management_box"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="lot_product_product_cable_management_box_0" model="stock.production.lot">
<record id="lot_product_product_cable_management_box_0" model="stock.lot">
<field name="name">CM-BOX-00001</field>
<field name="product_id" ref="stock.product_cable_management_box"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="lot_product_product_cable_management_box_1" model="stock.production.lot">
<record id="lot_product_product_cable_management_box_1" model="stock.lot">
<field name="name">CM-BOX-00002</field>
<field name="product_id" ref="stock.product_cable_management_box"/>
<field name="company_id" ref="base.main_company"/>
+1 -1
View File
@@ -10,7 +10,7 @@ from . import stock_location
from . import stock_move
from . import stock_move_line
from . import stock_orderpoint
from . import stock_production_lot
from . import stock_lot
from . import stock_picking
from . import stock_quant
from . import stock_rule
+1 -1
View File
@@ -592,7 +592,7 @@ class Product(models.Model):
def _filter_to_unlink(self):
domain = [('product_id', 'in', self.ids)]
lines = self.env['stock.production.lot'].read_group(domain, ['product_id'], ['product_id'])
lines = self.env['stock.lot'].read_group(domain, ['product_id'], ['product_id'])
linked_product_ids = [group['product_id'][0] for group in lines]
return super(Product, self - self.browse(linked_product_ids))._filter_to_unlink()
@@ -9,8 +9,8 @@ from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
class ProductionLot(models.Model):
_name = 'stock.production.lot'
class StockLot(models.Model):
_name = 'stock.lot'
_inherit = ['mail.thread', 'mail.activity.mixin']
_description = 'Lot/Serial'
_check_company_auto = True
@@ -64,11 +64,11 @@ class ProductionLot(models.Model):
def _get_next_serial(self, company, product):
"""Return the next serial number to be attributed to the product."""
if product.tracking == "serial":
last_serial = self.env['stock.production.lot'].search(
last_serial = self.env['stock.lot'].search(
[('company_id', '=', company.id), ('product_id', '=', product.id)],
limit=1, order='id DESC')
if last_serial:
return self.env['stock.production.lot'].generate_lot_names(last_serial.name, 2)[1]
return self.env['stock.lot'].generate_lot_names(last_serial.name, 2)[1]
return False
@api.constrains('name', 'product_id', 'company_id')
@@ -131,7 +131,7 @@ class ProductionLot(models.Model):
@api.model_create_multi
def create(self, vals_list):
self._check_create()
return super(ProductionLot, self.with_context(mail_create_nosubscribe=True)).create(vals_list)
return super(StockLot, self.with_context(mail_create_nosubscribe=True)).create(vals_list)
def write(self, vals):
if 'company_id' in vals:
@@ -146,7 +146,7 @@ class ProductionLot(models.Model):
'if some stock moves have already been created with that number. '
'This would lead to inconsistencies in your stock.'
))
return super(ProductionLot, self).write(vals)
return super().write(vals)
def copy(self, default=None):
if default is None:
+5 -5
View File
@@ -171,7 +171,7 @@ class StockMove(models.Model):
orderpoint_id = fields.Many2one('stock.warehouse.orderpoint', 'Original Reordering Rule', check_company=True, index=True)
forecast_availability = fields.Float('Forecast Availability', compute='_compute_forecast_information', digits='Product Unit of Measure', compute_sudo=True)
forecast_expected_date = fields.Datetime('Forecasted Expected date', compute='_compute_forecast_information', compute_sudo=True)
lot_ids = fields.Many2many('stock.production.lot', compute='_compute_lot_ids', inverse='_set_lot_ids', string='Serial Numbers', readonly=False)
lot_ids = fields.Many2many('stock.lot', compute='_compute_lot_ids', inverse='_set_lot_ids', string='Serial Numbers', readonly=False)
reservation_date = fields.Date('Date to Reserve', compute='_compute_reservation_date', store=True,
help="This is a technical field for calculating when a move should be reserved")
product_packaging_id = fields.Many2one('product.packaging', 'Packaging', domain="[('product_id', '=', product_id)]", check_company=True)
@@ -657,7 +657,7 @@ class StockMove(models.Model):
view = self.env.ref('stock.view_stock_move_nosuggest_operations')
if self.product_id.tracking == "serial" and self.state == "assigned":
self.next_serial = self.env['stock.production.lot']._get_next_serial(self.company_id, self.product_id)
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
return {
'name': _('Detailed Operations'),
@@ -766,7 +766,7 @@ class StockMove(models.Model):
`next_serial`) and create a move line for each generated `lot_name`.
"""
self.ensure_one()
lot_names = self.env['stock.production.lot'].generate_lot_names(self.next_serial, next_serial_count or self.next_serial_count)
lot_names = self.env['stock.lot'].generate_lot_names(self.next_serial, next_serial_count or self.next_serial_count)
move_lines_commands = self._generate_serial_move_line_commands(lot_names)
self.write({'move_line_ids': move_lines_commands})
return True
@@ -993,7 +993,7 @@ class StockMove(models.Model):
self.update({'move_line_ids': move_lines_commands})
else:
self.update({'move_line_nosuggest_ids': move_lines_commands})
existing_lots = self.env['stock.production.lot'].search([
existing_lots = self.env['stock.lot'].search([
('company_id', '=', self.company_id.id),
('product_id', '=', self.product_id.id),
('name', 'in', split_lines),
@@ -1317,7 +1317,7 @@ class StockMove(models.Model):
self.ensure_one()
if not lot_id:
lot_id = self.env['stock.production.lot']
lot_id = self.env['stock.lot']
if not package_id:
package_id = self.env['stock.quant.package']
if not owner_id:
+6 -6
View File
@@ -41,7 +41,7 @@ class StockMoveLine(models.Model):
domain="[('location_id', '=', location_id)]")
package_level_id = fields.Many2one('stock.package_level', 'Package Level', check_company=True)
lot_id = fields.Many2one(
'stock.production.lot', 'Lot/Serial Number',
'stock.lot', 'Lot/Serial Number',
domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]", check_company=True)
lot_name = fields.Char('Lot/Serial Number Name')
result_package_id = fields.Many2one(
@@ -161,7 +161,7 @@ class StockMoveLine(models.Model):
if counter.get(self.lot_name) and counter[self.lot_name] > 1:
message = _('You cannot use the same serial number twice. Please correct the serial numbers encoded.')
elif not self.lot_id:
lots = self.env['stock.production.lot'].search([('product_id', '=', self.product_id.id),
lots = self.env['stock.lot'].search([('product_id', '=', self.product_id.id),
('name', '=', self.lot_name),
('company_id', '=', self.company_id.id)])
quants = lots.quant_ids.filtered(lambda q: q.quantity != 0 and q.location_id.usage in ['customer', 'internal', 'transit'])
@@ -312,7 +312,7 @@ class StockMoveLine(models.Model):
triggers = [
('location_id', 'stock.location'),
('location_dest_id', 'stock.location'),
('lot_id', 'stock.production.lot'),
('lot_id', 'stock.lot'),
('package_id', 'stock.quant.package'),
('result_package_id', 'stock.quant.package'),
('owner_id', 'res.partner'),
@@ -520,7 +520,7 @@ class StockMoveLine(models.Model):
# the fly before assigning it to the move line if the user checked both
# `use_create_lots` and `use_existing_lots`.
if ml.lot_name and not ml.lot_id:
lot = self.env['stock.production.lot'].search([
lot = self.env['stock.lot'].search([
('company_id', '=', ml.company_id.id),
('product_id', '=', ml.product_id.id),
('name', '=', ml.lot_name),
@@ -625,7 +625,7 @@ class StockMoveLine(models.Model):
key_to_index[key] = len(lot_vals)
lot_vals.append(ml._prepare_new_lot_vals())
lots = self.env['stock.production.lot'].create(lot_vals)
lots = self.env['stock.lot'].create(lot_vals)
for key, mls in key_to_mls.items():
mls._assign_production_lot(lots[key_to_index[key]].with_prefetch(lots._ids)) # With prefetch to reconstruct the ones broke by accessing by index
@@ -645,7 +645,7 @@ class StockMoveLine(models.Model):
def _log_message(self, record, move, template, vals):
data = vals.copy()
if 'lot_id' in vals and vals['lot_id'] != move.lot_id.id:
data['lot_name'] = self.env['stock.production.lot'].browse(vals.get('lot_id')).name
data['lot_name'] = self.env['stock.lot'].browse(vals.get('lot_id')).name
if 'location_id' in vals:
data['location_name'] = self.env['stock.location'].browse(vals.get('location_id')).name
if 'location_dest_id' in vals:
+2 -2
View File
@@ -67,7 +67,7 @@ class StockQuant(models.Model):
domain=lambda self: self._domain_location_id(),
auto_join=True, ondelete='restrict', required=True, index=True, check_company=True)
lot_id = fields.Many2one(
'stock.production.lot', 'Lot/Serial Number', index=True,
'stock.lot', 'Lot/Serial Number', index=True,
ondelete='restrict', check_company=True,
domain=lambda self: self._domain_lot_id())
package_id = fields.Many2one(
@@ -185,7 +185,7 @@ class StockQuant(models.Model):
# Create an empty quant or write on a similar one.
product = self.env['product.product'].browse(vals['product_id'])
location = self.env['stock.location'].browse(vals['location_id'])
lot_id = self.env['stock.production.lot'].browse(vals.get('lot_id'))
lot_id = self.env['stock.lot'].browse(vals.get('lot_id'))
package_id = self.env['stock.quant.package'].browse(vals.get('package_id'))
owner_id = self.env['res.partner'].browse(vals.get('owner_id'))
quant = self._gather(product, location, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=True)
+1 -1
View File
@@ -38,7 +38,7 @@ class StockScrap(models.Model):
product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id')
tracking = fields.Selection(string='Product Tracking', readonly=True, related="product_id.tracking")
lot_id = fields.Many2one(
'stock.production.lot', 'Lot/Serial',
'stock.lot', 'Lot/Serial',
states={'done': [('readonly', True)]}, domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]", check_company=True)
package_id = fields.Many2one(
'stock.quant.package', 'Package',
+1 -1
View File
@@ -534,7 +534,7 @@ class StockMove(models.Model):
package_values.append(package_for_picking)
_logger.info("Create lots (%d) for pickings to validate" % len(lot_values))
lots = self.env["stock.production.lot"].create(lot_values)
lots = self.env["stock.lot"].create(lot_values)
_logger.info("Create packages (%d) for pickings to validate" % len(package_values))
packages = self.env["stock.quant.package"].create(package_values)
+4 -4
View File
@@ -61,12 +61,12 @@
</record>
<record id="action_report_lot_label" model="ir.actions.report">
<field name="name">Lot/Serial Number (PDF)</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">stock.report_lot_label</field>
<field name="report_file">stock.report_lot_label</field>
<field name="print_report_name">'Lot-Serial - %s' % object.name</field>
<field name="binding_model_id" ref="model_stock_production_lot"/>
<field name="binding_model_id" ref="model_stock_lot"/>
<field name="binding_type">report</field>
</record>
<record id="action_report_picking_type_label" model="ir.actions.report">
@@ -97,11 +97,11 @@
</record>
<record id="label_lot_template" model="ir.actions.report">
<field name="name">Lot/Serial Number (ZPL)</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="report_type">qweb-text</field>
<field name="report_name">stock.label_lot_template_view</field>
<field name="report_file">stock.label_lot_template_view</field>
<field name="binding_model_id" ref="model_stock_production_lot"/>
<field name="binding_model_id" ref="model_stock_lot"/>
<field name="binding_type">report</field>
</record>
<record id="label_package_template" model="ir.actions.report">
+2 -2
View File
@@ -58,7 +58,7 @@ class MrpStockReport(models.TransientModel):
level = kw and kw['level'] or 1
lines = self.env['stock.move.line']
move_line = self.env['stock.move.line']
if rec_id and model == 'stock.production.lot':
if rec_id and model == 'stock.lot':
lines = move_line.search([
('lot_id', '=', context.get('lot_name') or rec_id),
('state', '=', 'done'),
@@ -184,7 +184,7 @@ class MrpStockReport(models.TransientModel):
lines = self._get_move_lines(move_line, line_id=line_id)
for line in lines:
unfoldable = False
if line.consume_line_ids or ( line.lot_id and self._get_move_lines(line) and model != "stock.production.lot"):
if line.consume_line_ids or (line.lot_id and self._get_move_lines(line) and model != "stock.lot"):
unfoldable = True
final_vals += self._make_dict_move(level, parent_id=line_id, move_line=line, unfoldable=unfoldable)
return final_vals
+1 -1
View File
@@ -10,7 +10,7 @@ access_stock_picking_manager,stock.picking manager,model_stock_picking,stock.gro
access_stock_picking_type_all,stock.picking.type all users,model_stock_picking_type,base.group_user,1,0,0,0
access_stock_picking_type_user,stock.picking.type user,model_stock_picking_type,stock.group_stock_user,1,0,0,0
access_stock_picking_type_manager,stock.picking.type manager,model_stock_picking_type,stock.group_stock_manager,1,1,1,1
access_stock_production_lot_user,stock.production.lot user,model_stock_production_lot,stock.group_stock_user,1,1,1,1
access_stock_lot_user,stock.lot user,model_stock_lot,stock.group_stock_user,1,1,1,1
access_stock_move_manager,stock.move manager,model_stock_move,stock.group_stock_manager,1,1,1,1
access_stock_move_user,stock.move user,model_stock_move,stock.group_stock_user,1,1,1,0
access_product_product_stock_user,product_product_stock_user,product.model_product_product,stock.group_stock_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
10 access_stock_picking_type_all stock.picking.type all users model_stock_picking_type base.group_user 1 0 0 0
11 access_stock_picking_type_user stock.picking.type user model_stock_picking_type stock.group_stock_user 1 0 0 0
12 access_stock_picking_type_manager stock.picking.type manager model_stock_picking_type stock.group_stock_manager 1 1 1 1
13 access_stock_production_lot_user access_stock_lot_user stock.production.lot user stock.lot user model_stock_production_lot model_stock_lot stock.group_stock_user 1 1 1 1
14 access_stock_move_manager stock.move manager model_stock_move stock.group_stock_manager 1 1 1 1
15 access_stock_move_user stock.move user model_stock_move stock.group_stock_user 1 1 1 0
16 access_product_product_stock_user product_product_stock_user product.model_product_product stock.group_stock_user 1 0 0 0
+1 -1
View File
@@ -105,7 +105,7 @@
<record model="ir.rule" id="stock_production_lot_rule">
<field name="name">Stock Production Lot multi-company</field>
<field name="model_id" search="[('model','=','stock.production.lot')]" model="ir.model"/>
<field name="model_id" search="[('model','=','stock.lot')]" model="ir.model"/>
<field name="domain_force">[('company_id','in', company_ids)]</field>
</record>
@@ -42,7 +42,7 @@ var ReportWidget = Widget.extend({
name: $el.data('lot_name') !== undefined && $el.data('lot_name').toString(),
context: {
active_id : $el.data('lot_id'),
active_model : 'stock.production.lot',
active_model : 'stock.lot',
url: '/stock/output_format/stock/active_id'
},
});
+1 -1
View File
@@ -16,7 +16,7 @@ class TestStockCommon(common.TransactionCase):
cls.StockQuantObj = cls.env['stock.quant']
cls.PickingObj = cls.env['stock.picking']
cls.MoveObj = cls.env['stock.move']
cls.LotObj = cls.env['stock.production.lot']
cls.LotObj = cls.env['stock.lot']
# Model Data
cls.picking_type_in = cls.ModelDataObj._xmlid_to_res_id('stock.picking_type_in')
+3 -3
View File
@@ -62,7 +62,7 @@ class TestInventory(TransactionCase):
self.assertEqual(len(inventory_quant), 0)
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'sn2',
'product_id': self.product2.id,
'company_id': self.env.company.id,
@@ -94,7 +94,7 @@ class TestInventory(TransactionCase):
])
self.assertEqual(len(inventory_quant), 0)
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'sn2',
'product_id': self.product2.id,
'company_id': self.env.company.id,
@@ -122,7 +122,7 @@ class TestInventory(TransactionCase):
]
inventory_quants = self.env['stock.quant'].search(quant_domain)
self.assertEqual(len(inventory_quants), 0)
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'sn2',
'product_id': self.product2.id,
'company_id': self.env.company.id,
+51 -51
View File
@@ -277,7 +277,7 @@ class StockMove(TransactionCase):
untracked quants. Two moves lines should be created: one for the tracked ones, another
for the untracked ones.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -306,12 +306,12 @@ class StockMove(TransactionCase):
reserved. Edit the reserve move lines to set them to new serial numbers, the reservation
should stay. Validate and the final quantity in stock should be 0, not negative.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -336,12 +336,12 @@ class StockMove(TransactionCase):
self.assertEqual(ml.product_qty, 1.0)
# assign lot3 and lot 4 to both untracked move lines
lot3 = self.env['stock.production.lot'].create({
lot3 = self.env['stock.lot'].create({
'name': 'lot3',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot4 = self.env['stock.production.lot'].create({
lot4 = self.env['stock.lot'].create({
'name': 'lot4',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -375,12 +375,12 @@ class StockMove(TransactionCase):
ones and assign them serial numbers on the fly. The final quantity in stock should be 0, not
negative.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -404,12 +404,12 @@ class StockMove(TransactionCase):
move1._action_done()
self.env['stock.quant']._update_available_quantity(self.product_serial, self.stock_location, 2)
lot3 = self.env['stock.production.lot'].create({
lot3 = self.env['stock.lot'].create({
'name': 'lot3',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot4 = self.env['stock.production.lot'].create({
lot4 = self.env['stock.lot'].create({
'name': 'lot4',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -446,12 +446,12 @@ class StockMove(TransactionCase):
serial number to one that is not in stock. The original serial should go back to stock and
the untracked quant should be tracked on the fly and sent instead.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -479,7 +479,7 @@ class StockMove(TransactionCase):
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product_serial, self.stock_location, lot_id=lot2, strict=True), 0.0)
self.env['stock.quant']._update_available_quantity(self.product_serial, self.stock_location, 1)
lot3 = self.env['stock.production.lot'].create({
lot3 = self.env['stock.lot'].create({
'name': 'lot3',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -507,7 +507,7 @@ class StockMove(TransactionCase):
# create an untracked quant
self.env['stock.quant']._update_available_quantity(self.product_serial, self.stock_location, 1.0)
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -546,12 +546,12 @@ class StockMove(TransactionCase):
move1._action_assign()
self.assertEqual(move1.state, 'assigned')
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -575,12 +575,12 @@ class StockMove(TransactionCase):
untracked quant then increase a non-existing tracked one that will fallback on the
untracked quant.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -624,7 +624,7 @@ class StockMove(TransactionCase):
system will update the reservation and use the untracked quant. Now unreserve, no error
should happen
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -650,7 +650,7 @@ class StockMove(TransactionCase):
# change the lot_id to one not available in stock while an untracked quant is available
self.env['stock.quant']._update_available_quantity(self.product_serial, self.stock_location, 1)
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -1647,12 +1647,12 @@ class StockMove(TransactionCase):
self.assertEqual(move1.availability, 50.0)
def test_availability_3(self):
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -1803,7 +1803,7 @@ class StockMove(TransactionCase):
# make 12 quants of 1
for i in range(1, 13):
lot_id = self.env['stock.production.lot'].create({
lot_id = self.env['stock.lot'].create({
'name': 'lot%s' % str(i),
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -2127,7 +2127,7 @@ class StockMove(TransactionCase):
'type': 'product',
})
serial_numbers = self.env['stock.production.lot'].create([{
serial_numbers = self.env['stock.lot'].create([{
'name': str(x),
'product_id': product.id,
'company_id': self.env.company.id,
@@ -2214,7 +2214,7 @@ class StockMove(TransactionCase):
""" Test the assignment mechanism when two chained stock moves try to move one unit of a
tracked product.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product.id,
'company_id': self.env.company.id,
@@ -2337,7 +2337,7 @@ class StockMove(TransactionCase):
""" Test the assignment mechanism when three chained stock moves (2 sources, 1 dest) try to
move multiple units of a tracked by lot product.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product.id,
'company_id': self.env.company.id,
@@ -2624,7 +2624,7 @@ class StockMove(TransactionCase):
# 6 units are available in stock
for i in range(1, 13):
lot_id = self.env['stock.production.lot'].create({
lot_id = self.env['stock.lot'].create({
'name': 'lot%s' % str(i),
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -2692,7 +2692,7 @@ class StockMove(TransactionCase):
'uom_type': 'bigger',
})
for i in range(1, 4):
lot_id = self.env['stock.production.lot'].create({
lot_id = self.env['stock.lot'].create({
'name': 'lot%s' % str(i),
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -2751,7 +2751,7 @@ class StockMove(TransactionCase):
self.assertEqual(backordered_move.reserved_availability, 0)
# force the serial number and validate
lot3 = self.env['stock.production.lot'].search([('name', '=', "lot3")])
lot3 = self.env['stock.lot'].search([('name', '=', "lot3")])
backorder.write({'move_line_ids': [(0, 0, {
'product_id': self.product_serial.id,
'product_uom_id': self.uom_unit.id,
@@ -2960,7 +2960,7 @@ class StockMove(TransactionCase):
""" Test that validating a stock move linked to a tracked product reserved by another one
correctly unreserves the other one.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product.id,
'company_id': self.env.company.id,
@@ -3145,12 +3145,12 @@ class StockMove(TransactionCase):
""" Test that editing a stock move line linked to a tracked product correctly and directly
adapts the reservation. In this case, we edit the lot to another available one.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product.id,
'company_id': self.env.company.id,
@@ -3259,12 +3259,12 @@ class StockMove(TransactionCase):
and directly adapts the reservation. In this case, we edit the lot to another available one
that is not in a pack.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product.id,
'company_id': self.env.company.id,
@@ -3350,7 +3350,7 @@ class StockMove(TransactionCase):
Validating the stock move should should not create a negative quant for this lot in stock
location.
# """
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -3399,12 +3399,12 @@ class StockMove(TransactionCase):
that does not have any should not change its reservation, and validating should not create
a negative quant for this lot in stock.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -3512,12 +3512,12 @@ class StockMove(TransactionCase):
""" Test that editing a done stock move line linked to a tracked product correctly and directly
adapts the transfer. In this case, we edit the lot to another available one.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product.id,
'company_id': self.env.company.id,
@@ -3630,12 +3630,12 @@ class StockMove(TransactionCase):
and directly adapts the transfer. In this case, we edit the lot to another available one
that is not in a pack.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product.id,
'company_id': self.env.company.id,
@@ -3925,12 +3925,12 @@ class StockMove(TransactionCase):
adapts the transfer. In this case, we edit the lot to another one, but the original move line
is not in the default product's UOM.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -3960,12 +3960,12 @@ class StockMove(TransactionCase):
and directly adapts the transfer. In this case, we edit the lot to another available one
that we put in the same pack.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -4174,7 +4174,7 @@ class StockMove(TransactionCase):
filling any quantities should pop up the immediate transfer wizard.
"""
partner = self.env['res.partner'].create({'name': 'Jean'})
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -4634,7 +4634,7 @@ class StockMove(TransactionCase):
'location_id': self.stock_location.id
})
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'serial1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -4702,12 +4702,12 @@ class StockMove(TransactionCase):
correctly restores the original lot with its incoming date and remove the new lot
with its incoming date.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -4811,12 +4811,12 @@ class StockMove(TransactionCase):
""" Check that, when creating a move line on a done stock move, the lot and its incoming
date are correctly moved to the destination location.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -5394,7 +5394,7 @@ class StockMove(TransactionCase):
- Check for dupes when assigning serial number to a stock move line
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'serial1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
+18 -18
View File
@@ -336,12 +336,12 @@ class TestPickShip(TestStockCommon):
Editing the lot on the move line of the first move should impact the reservation of the second one.
"""
self.productA.tracking = 'lot'
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.productA.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.productA.id,
'company_id': self.env.company.id,
@@ -439,7 +439,7 @@ class TestPickShip(TestStockCommon):
pack_location = self.env['stock.location'].browse(self.pack_location)
customer_location = self.env['stock.location'].browse(self.customer_location)
self.productA.tracking = 'lot'
lot = self.env['stock.production.lot'].create({
lot = self.env['stock.lot'].create({
'product_id': self.productA.id,
'name': '123456789',
'company_id': self.env.company.id,
@@ -522,7 +522,7 @@ class TestPickShip(TestStockCommon):
picking_pick, picking_pack, picking_ship = self.create_pick_pack_ship()
stock_location = self.env['stock.location'].browse(self.stock_location)
self.productA.tracking = 'serial'
lot = self.env['stock.production.lot'].create({
lot = self.env['stock.lot'].create({
'product_id': self.productA.id,
'name': '123456789',
'company_id': self.env.company.id,
@@ -744,17 +744,17 @@ class TestPickShip(TestStockCommon):
return of the second picking suggest the lot from the picking returned.
"""
self.productA.tracking = 'lot'
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.productA.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.productA.id,
'company_id': self.env.company.id,
})
lot3 = self.env['stock.production.lot'].create({
lot3 = self.env['stock.lot'].create({
'name': 'lot3',
'product_id': self.productA.id,
'company_id': self.env.company.id,
@@ -1236,7 +1236,7 @@ class TestSinglePicking(TestStockCommon):
Otherwise a new move lines with the new lot should be added.
"""
self.productA.tracking = 'lot'
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.productA.id,
'company_id': self.env.company.id,
@@ -1289,12 +1289,12 @@ class TestSinglePicking(TestStockCommon):
""" Same check than test_recheck_availability_2 but with different lots.
"""
self.productA.tracking = 'lot'
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.productA.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.productA.id,
'company_id': self.env.company.id,
@@ -1349,12 +1349,12 @@ class TestSinglePicking(TestStockCommon):
Serial number reservation should always create a new move line.
"""
self.productA.tracking = 'serial'
serial1 = self.env['stock.production.lot'].create({
serial1 = self.env['stock.lot'].create({
'name': 'serial1',
'product_id': self.productA.id,
'company_id': self.env.company.id,
})
serial2 = self.env['stock.production.lot'].create({
serial2 = self.env['stock.lot'].create({
'name': 'serial2',
'product_id': self.productA.id,
'company_id': self.env.company.id,
@@ -1555,7 +1555,7 @@ class TestSinglePicking(TestStockCommon):
# creating a lot from the view should raise
with self.assertRaises(UserError):
self.env['stock.production.lot']\
self.env['stock.lot']\
.with_context(active_picking_id=delivery_order.id)\
.create({
'name': 'lot1',
@@ -1564,7 +1564,7 @@ class TestSinglePicking(TestStockCommon):
})
# enter an existing lot_id, should work
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.productA.id,
'company_id': self.env.company.id,
@@ -2197,7 +2197,7 @@ class TestStockUOM(TestStockCommon):
self.assertEqual(move.product_uom_qty, 60.00, 'Wrong T_GT quantity')
self.assertEqual(move.product_qty, 134400.00, 'Wrong T_LBS quantity')
lot = self.env['stock.production.lot'].create({'name': 'Lot TEST', 'product_id': T_TEST.id, 'company_id': self.env.company.id, })
lot = self.env['stock.lot'].create({'name': 'Lot TEST', 'product_id': T_TEST.id, 'company_id': self.env.company.id, })
self.env['stock.move.line'].create({
'move_id': move.id,
'product_id': T_TEST.id,
@@ -3388,17 +3388,17 @@ class TestAutoAssign(TestStockCommon):
'picking_type_id': self.env.ref('stock.picking_type_in').id,
})
self.assertEqual(move.state, 'draft')
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'serial1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'serial2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot3 = self.env['stock.production.lot'].create({
lot3 = self.env['stock.lot'].create({
'name': 'serial3',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
+3 -3
View File
@@ -166,12 +166,12 @@ class TestMultiCompany(TransactionCase):
'tracking': 'lot',
'name': 'product lot',
})
self.env['stock.production.lot'].create({
self.env['stock.lot'].create({
'name': 'lotA',
'company_id': self.company_a.id,
'product_id': product_lot.id,
})
self.env['stock.production.lot'].create({
self.env['stock.lot'].create({
'name': 'lotA',
'company_id': self.company_b.id,
'product_id': product_lot.id,
@@ -210,7 +210,7 @@ class TestMultiCompany(TransactionCase):
self.assertEqual(move1.move_line_ids[0].company_id, self.company_a)
picking.with_user(self.user_b).button_validate()
self.assertEqual(picking.state, 'done')
created_serial = self.env['stock.production.lot'].search([
created_serial = self.env['stock.lot'].search([
('name', '=', 'receipt_serial')
])
self.assertEqual(created_serial.company_id, self.company_a)
+1 -1
View File
@@ -635,7 +635,7 @@ class TestPacking(TestPackingCommon):
""" Create a simple move in a delivery. Reserve the quantity but set as quantity done only a part.
Call Put In Pack button. """
self.productA.tracking = 'lot'
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'product_id': self.productA.id,
'name': '00001',
'company_id': self.warehouse.company_id.id
+2 -2
View File
@@ -58,7 +58,7 @@ class TestPackingNeg(TransactionCase):
# Put 120 pieces on Palneg 1 (package), 120 pieces on Palneg 2 with lot A and 60 pieces on Palneg 3
# create lot A
lot_a = self.env['stock.production.lot'].create({'name': 'Lot neg', 'product_id': product_neg.id, 'company_id': self.env.company.id})
lot_a = self.env['stock.lot'].create({'name': 'Lot neg', 'product_id': product_neg.id, 'company_id': self.env.company.id})
# create package
package1 = self.env['stock.quant.package'].create({'name': 'Palneg 1'})
package2 = self.env['stock.quant.package'].create({'name': 'Palneg 2'})
@@ -168,7 +168,7 @@ class TestPackingNeg(TransactionCase):
# Receive 20 products with lot neg in stock with a new incoming shipment that should be on pallet 2
delivery_reconcile.action_confirm()
lot = self.env["stock.production.lot"].search([
lot = self.env["stock.lot"].search([
('product_id', '=', product_neg.id),
('name', '=', 'Lot neg')], limit=1)
pack = self.env["stock.quant.package"].search([('name', '=', 'Palneg 2')], limit=1)
+10 -10
View File
@@ -148,7 +148,7 @@ class StockQuant(TransactionCase):
def test_get_available_quantity_7(self):
""" Quantity availability with only one tracked quant in a location.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -457,7 +457,7 @@ class StockQuant(TransactionCase):
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product, pack_location), 2.0)
def test_mix_tracked_untracked_1(self):
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -542,7 +542,7 @@ class StockQuant(TransactionCase):
""" Check that an incoming date is correctly set when updating the quantity of a tracked
quant.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -555,12 +555,12 @@ class StockQuant(TransactionCase):
""" Check that the FIFO strategies correctly applies when you have multiple lot received
at different times for a tracked product.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -581,12 +581,12 @@ class StockQuant(TransactionCase):
"""
lifo_strategy = self.env['product.removal'].search([('method', '=', 'lifo')])
self.stock_location.removal_strategy_id = lifo_strategy
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -605,7 +605,7 @@ class StockQuant(TransactionCase):
""" Receive the same lot at different times, once they're in the same location, the quants
are merged and only the earliest incoming date is kept.
"""
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_lot.id,
'company_id': self.env.company.id,
@@ -642,12 +642,12 @@ class StockQuant(TransactionCase):
"""
closest_strategy = self.env['product.removal'].search([('method', '=', 'closest')])
self.stock_location.removal_strategy_id = closest_strategy
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': self.product_serial.id,
'company_id': self.env.company.id,
@@ -231,7 +231,7 @@ class TestEditableQuant(TransactionCase):
in inventory mode.
"""
sn1 = self.env['stock.production.lot'].create({
sn1 = self.env['stock.lot'].create({
'name': 'serial1',
'product_id': self.product_tracked_sn.id,
'company_id': self.env.company.id,
+1 -1
View File
@@ -48,7 +48,7 @@ class TestReports(TestReportsCommon):
'tracking': 'lot',
'barcode': 'scan_me'
})
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'Volume-Beta',
'product_id': product1.id,
'company_id': self.env.company.id,
+2 -2
View File
@@ -168,13 +168,13 @@ class TestRobustness(TransactionCase):
'tracking': 'lot',
})
lot1 = self.env['stock.production.lot'].create({
lot1 = self.env['stock.lot'].create({
'name': 'lot1',
'product_id': product1.id,
'company_id': self.env.company.id,
})
lot2 = self.env['stock.production.lot'].create({
lot2 = self.env['stock.lot'].create({
'name': 'lot2',
'product_id': product2.id,
'company_id': self.env.company.id,
+3 -3
View File
@@ -27,7 +27,7 @@ class TestStockFlow(TestStockCommon):
@mute_logger('odoo.addons.base.models.ir_model', 'odoo.models')
def test_00_picking_create_and_transfer_quantity(self):
""" Basic stock operation on incoming and outgoing shipment. """
LotObj = self.env['stock.production.lot']
LotObj = self.env['stock.lot']
# ----------------------------------------------------------------------
# Create incoming shipment of product A, B, C, D
# ----------------------------------------------------------------------
@@ -1075,7 +1075,7 @@ class TestStockFlow(TestStockCommon):
lotproduct = self.ProductObj.create({'name': 'Lot Product', 'uom_id': self.uom_unit.id, 'uom_po_id': self.uom_unit.id, 'type': 'product'})
quant_obj = self.env['stock.quant'].with_context(inventory_mode=True)
pack_obj = self.env['stock.quant.package']
lot_obj = self.env['stock.production.lot']
lot_obj = self.env['stock.lot']
pack1 = pack_obj.create({'name': 'PACK00TEST1'})
pack_obj.create({'name': 'PACK00TEST2'})
lot1 = lot_obj.create({'name': 'Lot001', 'product_id': lotproduct.id, 'company_id': self.env.company.id})
@@ -1968,7 +1968,7 @@ class TestStockFlow(TestStockCommon):
# Validates the two receipts and checks the move lines' lot.
(receipt_1 | receipt_2).button_validate()
lots = self.env['stock.production.lot'].search([('product_id', '=', product_lot.id)], order='name asc')
lots = self.env['stock.lot'].search([('product_id', '=', product_lot.id)], order='name asc')
self.assertEqual(len(lots), 5)
lot1, lot2, lot3, lot4, lot5 = lots
self.assertEqual(lot1.name, 'lot-001')
@@ -2,7 +2,7 @@
<odoo>
<record id="view_production_lot_form" model="ir.ui.view">
<field name="name">stock.production.lot.form</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<form string="Lots/Serial Numbers">
@@ -59,7 +59,7 @@
<record id="view_production_lot_tree" model="ir.ui.view">
<field name="name">stock.production.lot.tree</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="arch" type="xml">
<tree string="Lots/Serial Numbers" multi_edit="1">
<field name="name" decoration-bf="1"/>
@@ -73,7 +73,7 @@
</record>
<record model="ir.ui.view" id="search_product_lot_filter">
<field name="name">Production Lots Filter</field>
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="arch" type="xml">
<search string="Product Lots Filter">
<field name="name" string="Lot/Serial Number" filter_domain="['|', ('name', 'ilike', self),('ref', 'ilike', self)]"/>
@@ -88,7 +88,7 @@
<record id="action_production_lot_form" model="ir.actions.act_window">
<field name="name">Lots/Serial Numbers</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.production.lot</field>
<field name="res_model">stock.lot</field>
<field name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_production_lot_tree')}),
@@ -36,7 +36,7 @@ class TestBatchPicking(TransactionCase):
'tracking': 'lot',
'categ_id': cls.env.ref('product.product_category_all').id,
})
cls.lots_p_a = cls.env['stock.production.lot'].create([{
cls.lots_p_a = cls.env['stock.lot'].create([{
'name': 'lot_product_a_' + str(i + 1),
'product_id': cls.productA.id,
'company_id': cls.env.company.id,
@@ -47,7 +47,7 @@ class TestBatchPicking(TransactionCase):
'tracking': 'serial',
'categ_id': cls.env.ref('product.product_category_all').id,
})
cls.lots_p_b = cls.env['stock.production.lot'].create([{
cls.lots_p_b = cls.env['stock.lot'].create([{
'name': 'lot_product_a_' + str(i + 1),
'product_id': cls.productB.id,
'company_id': cls.env.company.id,
@@ -253,7 +253,7 @@ class TestBatchPicking(TransactionCase):
def test_wave_split_move_uom(self):
self.uom_dozen = self.env.ref('uom.product_uom_dozen')
sns = self.env['stock.production.lot'].create([{
sns = self.env['stock.lot'].create([{
'name': 'sn-' + str(i),
'product_id': self.productB.id,
'company_id': self.env.company.id