[WIP] Add YML files and check stock/shipment.yml, make sure stock_account takes all...
authorJosse Colpaert <jco@openerp.com>
Thu, 18 Jul 2013 16:47:15 +0000 (18:47 +0200)
committerJosse Colpaert <jco@openerp.com>
Thu, 18 Jul 2013 16:47:15 +0000 (18:47 +0200)
bzr revid: jco@openerp.com-20130718164715-m2c7mbkb5ph9a82g

14 files changed:
addons/purchase/test/average_price.yml
addons/purchase/test/fifo_price.yml
addons/purchase/test/fifo_returns.yml
addons/purchase/test/lifo_price.yml
addons/stock/__openerp__.py
addons/stock/stock_demo.yml
addons/stock/test/move.yml
addons/stock/test/packing.yml [new file with mode: 0644]
addons/stock/test/procrule.yml [new file with mode: 0644]
addons/stock/test/shipment.yml
addons/stock_account/__openerp__.py
addons/stock_account/product_data.xml
addons/stock_account/stock_account_view.xml
addons/stock_complex_routes/test/dropship.yml [new file with mode: 0644]

index 98e7c74..0fa2dfb 100644 (file)
@@ -8,7 +8,6 @@
     categ_id: product.product_category_1
     uom_id: product.product_uom_kgm
     uom_po_id: product.product_uom_kgm
-    procure_method: make_to_stock
     valuation: real_time
     cost_method: average
     property_stock_account_input: account.o_expense
   !python {model: stock.picking}: |
     self.action_assign(cr, uid, [ref("outgoing_average_shipment")])
 - 
-  I confirm outgoing shipment of 20 kg of Average Ice Cream. 
-- 
-  !workflow {model: stock.picking, action: button_confirm, ref: outgoing_average_shipment}
-- 
   Process the delivery of the outgoing shipment
 - 
   !python {model: stock.partial.picking}: |
index 6bf072c..e6488bc 100644 (file)
@@ -10,7 +10,6 @@
     standard_price: 70.0
     uom_id: product.product_uom_kgm
     uom_po_id: product.product_uom_kgm
-    procure_method: make_to_stock
     cost_method: real
     valuation: real_time
     property_stock_account_input: account.o_expense
     product_uom: product.product_uom_kgm
     product_qty: 20.0
     type: out
--
-  I confirm outgoing shipment of 20 kg of FIFO Ice Cream.
--
-  !workflow {model: stock.picking, action: button_confirm, ref: outgoing_fifo_shipment}
 - 
   I assign this outgoing shipment 
 - 
     product_uom: product.product_uom_gram
     product_qty: 500.0
     type: out
--
-  I confirm outgoing shipment of 500g of FIFO Ice Cream.
--
-  !workflow {model: stock.picking, action: button_confirm, ref: outgoing_fifo_shipment_uom}
 - 
   I assign this outgoing shipment 
 - 
     product_uom: product.product_uom_kgm
     product_qty: 49.5
     type: out
--
-  I confirm outgoing shipment of 49.5 kg
--
-  !workflow {model: stock.picking, action: button_confirm, ref: outgoing_fifo_shipment_cur}
 - 
   I assign this outgoing shipment 
 - 
     product_uom: product.product_uom_kgm
     product_qty: 10.0
     type: out
--
-  I confirm outgoing shipment of 10 kg of FIFO Ice Cream.
--
-  !workflow {model: stock.picking, action: button_confirm, ref: outgoing_fifo_shipment_ret}
 - 
   I assign this outgoing shipment 
 - 
index a0fadeb..19fa9a6 100644 (file)
@@ -8,7 +8,6 @@
     categ_id: product.product_category_1
     uom_id: product.product_uom_kgm
     uom_po_id: product.product_uom_kgm
-    procure_method: make_to_stock
     cost_method: real
     valuation: real_time
     property_stock_account_input: account.o_expense
index 2e51a8c..ea30317 100644 (file)
@@ -15,7 +15,6 @@
     standard_price: 70.0
     uom_id: product.product_uom_kgm
     uom_po_id: product.product_uom_kgm
-    procure_method: make_to_stock
     valuation: real_time
     cost_method: real
     property_stock_account_input: account.o_expense
     product_uom: product.product_uom_kgm
     product_qty: 20.0
     type: out
