Skip zero quantities when prefiling an inventory

issue3976
review6391002
This commit is contained in:
Sergi Almacellas Abellana committed 2014-07-03 18:49:59 +02:00
1 parent 1b654c08ce
commit 38eadbc7e9
2 files changed
+28

No files matched your search

+2
View File
@@ -216,6 +216,8 @@ class Inventory(Workflow, ModelSQL, ModelView):
or product2consumable[product_id]):
continue
quantity, uom_id = product_qty[product_id]
if not quantity:
continue
values = Line.create_values4complete(product_id, inventory,
quantity, uom_id)
to_create.append(values)
+26
View File
@@ -62,6 +62,7 @@ Get stock locations::
>>> Location = Model.get('stock.location')
>>> supplier_loc, = Location.find([('code', '=', 'SUP')])
>>> storage_loc, = Location.find([('code', '=', 'STO')])
>>> customer_loc, = Location.find([('code', '=', 'CUS')])
Create product::
@@ -119,3 +120,28 @@ Create an inventory::
True
>>> move.to_location == inventory.location
True
Empty storage::
>>> StockMove = Model.get('stock.move')
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
>>> outgoing_move.uom = unit
>>> outgoing_move.quantity = 2
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
>>> outgoing_move.planned_date = today
>>> outgoing_move.effective_date = today
>>> outgoing_move.company = company
>>> outgoing_move.unit_price = Decimal('100')
>>> outgoing_move.currency = currency
>>> outgoing_move.click('do')
Create an inventory that should be empty after completion::
>>> Inventory = Model.get('stock.inventory')
>>> inventory = Inventory()
>>> inventory.location = storage_loc
>>> inventory.click('complete_lines')
>>> len(inventory.lines)
0