~vauxoo/addons-vauxoo/7.0-add_project_followers_rule-dev-ernesto

« back to all changes in this revision

Viewing changes to m321_customization/sale.py

  • Committer: Jose Antonio
  • Date: 2012-06-06 21:36:12 UTC
  • Revision ID: jose@vauxoo.com-20120606213612-6hhgt93qz3zb4arg

[IMP] Added new page to view stock future for product selected

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
        """
50
50
        res = super(inherited_sale_order, self).default_get(cr, uid, fields, context=context)
51
 
        print "default", res
52
51
        res.get('order_policy',False) and res.update({'order_policy':'picking'})
53
52
        return res
54
53
 
58
57
 
59
58
inherited_sale_order()
60
59
 
 
60
 
 
61
class sale_order_line(osv.osv):
 
62
    
 
63
    def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
 
64
            uom=False, qty_uos=0, uos=False, name='', partner_id=False,
 
65
            lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False,context=None):
 
66
        if context is None:
 
67
            context ={}
 
68
        product_obj = self.pool.get('product.product')
 
69
        res = super(sale_order_line,self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
 
70
            uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
 
71
            lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag)
 
72
        
 
73
        future_stock = product and self.pool.get('stock.move').search(cr,uid,[('product_id','=',product),
 
74
                                                                              ('state','in',('assigned','confirmed','waiting')),
 
75
                                                                              ('picking_id.type','=','in')],context=context)
 
76
        future_stock and res.get('value',False) and res.get('value',False).update({'stock_move_ids':future_stock })
 
77
        
 
78
        return res
 
79
    
 
80
    
 
81
    _inherit = 'sale.order.line'
 
82
    _columns = {
 
83
        'stock_move_ids':fields.one2many('stock.move','id_sale','Future Stock',readonly=True,help="Stock move future to reference of salesman for knowing that product is available"),
 
84
    
 
85
    }
 
86
    
 
87
sale_order_line()
 
88