Skip to content
Snippets Groups Projects
Commit 302338ce authored by svs-odoo's avatar svs-odoo
Browse files

[FIX] stock: duplicate inventory


Before this commit, when you duplicate a validated inventory, the new
one has the inventory lines of the original one.
Now, the duplicate inventory is created without inventory lines.

Task #2043851

closes odoo/odoo#35402

Signed-off-by: default avatarSimon Lejeune (sle) <sle@openerp.com>
parent f6f14155
Branches
Tags
No related merge requests found
......@@ -38,7 +38,7 @@ class Inventory(models.Model):
"If the inventory adjustment is validated, date at which the inventory adjustment has been validated.")
line_ids = fields.One2many(
'stock.inventory.line', 'inventory_id', string='Inventories',
copy=True, readonly=False,
copy=False, readonly=False,
states={'done': [('readonly', True)]})
move_ids = fields.One2many(
'stock.move', 'inventory_id', string='Created Moves',
......@@ -73,6 +73,11 @@ class Inventory(models.Model):
"with all counted quantity set to zero.", default='counted',
selection=[('counted', 'Default to stock on hand'), ('zero', 'Default to zero')])
def copy_data(self, default=None):
name = _("%s (copy)") % (self.name)
default = dict(default or {}, name=name)
return super(Inventory, self).copy_data(default)
def unlink(self):
for inventory in self:
if inventory.state not in ('draft', 'cancel'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment