~vauxoo/addons-vauxoo/7.0-user_story-rev4-kty

« back to all changes in this revision

Viewing changes to mrp_production_wizard/mrp.py

[MERGE][mrp_request_return]change function _make_production_internal_shipment_line to _make_production_internal_shipment_line2

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        @param product id to create
45
45
        @return: True
46
46
        """
 
47
 
 
48
        total_weight = 0
 
49
        for line in list_produce:
 
50
                product_obj_data = self.pool.get('product.product').browse(cr, uid, line['product_id'], context=None)
 
51
                if product_obj_data.weight:
 
52
                    total_weight += (line['product_qty'] * product_obj_data.weight * (product.uom_id.factor / product_obj_data.uom_id.factor))
 
53
                else:
 
54
                    total_weight += line['product_qty'] * (product.uom_id.factor / product_obj_data.uom_id.factor)
 
55
        total_weight = total_weight / ((product.weight or 1) * product.uom_id.factor)
 
56
        
47
57
        default_location_dict = self.product_id_change(cr, uid, [], product.id, context)
48
58
        if (default_location_dict['value']['location_src_id'] & default_location_dict['value']['location_dest_id']):
49
59
            production_order_dict = {
50
60
                'name' : self.pool.get('ir.sequence').get(cr, uid, 'mrp.production'),
51
61
                'date_planned' : time.strftime('%Y-%m-%d %H:%M:%S'),
52
62
                'product_id' : product.id,
53
 
                'product_qty' : 1,
 
63
                'product_qty' : total_weight,
54
64
                'product_uom' : product.uom_id.id,
55
65
                'location_src_id': default_location_dict['value']['location_src_id'],
56
66
                'location_dest_id': default_location_dict['value']['location_dest_id'],
70
80
            
71
81
            mrp_pt_planifed_dict = {
72
82
                'product_id' : product.id,
73
 
                'quantity' : 1,
 
83
                'quantity' : total_weight,
74
84
                'production_id' : new_id,
75
85
                'product_uom' : product.uom_id.id,
76
86
            }