'volume': fields.float('Volume'),
'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
store={
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
- 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20),
+ 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 40),
+ 'stock.move': (_get_picking_line, ['picking_id', 'product_id','product_uom_qty','product_uom'], 40),
}),
'weight_net': fields.function(_cal_weight, type='float', string='Net Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
store={
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
- 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20),
+ 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 40),
+ 'stock.move': (_get_picking_line, ['picking_id', 'product_id','product_uom_qty','product_uom'], 40),
}),
'carrier_tracking_ref': fields.char('Carrier Tracking Ref'),
'number_of_packages': fields.integer('Number of Packages'),
<field digits="(14, 3)" name="weight_net"/>
</group>
</group>
+ <group name="packaging" string="Packaging" attrs="{'invisible':[('type','=','service')]}" groups="product.group_stock_packaging" colspan="4">
+ <field name="packaging_ids" string="Configurations" context="{'tree_view_ref':'product.product_packaging_tree_view_product', 'form_view_ref': 'product.product_packaging_form_view_without_product'}"/>
+ </group>
</page>
<page string="Sales" attrs="{'invisible':[('sale_ok','=',False)]}" name="sales">
<group name="sale">
<field name="arch" type="xml">
<tree string="Packaging">
<field name="sequence" widget="handle"/>
+ <field name="product_tmpl_id"/>
<field name="ean"/>
<field name="qty"/>
<field name="ul"/>
</field>
</record>
+ <record id="product_packaging_tree_view_product" model="ir.ui.view">
+ <field name="name">product.packaging.tree.view.product</field>
+ <field name="model">product.packaging</field>
+ <field name="arch" type="xml">
+ <tree string="Packaging">
+ <field name="qty"/>
+ <field name="ul"/>
+ <field name="ul_qty"/>
+ <field name="rows"/>
+ <field name="ul_container"/>
+ </tree>
+ </field>
+ </record>
+
<record id="product_packaging_form_view" model="ir.ui.view">
<field name="name">product.packaging.form.view</field>
<field name="model">product.packaging</field>
</field>
</record>
+ <record id="product_packaging_form_view_without_product" model="ir.ui.view">
+ <field name="name">product.packaging.form.view.without.product</field>
+ <field name="model">product.packaging</field>
+ <field name="arch" type="xml">
+ <form string="Packaging">
+ <group col="4">
+ <field name="ean"/>
+ <field name="sequence" invisible="1"/>
+ <newline/>
+ <field name="qty"/>
+ <field name="ul"/>
+ <separator colspan="4" string="Palletization"/>
+ <field name="ul_qty"/>
+ <field name="rows"/>
+ <field name="ul_container"/>
+ <field name="weight"/>
+ <separator colspan="4" string="Other Info"/>
+ <field colspan="4" name="name"/>
+ </group>
+ </form>
+ </field>
+ </record>
+
<record id="product_supplierinfo_form_view" model="ir.ui.view">
<field name="name">product.supplierinfo.form.view</field>
<field name="model">product.supplierinfo</field>
</xpath>
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='tax_id']" position="before">
<field name="product_tmpl_id" invisible="1"/>
- <field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_tmpl_id','=',product_tmpl_id)]" groups="product.group_stock_packaging" />
+ <field name="product_packaging" context="{'default_product_tmpl_id': product_tmpl_id, 'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_tmpl_id','=',product_tmpl_id)]" groups="product.group_stock_packaging" />
</xpath>
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='sequence']" position="after">
<field name="delay" invisible="1"/>
self.write(cr, uid, [move.id], vals, context=context)
def action_done(self, cr, uid, ids, context=None):
- """ Process completly the moves given as ids and if all moves are done, it will finish the picking.
+ """ Process completely the moves given as ids and if all moves are done, it will finish the picking.
"""
context = context or {}
picking_obj = self.pool.get("stock.picking")
self.pool.get('stock.quant.package').write(cr, SUPERUSER_ID, [ops.package_id.id], {'parent_id': ops.result_package_id.id}, context=context)
move_qty[move.id] -= record.qty
#Check for remaining qtys and unreserve/check move_dest_id in
+ move_dest_ids = set()
for move in self.browse(cr, uid, ids, context=context):
if move_qty[move.id] > 0: # (=In case no pack operations in picking)
main_domain = [('qty', '>', 0)]
quants = quant_obj.quants_get_prefered_domain(cr, uid, move.location_id, move.product_id, qty, domain=main_domain, prefered_domain_list=prefered_domain_list, restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context)
quant_obj.quants_move(cr, uid, quants, move, move.location_dest_id, lot_id=move.restrict_lot_id.id, owner_id=move.restrict_partner_id.id, context=context)
- #Check moves that were pushed
- if move.move_dest_id.state in ('waiting', 'confirmed'):
- other_upstream_move_ids = self.search(cr, uid, [('id', 'not in', ids), ('state', 'not in', ['done', 'cancel']),
- ('move_dest_id', '=', move.move_dest_id.id)], context=context)
- #If no other moves for the move that got pushed:
- if not other_upstream_move_ids and move.move_dest_id.state in ('waiting', 'confirmed'):
- self.action_assign(cr, uid, [move.move_dest_id.id], context=context)
+ # If the move has a destination, add it to the list to reserve
+ if move.move_dest_id and move.move_dest_id.state in ('waiting', 'confirmed'):
+ move_dest_ids.add(move.move_dest_id.id)
+
if move.procurement_id:
procurement_ids.append(move.procurement_id.id)
- #unreserve the quants and make them available for other operations/moves
- quant_obj.quants_unreserve(cr, uid, move, context=context)
+ #unreserve the quants and make them available for other operations/moves
+ quant_obj.quants_unreserve(cr, uid, move, context=context)
# Check the packages have been placed in the correct locations
self._check_package_from_moves(cr, uid, ids, context=context)
#set the move as done
self.write(cr, uid, ids, {'state': 'done', 'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
self.pool.get('procurement.order').check(cr, uid, procurement_ids, context=context)
+ #assign destination moves
+ if move_dest_ids:
+ self.action_assign(cr, uid, list(move_dest_ids), context=context)
#check picking state to set the date_done is needed
done_picking = []
for picking in picking_obj.browse(cr, uid, list(pickings), context=context):