[MIGR] stock: stock.move

Move model is migrated to new API. No change is performed to code
structure or functional structure. Some code cleaning may be performed when
migrating to simplify the code. Other files may be updated due to the move
towards the new API.
This commit is contained in:
Thibault Delavallée
2016-04-29 12:18:43 +02:00
parent a17ef9a7cd
commit cb486d7eb6
5 changed files with 743 additions and 867 deletions
+3 -1
View File
@@ -1137,7 +1137,9 @@ class mrp_production(osv.osv):
'group_id': procurement and procurement.group_id.id,
}
move_id = stock_move.create(cr, uid, data, context=context)
return stock_move.action_confirm(cr, uid, [move_id], context=context)[0]
# TDE FIXME: necessary return ?
stock_move.action_confirm(cr, uid, [move_id], context=context)
return move_id
def _get_raw_material_procure_method(self, cr, uid, product, location_id=False, location_dest_id=False, context=None):
'''This method returns the procure_method to use when creating the stock move for the production raw materials
+1 -2
View File
@@ -383,8 +383,7 @@ class PurchaseOrder(models.Model):
res = order._prepare_picking()
picking = self.env['stock.picking'].create(res)
moves = order.order_line.filtered(lambda r: r.product_id.type in ['product', 'consu'])._create_stock_moves(picking)
move_ids = moves.action_confirm()
moves = self.env['stock.move'].browse(move_ids)
moves.action_confirm()
moves.force_assign()
return True
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -143,7 +143,7 @@
<field name="move_ids">
<tree decoration-muted="scrapped == True" string="Stock Moves">
<field name="product_id"/>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom)"/>
<field name="product_uom_qty"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="product.group_uom"/>
<field name="picking_id" invisible="1" />
<field name="create_date" invisible="1" />
+9 -10
View File
@@ -57,8 +57,8 @@
<field name="origin"/>
<field name="picking_type_id" invisible="1"/>
<field name="create_date" invisible="1" groups="base.group_no_one"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom)"/>
<field name="product_id"/>
<field name="product_uom_qty"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="product.group_uom"/>
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
@@ -80,9 +80,9 @@
<field eval="12" name="priority"/>
<field name="arch" type="xml">
<tree decoration-muted="scrapped == True" string="Stock Moves" editable="bottom">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
<field name="product_id"/>
<field name="name" invisible="1"/>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom)"/>
<field name="product_uom_qty"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="product.group_uom"/>
<field name="location_id" invisible="1"/>
<field name="create_date" invisible="1" />
@@ -115,11 +115,10 @@
<group>
<group name="main_grp" colspan="2">
<group name="main_grp_col1">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<field name="product_id"/>
<label for="product_uom_qty"/>
<div class="o_row">
<field name="product_uom_qty"
on_change="onchange_quantity(product_id, product_uom_qty, product_uom)"/>
<field name="product_uom_qty"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" groups="product.group_uom"/>
<button name="%(stock.move_scrap)d" class="btn-default"
string="Scrap" type="action" context="{'scrap': True}"
@@ -131,7 +130,7 @@
<field name="picking_type_id"/>
<field name="priority"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)" attrs="{'invisible': [('state', '=', 'done')]}"/>
<field name="date_expected" attrs="{'invisible': [('state', '=', 'done')]}"/>
<field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
</group>
</group>
@@ -172,12 +171,12 @@
</header>
<group>
<group string="#Products">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
<field name="product_id"/>
<field name="picking_type_id" invisible="1"/>
<field name="group_id" invisible="1"/>
<label for="product_uom_qty"/>
<div>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom)" class="oe_inline"/>
<field name="product_uom_qty"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit Of Measure" groups="product.group_uom" class="oe_inline"/>
<button name="%(stock.move_scrap)d"
string="Scrap" type="action"