total = 0
weight = 0
volume = 0
+ product_uom_obj = self.pool.get('product.uom')
for line in order.order_line:
- if not line.product_id:
+ if not line.product_id or line.is_delivery:
continue
- weight += (line.product_id.weight or 0.0) * line.product_uom_qty
- volume += (line.product_id.volume or 0.0) * line.product_uom_qty
+ q = product_uom_obj._compute_qty(cr, uid, line.product_uom.id, line.product_uos_qty, line.product_id.uom_id.id)
- total += line.price_subtotal or 0.0
+ weight += (line.product_id.weight or 0.0) * q
+ volume += (line.product_id.volume or 0.0) * q
+ total = order.amount_total or 0.0
-
return self.get_price_from_picking(cr, uid, id, total,weight, volume, context=context)
def get_price_from_picking(self, cr, uid, id, total, weight, volume, context=None):
_defaults = {
'active': lambda *a: 1,
'user_id': lambda s, cr, uid, c: uid,
- 'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c),
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c),
- 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c),
+ 'company_id': lambda s, cr, uid, c: s._get_default_company_id(cr, uid, s._get_default_department_id(cr, uid, c), c),
'color': 0,
+ 'date_last_stage_update': fields.datetime.now,
}
_group_by_full = {