}
_defaults = {
'name': lambda self, cr, uid, c: self.pool.get('ir.sequence').get(cr, uid, 'procurement.group') or '',
- 'move_type': lambda self, cr, uid, c: 'one'
+ 'move_type': lambda self, cr, uid, c: 'direct'
}
class procurement_rule(osv.osv):
_name = 'product.template'
_inherit = 'product.template'
+ def _get_buy_route(self, cr, uid, context=None):
+ buy_route = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'purchase', 'route_warehouse0_buy')[1]
+ return [buy_route]
+
def _purchase_count(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, 0)
for template in self.browse(cr, uid, ids, context=context):
}
_defaults = {
'purchase_ok': 1,
+ 'route_ids': _get_buy_route,
}
class product_product(osv.Model):
readonly=True),
}
-class product_product(osv.osv):
- _inherit = "product.product"
+class product_template(osv.osv):
+ _inherit = "product.template"
- def _get_buy_route(self, cr, uid, context=None):
- buy_route = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'purchase', 'route_warehouse0_buy')[1]
- return [buy_route]
- _defaults = {
- 'route_ids': _get_buy_route,
- }
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
'''
move_obj = self.pool.get('stock.move')
operation_obj = self.pool.get('stock.pack.operation')
+ moves = []
for op in picking.pack_operation_ids:
for product_id, remaining_qty in operation_obj._get_remaining_prod_quantities(cr, uid, op, context=context).items():
if remaining_qty > 0:
'product_uom': product.uom_id.id,
'product_uom_qty': remaining_qty,
'name': _('Extra Move: ') + product.name,
- 'state': 'confirmed',
+ 'state': 'draft',
}
- move_obj.create(cr, uid, vals, context=context)
+ moves.append(move_obj.create(cr, uid, vals, context=context))
+ if moves:
+ move_obj.action_confirm(cr, uid, moves, context=context)
+ return moves
def rereserve_quants(self, cr, uid, picking, move_ids=[], context=None):
""" Unreserve quants then try to reassign quants."""
else:
need_rereserve, all_op_processed = self.picking_recompute_remaining_quantities(cr, uid, picking, context=context)
#create extra moves in the picking (unexpected product moves coming from pack operations)
+ todo_move_ids = []
if not all_op_processed:
- self._create_extra_moves(cr, uid, picking, context=context)
+ todo_move_ids += self._create_extra_moves(cr, uid, picking, context=context)
+
picking.refresh()
#split move lines eventually
- todo_move_ids = []
+
toassign_move_ids = []
for move in picking.move_lines:
remaining_qty = move.remaining_qty
<field name="property_stock_account_input" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
<field name="property_stock_account_output" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
</group>
- </xpath>
- <xpath expr="//field[@name='standard_price']" position='replace'>
- <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/>
- <field name="cost_method" groups="stock_account.group_inventory_valuation"/>
- </xpath>
+ </xpath>
</field>
</record>