diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index 2ed53ce0acf..a331d5c8b6b 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -321,6 +321,7 @@ product + TOW1 37.5 diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index ca25e2c0770..393d50e3181 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -51,7 +51,7 @@ Thanks to the double entry management, the inventory controlling is powerful and "init_xml" : [], "demo_xml" : [ "stock_demo.xml", - "stock_demo_picking.yml", + "stock_demo.yml", ], "update_xml" : [ "security/stock_security.xml", @@ -82,10 +82,9 @@ Thanks to the double entry management, the inventory controlling is powerful and "board_warehouse_view.xml", ], 'test': [ - 'test/stock_test.yml', + 'test/opening_stock.yml', + 'test/shipment.yml', 'test/stock_report.yml', - 'test/stock_test_wizard.yml', - 'test/stock_demo_backorder.yml' ], 'installable': True, 'application': True, diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 122776d1141..cd9242c6b1f 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -447,14 +447,12 @@ class stock_location(osv.osv): """, (id, id, product_id)) results += cr.dictfetchall() - total = 0.0 results2 = 0.0 for r in results: amount = self.pool.get('product.uom')._compute_qty(cr, uid, r['product_uom'], r['product_qty'], context.get('uom', False)) results2 += amount total += amount - if total <= 0.0: continue @@ -822,6 +820,7 @@ class stock_picking(osv.osv): """ Tests whether the move is in assigned state or not. @return: True or False """ + #TOFIX: assignment of move lines should be call before testing assigment otherwise picking never gone in assign state ok = True for pick in self.browse(cr, uid, ids): mt = pick.move_type @@ -2321,6 +2320,7 @@ class stock_move(osv.osv): @param context: context arguments @return: Scraped lines """ + #quantity should in MOVE UOM if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide a positive quantity to scrap!')) res = [] @@ -2421,6 +2421,7 @@ class stock_move(osv.osv): @param context: context arguments @return: Consumed lines """ + #quantity should in MOVE UOM if context is None: context = {} if quantity <= 0: @@ -2439,13 +2440,14 @@ class stock_move(osv.osv): quantity = move.product_qty uos_qty = quantity / move_qty * move.product_uos_qty - + location_dest_id = move.product_id.property_stock_production or move.location_dest_id if quantity_rest > 0: default_val = { 'product_qty': quantity, 'product_uos_qty': uos_qty, 'state': move.state, 'location_id': location_id or move.location_id.id, + 'location_dest_id': location_dest_id.id, } current_move = self.copy(cr, uid, move.id, default_val) res += [current_move] @@ -2461,7 +2463,8 @@ class stock_move(osv.osv): update_val = { 'product_qty' : quantity_rest, 'product_uos_qty' : uos_qty_rest, - 'location_id': location_id or move.location_id.id + 'location_id': location_id or move.location_id.id, + 'location_dest_id': location_dest_id.id, } self.write(cr, uid, [move.id], update_val) @@ -2675,6 +2678,7 @@ class stock_inventory(osv.osv): message = _("Inventory '%s' is done.") %(inv.name) self.log(cr, uid, inv.id, message) self.write(cr, uid, [inv.id], {'state': 'confirm', 'move_ids': [(6, 0, move_ids)]}) + self.pool.get('stock.move').action_confirm(cr, uid, move_ids, context=context) return True def action_cancel_draft(self, cr, uid, ids, context=None): @@ -2686,7 +2690,7 @@ class stock_inventory(osv.osv): self.write(cr, uid, [inv.id], {'state':'draft'}, context=context) return True - def action_cancel_inventary(self, cr, uid, ids, context=None): + def action_cancel_inventory(self, cr, uid, ids, context=None): """ Cancels both stock move and inventory @return: True """ diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml index ca897ced8ef..3940804eb5c 100644 --- a/addons/stock/stock_demo.xml +++ b/addons/stock/stock_demo.xml @@ -42,6 +42,7 @@ Shelf 1 + diff --git a/addons/stock/stock_demo.yml b/addons/stock/stock_demo.yml new file mode 100644 index 00000000000..99cde47b843 --- /dev/null +++ b/addons/stock/stock_demo.yml @@ -0,0 +1,102 @@ +- + !record {model: stock.location, id: location_refrigerator}: + name: Refrigerator + usage: internal +- + !record {model: stock.location, id: location_delivery_counter}: + name: Delivery Counter + usage: internal +- + !record {model: stock.location, id: location_refrigerator_small}: + name: Small Refrigerator + usage: internal + location_id: location_refrigerator +- + !record {model: stock.location, id: location_opening}: + name: opening + usage: inventory +- + !record {model: stock.location, id: location_convenience_shop}: + name: Convenient Store + chained_auto_packing: auto + chained_location_type: fixed + usage: supplier + chained_location_id: location_refrigerator + location_id: stock_location_suppliers +- + !record {model: stock.warehouse, id: warehouse_icecream}: + name: Ice Cream Shop + lot_input_id: location_refrigerator + lot_stock_id: location_refrigerator + lot_output_id: location_delivery_counter +- + !record {model: product.product, id: product_icecream}: + default_code: 001 + name: Ice Cream + type: product + categ_id: product.cat1 + supply_method: buy + list_price: 100.0 + standard_price: 70.0 + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_kgm + procure_method: make_to_stock + property_stock_inventory: location_opening + property_stock_account_input: location_refrigerator + property_stock_account_output: location_delivery_counter + description: Ice cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events. + +- + !record {model: stock.production.lot, id: lot_icecream_0}: + name: Lot0 for Ice cream + product_id: product_icecream +- + !record {model: stock.production.lot, id: lot_icecream_1}: + name: Lot1 for Ice cream + product_id: product_icecream +- + !record {model: stock.inventory, id: stock_inventory_icecream}: + name: Inventory for icecream +- + !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot0}: + product_id: product_icecream + product_uom: product.product_uom_kgm + inventory_id: stock_inventory_icecream + product_qty: 50.0 + prod_lot_id: lot_icecream_0 + location_id: location_refrigerator +- + !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot1}: + product_id: product_icecream + product_uom: product.product_uom_kgm + inventory_id: stock_inventory_icecream + product_qty: 40.0 + prod_lot_id: lot_icecream_1 + location_id: location_refrigerator + +- + !record {model: stock.picking, id: outgoing_shipment}: + type: out + location_dest_id: location_delivery_counter +- + !record {model: stock.move, id: outgoing_shipment_icecream}: + picking_id: outgoing_shipment + product_id: product_icecream + product_uom: product.product_uom_kgm + product_qty: 130.0 + location_id: location_refrigerator + location_dest_id: location_delivery_counter +- + !record {model: stock.picking, id: incomming_shipment}: + type: in + invoice_state: 2binvoiced + address_id: base.res_partner_address_9 + location_dest_id: location_refrigerator +- + !record {model: stock.move, id: incomming_shipment_icecream}: + picking_id: incomming_shipment + product_id: product_icecream + product_uom: product.product_uom_kgm + product_qty: 50.0 + location_id: location_convenience_shop + location_dest_id: location_refrigerator diff --git a/addons/stock/stock_demo_picking.yml b/addons/stock/stock_demo_picking.yml deleted file mode 100644 index 6301ab7a0cb..00000000000 --- a/addons/stock/stock_demo_picking.yml +++ /dev/null @@ -1,25 +0,0 @@ -- - !record {model: stock.picking, id: stock_picking_1}: - type: out - company_id: base.main_company - address_id: res_partner_address_fabien0 -- - !record {model: stock.move, id: stock_move_1}: - product_id: product.product_product_cpu1 - product_uom: product.product_uom_unit - product_uos_qty: 5.0 - product_qty: 5.0 - location_dest_id: stock.stock_location_customers - location_id: stock.stock_location_stock - name: CPU1, Processor AMD Athlon XP 1800 - picking_id: stock_picking_1 -- - !record {model: stock.move, id: stock_move_2}: - product_id: product.product_product_cpu3 - product_uom: product.product_uom_unit - product_uos_qty: 5.0 - product_qty: 5.0 - location_dest_id: stock.stock_location_customers - location_id: stock.stock_location_stock - name: CPU3, Processor AMD Athlon XP 1800 - picking_id: stock_picking_1 diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index b33359aa165..8c45097e7ee 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -171,7 +171,7 @@ -