Skip to content
Permalink
Browse files

adapt test for inv adj

  • Loading branch information...
svs-odoo committed May 15, 2019
1 parent 3416fd3 commit 1eb837bd74d1d404df6cc529f0ed26384421518d
@@ -58,6 +58,7 @@ def test_basic(self):
'location_id': self.warehouse_1.lot_stock_id.id
})]
})
inventory.action_start()
inventory.action_validate()

test_date_planned = Dt.now() - timedelta(days=1)
@@ -206,6 +207,7 @@ def test_multiple_post_inventory(self):
'location_id': source_location_id
})]
})
inventory.action_start()
inventory.action_validate()

# create a mo for this bom
@@ -75,6 +75,7 @@ def test_00_workorder_process(self):
'location_id': self.source_location_id
})]
})
inventory.action_start()
inventory.action_validate()

# Create work order
@@ -176,6 +177,7 @@ def test_00b_workorder_process(self):
'location_id': self.source_location_id
})]
})
inventory.action_start()
inventory.action_validate()

# Create work order
@@ -460,7 +462,7 @@ def test_01_without_workorder(self):
'location_id': self.source_location_id
})]
})
# inventory.action_start()
inventory.action_start()
inventory.action_validate()

# Check consumed move status
@@ -634,7 +636,7 @@ def test_02_different_uom_on_bomlines(self):
'location_id': self.source_location_id
})]
})
# inventory.action_start()
inventory.action_start()
inventory.action_validate()

# Start Production ...
@@ -86,8 +86,8 @@ def action_validate(self):
raise UserError(_("Only a stock manager can validate an inventory adjustment."))
if self.state != 'confirm':
raise UserError(_(
"You can't validate this inventory, maybe this inventory " +
"doesn't exist anymore or has been already validated."))
"You can't validate the inventory '%s', maybe this inventory " +
"has been already validated or isn't ready." % self.name))
inventory_lines = self.line_ids.filtered(lambda l: l.product_id.tracking in ['lot', 'serial'] and not l.prod_lot_id and l.theoretical_qty != l.product_qty)
lines = self.line_ids.filtered(lambda l: float_compare(l.product_qty, 1, precision_rounding=l.product_uom_id.rounding) > 0 and l.product_id.tracking == 'serial' and l.prod_lot_id)
if inventory_lines and not lines:
@@ -113,11 +113,13 @@ def create(self, vals):
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)
if len(quant) > 1:
raise ValidationError(_("The operation try to write on multiple quants at once."))
if not quant:
quant = self.sudo().create(vals)
# Set the `inventory_quantity` field to create the necessary move.
quant[0].inventory_quantity = inventory_quantity
return quant[0]
quant.inventory_quantity = inventory_quantity
return quant
return super(StockQuant, self).create(vals)

def read(self, fields=None, load='_classic_read'):
@@ -1525,6 +1525,7 @@ def test_70_picking_state_all_at_once_reserve(self):
'location_id': self.stock_location
})]
})
inventory.action_start()
inventory.action_validate()

# create a "all at once" delivery order for two products
@@ -1557,6 +1558,7 @@ def test_70_picking_state_all_at_once_reserve(self):
'location_id': self.stock_location
})]
})
inventory.action_start()
inventory.action_validate()
# recheck availability of the delivery order, it should be assigned
picking_out.action_assign()
@@ -1615,6 +1617,7 @@ def test_72_picking_state_partial_reserve(self):
'location_id': self.stock_location
})]
})
inventory.action_start()
inventory.action_validate()

# create a "partial" delivery order for two products
@@ -1648,6 +1651,7 @@ def test_72_picking_state_partial_reserve(self):
'location_id': self.stock_location
})]
})
inventory.action_start()
inventory.action_validate()

# recheck availability of the delivery order, it should be assigned

0 comments on commit 1eb837b

Please sign in to comment.
You can’t perform that action at this time.