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
'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,
<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','<>','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','<>','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>