~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to procurement_cycle/scheduler.py

  • Committer: jf
  • Date: 2012-03-27 14:38:50 UTC
  • Revision ID: jf@tempo4-20120327143850-e41gh5zyjam3un11
[FIX] Default values

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    _name = 'procurement.order'
35
35
    _inherit = 'procurement.order'
36
36
    
37
 
    def run_automatic_cycle(self, cr, uid, use_new_cursor=False, context={}):
 
37
    def run_automatic_cycle(self, cr, uid, use_new_cursor=False, context=None):
38
38
        '''
39
39
        Create procurement on fixed date
40
40
        '''
131
131
            
132
132
        return {}
133
133
    
134
 
    def create_proc_cycle(self, cr, uid, cycle, product_id, location_id, d_values={}, cache={}, context={}):
 
134
    def create_proc_cycle(self, cr, uid, cycle, product_id, location_id, d_values=None, cache=None, context=None):
135
135
        '''
136
136
        Creates a procurement order for a product and a location
137
137
        '''
141
141
        wf_service = netsvc.LocalService("workflow")
142
142
        report = []
143
143
        proc_id = False
144
 
        
 
144
       
 
145
        if context is None:
 
146
            context = {}
 
147
        if d_values is None:
 
148
            d_values = {}
 
149
        if cache is None:
 
150
            cache = {}
 
151
 
145
152
        if isinstance(product_id, (int, long)):
146
153
            product_id = [product_id]
147
154
        
194
201
        
195
202
        return proc_id
196
203
    
197
 
    def _compute_quantity(self, cr, uid, cycle_id, product_id, location_id, d_values={}, context={}):
 
204
    def _compute_quantity(self, cr, uid, cycle_id, product_id, location_id, d_values=None, context=None):
198
205
        '''
199
206
        Compute the quantity of product to order like thid :
200
207
            [Delivery lead time (from supplier tab of the product or by default or manually overwritten) x Monthly Consumption]
201
208
            + Order coverage (number of months : 3 by default, manually overwritten) x Monthly consumption
202
209
            - Projected available quantity
203
210
        '''
 
211
        if d_values is None:
 
212
            d_values = {}
204
213
        product_obj = self.pool.get('product.product')
205
214
        supplier_info_obj = self.pool.get('product.supplierinfo')
206
215
        location_obj = self.pool.get('stock.location')
247
256
        return round(self.pool.get('product.uom')._compute_qty(cr, uid, product.uom_id.id, qty_to_order, product.uom_id.id), 2)
248
257
        
249
258
        
250
 
    def get_available(self, cr, uid, product_id, location_id, monthly_consumption, d_values={}, context={}):
 
259
    def get_available(self, cr, uid, product_id, location_id, monthly_consumption, d_values=None, context=None):
251
260
        '''
252
261
        Compute the projected available quantity like this :
253
262
            Available stock (real stock - picked reservation)
257
266
                        manually overwritten for a product or at product level)]
258
267
            - Expiry quantities.
259
268
        '''
 
269
        if context is None:
 
270
            context = {}
 
271
        if d_values is None:
 
272
            d_values = {}
260
273
        product_obj = self.pool.get('product.product')
261
274
        location_obj = self.pool.get('stock.location')
262
275
        move_obj = self.pool.get('stock.move')