-
--
-  I confirm outgoing shipment of 20 kg of LIFO Ice Cream.
--
-  !workflow {model: stock.picking, action: button_confirm, ref: outgoing_lifo_shipment}
 - 
   I assign this outgoing shipment 
 - 
index 1491ee2..af6ce4f 100644 (file)
@@ -61,7 +61,7 @@ Dashboard / Reports for Warehouse Management will include:
         'stock_demo.xml',
         'procurement_demo.xml',
         'stock_orderpoint.xml',
-#        'stock_demo.yml',
+        'stock_demo.yml',
     ],
     'data': [
         'security/stock_security.xml',
@@ -95,7 +95,7 @@ Dashboard / Reports for Warehouse Management will include:
     'test': [
         'test/inventory.yml',
         'test/move.yml',
-#        'test/shipment.yml',
+        'test/shipment.yml',
     ],
     'installable': True,
     'application': True,
index 8289898..a3a712c 100644 (file)
@@ -38,7 +38,6 @@
     property_stock_inventory: location_opening
     valuation: real_time
     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
@@ -66,7 +65,6 @@
     product_qty: 40.0
     prod_lot_id: lot_icecream_1
     location_id: location_refrigerator
-
 -
  !record {model: stock.picking, id: outgoing_shipment}:
     type: out
index bc1710a..696ef6f 100644 (file)
@@ -16,7 +16,7 @@
   !python {model: stock.move}: |
     self.action_confirm(cr, uid, [ref('move_test0')], context=context)
 -
-  I check that the quantity on hand is 18 and virutal is 13
+  I check that the quantity on hand is 18 and virtual is 13
 -
   !python {model: product.product}: |
     context['location'] = False
diff --git a/addons/stock/test/packing.yml b/addons/stock/test/packing.yml
new file mode 100644 (file)
index 0000000..016c361
--- /dev/null
@@ -0,0 +1,22 @@
+- 
+  Create a new stockable product
+- 
+  !record {model: product.product, id: packingtest}:
+    name: nice product
+- 
+  Create an incoming picking for this product of 300 PCE from suppliers to stock
+- 
+  !record{model: stock.picking}: |
+- 
+  Create move linked to picking
+- 
+  !record{model:stock.move, id:}
+- 
+  Confirm picking
+- 
+  !python {model: stock.picking}: |
+    self.action_confirm(cr, uid, ref())
+- 
+  Assign picking
+- 
+  
diff --git a/addons/stock/test/procrule.yml b/addons/stock/test/procrule.yml
new file mode 100644 (file)
index 0000000..33bcd1b
--- /dev/null
@@ -0,0 +1,4 @@
+- 
+  Create new product deliverytest
+- 
+  !record {}
index 07a85f5..70f9b14 100644 (file)
     shipment = self.pool.get('stock.picking').browse(cr, uid, ref("incomming_shipment"))
     context.update({'active_model': 'stock.picking', 'active_id': shipment.backorder_id.id, 'active_ids': [shipment.backorder_id.id]})
 -
-  !record {model: stock.invoice.onshipping, id: invoice_incomming}:
-    group: False
--
-  !python {model: stock.invoice.onshipping }: |
-    self.create_invoice(cr, uid, [ref('invoice_incomming')], context=context)
--
-  I check invoice state of backorder of incomming shipment.
--
-  !python {model: stock.picking}: |
-    shipment = self.browse(cr, uid, ref("incomming_shipment"))
-    assert shipment.backorder_id.invoice_state == 'invoiced', 'Invoice state is not upadted.'
--
-  I check available stock after received incomming shipping.
+  I check available stock after received incomming shipping. (removed invoicing here)
 -
   !python {model: product.product}: |
     product = self.browse(cr, uid, ref('product_icecream'), context=context)
     assert product.qty_available == 140, "Stock does not correspond."
-    assert product.virtual_available == 0, "Vitual stock does not correspond."
--
-  I split incomming shipment into lots. each lot contain 10 kgm Ice-cream.
--
-  !python {model: stock.picking}: |
-    shipment = self.browse(cr, uid, ref("incomming_shipment"))
-    move_ids = [x.id for x in shipment.backorder_id.move_lines]
-    context.update({'active_model': 'stock.move', 'active_id': move_ids[0], 'active_ids': move_ids})
--
-  !record {model: stock.move.split, id: split_lot_incomming}:
-    line_ids:
-        - name: incoming_lot0
-          quantity: 10
-        - name: incoming_lot1
-          quantity: 10
-        - name: incoming_lot2
-          quantity: 10
-        - name: incoming_lot3
-          quantity: 10
-        
--
- !python {model: stock.move.split }: |
-    self.split_lot(cr, uid, [ref('split_lot_incomming')], context=context)
--
-  I check move lines after spliting
--
-  !python {model: stock.move}: |
-    lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incomming'), context=context)
-    lot_ids = self.pool.get('stock.production.lot').search(cr, uid, [('name','in',[x.name for x in lot.line_ids])])
-    assert len(lot_ids) == 4, 'lots of incomming shipment are not correspond.'
-    move_ids = self.search(cr, uid, [('location_dest_id','=',ref('location_refrigerator')),('lot_id','in',lot_ids)])
-    assert len(move_ids) == 4, 'move lines are not correspond per prodcution lot after splited.'
-    for move in self.browse(cr, uid, move_ids, context=context):
-        assert move.lot_id.name in ['incoming_lot0', 'incoming_lot1', 'incoming_lot2', 'incoming_lot3'], "lot does not correspond." 
-        assert move.product_qty == 10, "qty does not correspond per production lot."
-    context.update({'active_model':'stock.move', 'active_id':move_ids[0],'active_ids': move_ids})
--
-  I consume 1 kgm ice-cream from each incoming lots into internal production.
--
-  !record {model: stock.move.consume, id: consume_lot_incomming}:
-    product_qty: 1
-    location_id: location_refrigerator
--
-  !python {model: stock.move.consume}: |
-    self.do_move_consume(cr, uid, [ref('consume_lot_incomming')], context=context)
--
-  I scrap 10 gm ice-cream from each incoming lots into scrap location.
--
-  !record {model: stock.move.scrap, id: scrap_lot_incomming}:
-    product_qty: 0.010
--
-  !python {model: stock.move.scrap}: |
-    self.move_scrap(cr, uid, [ref('scrap_lot_incomming')], context=context)
--
-  I check stock in scrap location and refrigerator location.
--
-  !python {model: stock.location}: |
-    ctx = {'product_id': ref('product_icecream')}
-    refrigerator_location = self.pool.get('stock.location').browse(cr, uid, ref('location_refrigerator'), context=ctx)
-    assert refrigerator_location.stock_real == 135.96, 'stock does not correspond in refrigerator location.'
-    scrapped_location = self.browse(cr, uid, ref('stock_location_scrapped'), context=ctx)
-    assert scrapped_location.stock_real == 0.010*4, 'scraped stock does not correspond in scrap location.'
-    
--
-  I check availabile stock after consumed and scraped.
--
-  !python {model: product.product}: |
-    product = self.browse(cr, uid, ref('product_icecream'), context=context)
-    assert product.qty_available == 135.96, "Stock does not correspond."
-    assert round(product.virtual_available, 2) == -4.04, "Vitual stock does not correspond."
--
-  I trace all incoming lots.
--
-  !python {model: stock.production.lot }: |
-    lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incomming'), context=context)
-    lot_ids = self.search(cr, uid, [('name', 'in', [x.name for x in lot.line_ids])])
-    self.action_traceability(cr, uid, lot_ids, context=context)
--
-  I check outgoing shipment after stock availablity in refrigerator.
--
-  !python {model: stock.picking}: |
-    shipment = self.browse(cr, uid, ref("outgoing_shipment"), context=context)
-    self.pool.get('stock.move').action_assign(cr, uid, [x.id for x in shipment.move_lines]) #TOFIX: assignment of move lines should be call before testing assigment otherwise picking never gone in assign state
-    #TOFIX: shipment should be assigned if stock available
-    #assert shipment.state == "assigned", "Shipment should be assigned."
-    #for move_line in shipment.move_lines:
-    #    assert move_line.state == "assigned", "Move should be assigned."
-    self.force_assign(cr, uid, [shipment.id])
--
-  I deliver 5kgm Ice-cream to customer so I make partial deliver
--
-  !python {model: stock.partial.move}: |
-    context.update({'active_model': 'stock.move', 'active_id': ref('outgoing_shipment_icecream'), 'active_ids': [ref('outgoing_shipment_icecream')]})
--
-  !record {model: stock.partial.move, id: partial_outgoing_icecream}:
-    move_ids:
-        - quantity: 5
-          product_id: product_icecream
-          product_uom: product.product_uom_kgm
-          move_id: outgoing_shipment_icecream
-          location_id: location_refrigerator
-          location_dest_id: location_delivery_counter
--
-  !python {model: stock.partial.move }: |
-    self.do_partial(cr, uid, [ref('partial_outgoing_icecream')], context=context)
-
--
-  I packing outgoing shipment into box per 10kgm with unique tracking lot.
--
-  !python {model: stock.move}: |
-    stock_split = self.pool.get('stock.split.into')
-    move = self.browse(cr, uid, ref('outgoing_shipment_icecream'), context=context)
-    context.update({'active_model': 'stock.move', 'active_id': move.id, 'active_ids': [move.id]})
-    total_qty = move.product_qty
-    split_qty = 10
-    while(total_qty>0):
-        split_id = stock_split.create(cr, uid, {'quantity': split_qty}, context=context)
-        stock_split.split(cr, uid, [split_id], context=context)
-        total_qty -= split_qty
--
-  I deliver outgoing shipment.
--
-  !python {model: stock.partial.picking}: |
-    context.update({'active_model': 'stock.picking', 'active_id': ref('outgoing_shipment'), 'active_ids': [ref('outgoing_shipment')]})
--
-  !record {model: stock.partial.picking, id: partial_outgoing}:
-    picking_id: outgoing_shipment
--
-  !python {model: stock.partial.picking }: |
-    self.do_partial(cr, uid, [ref('partial_outgoing')], context=context)
-
--
-  I check outgoing shipment after deliver.
--
-  !python {model: stock.picking}: |
-    shipment = self.browse(cr, uid, ref("outgoing_shipment"), context=context)
-    assert shipment.state == "done", "Shipment should be closed."
-    for move_line in shipment.move_lines:
-        assert move_line.state == "done", "Move should be closed."
--
-  I check availaible stock after deliver.
--
-  !python {model: product.product}: |
-    product = self.browse(cr, uid, ref('product_icecream'), context=context)
-    assert round(product.qty_available, 2) == 5.96, "Stock does not correspond."
-    assert round(product.virtual_available, 2) == -4.04, "Vitual stock does not correspond."
+    assert product.virtual_available == 0, "Vitual stock does not correspond."
\ No newline at end of file
index c6cfd7c..371d1b8 100644 (file)
@@ -44,48 +44,20 @@ Dashboard / Reports for Warehouse Management will include:
     'category': 'Hidden',
     'sequence': 16,
     'demo': [
-#        'stock_demo.xml',
-#        'procurement_demo.xml',
-#        'stock_orderpoint.xml',
-#        'stock_demo.yml',
+        'stock_account_demo.xml'
     ],
     'data': [
-#        'security/stock_security.xml',
-#        'security/ir.model.access.csv',
-#        'stock_data.xml',
-#        'wizard/stock_move_view.xml',
-#        'wizard/stock_change_product_qty_view.xml',
-#        'wizard/stock_partial_picking_view.xml',
-#        'wizard/stock_partial_move_view.xml',
-#        'wizard/stock_fill_inventory_view.xml',
+        'stock_account_data.xml', 
         'wizard/stock_invoice_onshipping_view.xml',
-#        'wizard/stock_inventory_merge_view.xml',
-#        'wizard/stock_location_product_view.xml',
-#        'wizard/stock_splitinto_view.xml',
-#        'wizard/stock_inventory_line_split_view.xml',
         'wizard/stock_change_standard_price_view.xml',
-#        'wizard/stock_return_picking_view.xml',
-#        'wizard/make_procurement_view.xml',
-#        'wizard/mrp_procurement_view.xml',
-#        'wizard/orderpoint_procurement_view.xml',
-#        'stock_workflow.xml',
-#        'stock_incoterms.xml',
-#        'stock_report.xml',
-#        'stock_view.xml',
-#        'stock_sequence.xml',
-#        'product_data.xml',
+        'product_data.xml',
         'product_view.xml',
-#        'partner_view.xml',
-#        'report/report_stock_move_view.xml',
-#        'report/report_stock_view.xml',
-#        'board_warehouse_view.xml',
-#        'res_config_view.xml',
+
+        'stock_account_view.xml', 
         'valuationandcostmethod.yml',
     ],
     'test': [
-#        'test/inventory.yml',
-#        'test/move.yml',
-#        'test/shipment.yml',
+
     ],
     'installable': True,
     'application': True,
index ae5a347..49a0654 100644 (file)
@@ -5,7 +5,7 @@
         <record id="property_stock_journal" model="ir.property">
             <field name="name">property_stock_journal</field>
             <field name="fields_id" search="[('model', '=', 'product.category'), ('name', '=', 'property_stock_journal')]"/>
-            <field eval="'account.journal,'+str(ref('stock.stock_journal'))" model="account.journal" name="value"/>
+            <field eval="'account.journal,'+str(ref('stock_journal'))" model="account.journal" name="value"/>
         </record>
 
         <record forcecreate="True" id="property_stock_account_output_prd" model="ir.property">
index 661f623..0586843 100644 (file)
@@ -6,7 +6,7 @@
         <record id="view_location_form_inherit" model="ir.ui.view">
             <field name="name">stock.location.form.inherit</field>
             <field name="model">stock.location</field>
-            <field name="inherit_id" ref="stock.stock_location_form"/>
+            <field name="inherit_id" ref="stock.view_location_form"/>
             <field name="arch" type="xml">
                 <xpath expr="//group[@name='localization']" position="after">
                     <group string="Accounting Information" attrs="{'invisible':[('usage','not in',('inventory','production'))]}">
             </field>
         </record>
 
-        <record id="view_picking_inherit_form" model="ir.ui.view">
+        <!-- Do not know problems here -> probably inherit of stock.picking <record id="view_picking_inherit_form2" model="ir.ui.view">
             <field name="name">stock.picking.form.inherit</field>
             <field name="model">stock.picking</field>
-            <field eval="12" name="priority"/>
             <field name="inherit_id" ref="stock.view_picking_form"/>
             <field name="arch" type="xml">
-                <xpath expr="//bouton[@name='action_process']" position="after">
-                    <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice/Refund"  attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}"  type="action" class="oe_highlight" groups="base.group_user"/>
-                </xpath>
-                <xpath expr="//field[@name='back_order_id']" position="after">
+                <xpath expr="//button[@name='action_process']" position="after">
+                    <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice/Refund"  attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" class="oe_highlight" groups="base.group_user"/>
                     <field name="invoice_state" string="Invoice Control" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
-                </xpath>
+            </xpath>
             </field>
-        </record>
+    </record>
 
 
 
                     <field name="invoice_state" groups="account.group_account_invoice"/>
                 </xpath>
             </field>
-        </record>
+        </record>-->
+
 
-        <record id="vpick_tree_inherit" model="ir.ui.view">
-            <field name="name">stock.picking.tree.inherit</field>
-            <field name="model">stock.picking.in</field>
-            <field name="inherit_id" ref="stock.vpick_tree"/>
-            <field name="arch" type="xml">
-                <xpath expr="//field[@name='min_date']" position="after">
-                    <field name="invoice_state" groups="account.group_account_invoice"/>
-                </xpath>
-            </field>
-        </record>
         <record id="view_picking_in_search_inherit" model="ir.ui.view">
             <field name="name">stock.picking.in.search.inherit</field>
             <field name="model">stock.picking.in</field>
diff --git a/addons/stock_complex_routes/test/dropship.yml b/addons/stock_complex_routes/test/dropship.yml
new file mode 100644 (file)
index 0000000..4a46532
--- /dev/null
@@ -0,0 +1,21 @@
+- 
+  Create new product candy without any routes
+- 
+  !record {model:product.product, id:}
+- 
+  Create a sales order with a line of 200 PCE incoming shipment, with route_id drop shipping
+- 
+  !record {model: sale.order}
+    
+- 
+  Confirm sales order
+- 
+  !python{model: sale.order}: |
+
+- 
+  Run schedulers
+- 
+  !python{model: procurement.order, id: }: |
+    
+- 
+