rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
'state': lambda *args: 'draft', | 'state': 'draft', | def create_forecast(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') forecast_obj=self.pool.get('stock.sale.forecast') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context): prod_categ_obj=self.pool.get('product.category') template_obj=self.pool.get('product.t... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def unlink(self, cr, uid, ids, context={}): | def unlink(self, cr, uid, ids, context=None): | def action_validate(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state':'validated','user_id':uid}) return True | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def onchange_company(self, cr, uid, ids, company_id): | def onchange_company(self, cr, uid, ids, company_id=False): | def onchange_company(self, cr, uid, ids, company_id): result = {} if company_id: result['warehouse_id'] = False result['analyzed_user_id'] = False result['analyzed_dept_id'] = False result['analyzed_warehouse_id'] = False return {'value': result} | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
if company_id: result['warehouse_id'] = False result['analyzed_user_id'] = False result['analyzed_dept_id'] = False result['analyzed_warehouse_id'] = False | if not company_id: return result result['warehouse_id'] = False result['analyzed_user_id'] = False result['analyzed_dept_id'] = False result['analyzed_warehouse_id'] = False | def onchange_company(self, cr, uid, ids, company_id): result = {} if company_id: result['warehouse_id'] = False result['analyzed_user_id'] = False result['analyzed_dept_id'] = False result['analyzed_warehouse_id'] = False return {'value': result} | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def product_id_change(self, cr, uid, ids, product_id): ret={} | def product_id_change(self, cr, uid, ids, product_id=False): ret = {} | def product_id_change(self, cr, uid, ids, product_id): ret={} if product_id: product_rec = self.pool.get('product.product').browse(cr, uid, product_id) ret['product_uom'] = product_rec.uom_id.id ret['product_uom_categ'] = product_rec.uom_id.category_id.id ret['product_uos_categ'] = product_rec.uos_id and product_rec.u... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def onchange_uom(self, cr, uid, ids, product_uom=False, product_qty=0.0, active_uom=False ): ret={} val1 = self.browse(cr, uid, ids) val = val1[0] coeff_uom2def = self._to_default_uom_factor(cr, uid, val, active_uom, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = ... | def onchange_uom(self, cr, uid, ids, product_uom=False, product_qty=0.0, active_uom=False): ret = {} if not ids: return {} if product_uom: val1 = self.browse(cr, uid, ids) val = val1[0] coeff_uom2def = self._to_default_uom_factor(cr, uid, val, active_uom, {}) coeff_def2uom, round_value = self._from_default_uom_factor( ... | def onchange_uom(self, cr, uid, ids, product_uom=False, product_qty=0.0, active_uom=False ): ret={} val1 = self.browse(cr, uid, ids) val = val1[0] coeff_uom2def = self._to_default_uom_factor(cr, uid, val, active_uom, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
ret={} | ret = {} if not ids: return {} | def product_amt_change(self, cr, uid, ids, product_amt = 0.0, product_uom=False): ret={} round_value = 1 if product_amt: coeff_def2uom = 1 val1 = self.browse(cr, uid, ids) val = val1[0] if (product_uom != val.product_id.uom_id.id): coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _to_default_uom_factor(self, cr, uid, val, uom_id, context): | def _to_default_uom_factor(self, cr, uid, val, uom_id, context=None): | def _to_default_uom_factor(self, cr, uid, val, uom_id, context): uom_obj = self.pool.get('product.uom') uom = uom_obj.browse(cr, uid, uom_id, context=context) coef = uom.factor if uom.category_id.id <> val.product_id.uom_id.category_id.id: coef = coef / val.product_id.uos_coeff return val.product_id.uom_id.factor / co... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _sales_per_users(self, cr, uid, so, so_line, company, users): | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
def _sales_per_warehouse(self, cr, uid, so, so_line, company, shops): | def _sales_per_warehouse(self, cr, uid, so, so_line, company, shops): | def _sales_per_warehouse(self, cr, uid, so, so_line, company, shops): cr.execute("SELECT sum(sol.product_uom_qty) FROM sale_order_line AS sol LEFT JOIN sale_order AS s ON (s.id = sol.order_id) " \ "WHERE (sol.id IN %s) AND (s.state NOT IN (\'draft\',\'cancel\')) AND (s.id IN %s)AND (s.company_id=%s) " \ "AND (s.shop_id... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _sales_per_company(self, cr, uid, so, so_line, company, ): | def _sales_per_company(self, cr, uid, so, so_line, company): | def _sales_per_company(self, cr, uid, so, so_line, company, ): cr.execute("SELECT sum(sol.product_uom_qty) FROM sale_order_line AS sol LEFT JOIN sale_order AS s ON (s.id = sol.order_id) " \ "WHERE (sol.id IN %s) AND (s.state NOT IN (\'draft\',\'cancel\')) AND (s.id IN %s) AND (s.company_id=%s)"%(tuple(so_line), tuple(s... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
"WHERE (sol.id IN %s) AND (s.state NOT IN (\'draft\',\'cancel\')) AND (s.id IN %s) AND (s.company_id=%s)"%(tuple(so_line), tuple(so), company)) | "WHERE (sol.id IN %s) AND (s.state NOT IN (\'draft\',\'cancel\')) AND (s.id IN %s) AND (s.company_id=%s)", (tuple(so_line), tuple(so), company)) | def _sales_per_company(self, cr, uid, so, so_line, company, ): cr.execute("SELECT sum(sol.product_uom_qty) FROM sale_order_line AS sol LEFT JOIN sale_order AS s ON (s.id = sol.order_id) " \ "WHERE (sol.id IN %s) AND (s.state NOT IN (\'draft\',\'cancel\')) AND (s.id IN %s) AND (s.company_id=%s)"%(tuple(so_line), tuple(s... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _sales_per_company(self, cr, uid, so, so_line, company, ): cr.execute("SELECT sum(sol.product_uom_qty) FROM sale_order_line AS sol LEFT JOIN sale_order AS s ON (s.id = sol.order_id) " \ "WHERE (sol.id IN %s) AND (s.state NOT IN (\'draft\',\'cancel\')) AND (s.id IN %s) AND (s.company_id=%s)"%(tuple(so_line), tuple(s... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id | sales = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods = obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id | def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
so_line_obj= self.pool.get('sale.order.line') | so_line_obj = self.pool.get('sale.order.line') | def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
sales[i][0] =self._sales_per_users(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, user_set) sales[i][0] *=factor | sales[i][0] = self._sales_per_users(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, user_set) sales[i][0] *= factor | def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
sales[i][1]= self._sales_per_users(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, dept_users_set) sales[i][1]*=factor | sales[i][1] = self._sales_per_users(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, dept_users_set) sales[i][1] *= factor | def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
sales[i][2]= self._sales_per_warehouse(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, shops_set) sales[i][2]*=factor | sales[i][2] = self._sales_per_warehouse(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, shops_set) sales[i][2] *= factor | def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
sales[i][3]= self._sales_per_company(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, ) sales[i][3]*=factor | sales[i][3] = self._sales_per_company(cr, uid, so_period_ids, so_line_product_ids, obj.company_id.id, ) sales[i][3] *= factor | def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'analyzed_period1_per_user':sales[0][0], 'analyzed_period2_per_user':sales[1][0], 'analyzed_period3_per_user':sales[2][0], 'analyzed_period4_per_user':sales[3][0], 'analyzed_period5_per_user':sales[4][0], 'analyzed_period1_per_dept':sales[0][1], 'analyzed_period2_per_dept':sales[1][1], 'analyzed_period3_per_dept':sales... | 'analyzed_period1_per_user': sales[0][0], 'analyzed_period2_per_user': sales[1][0], 'analyzed_period3_per_user': sales[2][0], 'analyzed_period4_per_user': sales[3][0], 'analyzed_period5_per_user': sales[4][0], 'analyzed_period1_per_dept': sales[0][1], 'analyzed_period2_per_dept': sales[1][1], 'analyzed_period3_per_dept... | def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def calculate_sales_history(self, cr, uid, ids, context, *args): sales=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] for obj in self.browse(cr, uid, ids): periods =obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
def onchange_company(self, cr, uid, ids, company_id): | def onchange_company(self, cr, uid, ids, company_id=False): | def onchange_company(self, cr, uid, ids, company_id): result = {} if company_id: result['warehouse_id2'] = False return {'value': result} | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'company_id': fields.many2one('res.company', 'Company', required = True), | 'company_id': fields.many2one('res.company', 'Company', required=True), | def onchange_company(self, cr, uid, ids, company_id): result = {} if company_id: result['warehouse_id2'] = False return {'value': result} | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.planning', context=c), | 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.planning', context=c), | def onchange_company(self, cr, uid, ids, company_id): result = {} if company_id: result['warehouse_id2'] = False return {'value': result} | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def create_planning(self,cr, uid, ids, context={}): | def create_planning(self,cr, uid, ids, context=None): if context is None: context = {} | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') | planning_obj = self.pool.get('stock.planning') mod_obj = self.pool.get('ir.model.data') | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
prod_categ_obj=self.pool.get('product.category') template_obj=self.pool.get('product.template') categ_ids = f.product_categ_id2.id and [f.product_categ_id2.id] or [] prod_categ_ids=prod_categ_obj.search(cr,uid,[('parent_id','child_of',categ_ids)]) templates_ids = template_obj.search(cr,uid,[('categ_id','in',prod_categ... | prod_categ_obj = self.pool.get('product.category') template_obj = self.pool.get('product.template') categ_ids = f.product_categ_id2.id and [f.product_categ_id2.id] or [] prod_categ_ids = prod_categ_obj.search(cr,uid,[('parent_id','child_of',categ_ids)]) templates_ids = template_obj.search(cr,uid,[('categ_id','in',prod_... | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
planned_out = ret[2] | planned_out = ret[2] | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
planned_out = False | planned_out = False | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'planned_outgoing': planned_out, | 'planned_outgoing': planned_out, | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'type': 'ir.actions.act_window', 'search_view_id': id['res_id'], | 'type': 'ir.actions.act_window', 'search_view_id': id['res_id'], | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _get_in_out(self, cr, uid, val, date_start, date_stop, direction, done, context): | def _get_in_out(self, cr, uid, val, date_start, date_stop, direction, done, context=None): | def create_planning(self,cr, uid, ids, context={}): product_obj = self.pool.get('product.product') planning_obj=self.pool.get('stock.planning') mod_obj =self.pool.get('ir.model.data') for f in self.browse(cr, uid, ids, context=context): if f.forecasted_products: cr.execute("SELECT product_id \ FROM stock_sale_forecast ... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
if not context: context = {} product_obj = self.pool.get('product.product') | def _get_in_out(self, cr, uid, val, date_start, date_stop, direction, done, context): | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | |
product_obj = self.pool.get('product.product') | def _get_in_out(self, cr, uid, val, date_start, date_stop, direction, done, context): | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | |
c1=context.copy() | c1 = context.copy() | def _get_in_out(self, cr, uid, val, date_start, date_stop, direction, done, context): | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
product=product_obj.read(cr, uid, prod_id,[], context) | product = product_obj.read(cr, uid, prod_id,[], context) | def _get_in_out(self, cr, uid, val, date_start, date_stop, direction, done, context): | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _get_outgoing_before(self, cr, uid, val, date_start, date_stop, context): | def _get_outgoing_before(self, cr, uid, val, date_start, date_stop, context=None): | def _get_outgoing_before(self, cr, uid, val, date_start, date_stop, context): cr.execute("SELECT sum(planning.planned_outgoing), planning.product_uom \ FROM stock_planning AS planning \ LEFT JOIN stock_period AS period \ ON (planning.period_id = period.id) \ WHERE (period.date_stop >= %s) AND (period.date_stop <= %s) \... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _get_forecast(self, cr, uid, ids, field_names, arg, context): | def _get_forecast(self, cr, uid, ids, field_names, arg, context=None): | def _to_planning_uom(self, cr, uid, val, qtys, context): res_qty = 0 if qtys: uom_obj = self.pool.get('product.uom') for qty, prod_uom in qtys: coef = self._to_default_uom_factor(cr, uid, val, prod_uom, context=context) res_coef, round_value = self._from_default_uom_factor(cr, uid, val, val.product_uom.id, context=cont... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
res[val.id]={} | res[val.id] = {} | def _get_forecast(self, cr, uid, ids, field_names, arg, context): res = {} for val in self.browse(cr, uid, ids): res[val.id]={} valid_part = val.confirmed_forecasts_only and " AND state = 'validated'" or "" cr.execute('SELECT sum(product_qty), product_uom \ FROM stock_sale_forecast \ WHERE product_id = %s AND period_i... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _get_stock_start(self, cr, uid, val, date, context): | def _get_stock_start(self, cr, uid, val, date, context=None): | def _get_stock_start(self, cr, uid, val, date, context): context['from_date'] = None context['to_date'] = date locations = [val.warehouse_id.lot_stock_id.id,] if not val.stock_only: locations.extend([val.warehouse_id.lot_input_id.id, val.warehouse_id.lot_output_id.id]) context['location'] = locations context['compute_c... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _get_stock_start(self, cr, uid, val, date, context): context['from_date'] = None context['to_date'] = date locations = [val.warehouse_id.lot_stock_id.id,] if not val.stock_only: locations.extend([val.warehouse_id.lot_input_id.id, val.warehouse_id.lot_output_id.id]) context['location'] = locations context['compute_c... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
def _get_op(self, cr, uid, ids, field_names, arg, context): | def _get_op(self, cr, uid, ids, field_names, arg, context=None): | def _get_op(self, cr, uid, ids, field_names, arg, context): # op = OrderPoint res = {} for val in self.browse(cr, uid, ids, context=context): res[val.id]={} cr.execute("SELECT product_min_qty, product_max_qty, product_uom \ FROM stock_warehouse_orderpoint \ WHERE warehouse_id = %s AND product_id = %s AND active = 'TR... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
ret = cr.fetchone() or [0.0,0.0,False] | ret = cr.fetchone() or [0.0,0.0,False] | def _get_op(self, cr, uid, ids, field_names, arg, context): # op = OrderPoint res = {} for val in self.browse(cr, uid, ids, context=context): res[val.id]={} cr.execute("SELECT product_min_qty, product_max_qty, product_uom \ FROM stock_warehouse_orderpoint \ WHERE warehouse_id = %s AND product_id = %s AND active = 'TR... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def onchange_company(self, cr, uid, ids, company_id): | def onchange_company(self, cr, uid, ids, company_id=False): | def _get_op(self, cr, uid, ids, field_names, arg, context): # op = OrderPoint res = {} for val in self.browse(cr, uid, ids, context=context): res[val.id]={} cr.execute("SELECT product_min_qty, product_max_qty, product_uom \ FROM stock_warehouse_orderpoint \ WHERE warehouse_id = %s AND product_id = %s AND active = 'TR... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def onchange_uom(self, cr, uid, ids, product_uom, ): | def onchange_uom(self, cr, uid, ids, product_uom=False): ret = {} | def onchange_uom(self, cr, uid, ids, product_uom, ): if not product_uom: return {} ret={} val1 = self.browse(cr, uid, ids) val = val1[0] coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coe... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
ret={} | if not ids: return {} | def onchange_uom(self, cr, uid, ids, product_uom, ): if not product_uom: return {} ret={} val1 = self.browse(cr, uid, ids) val = val1[0] coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coe... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coeff_uom2def * coeff_def2uom ret['planned_outgoing'] = rounding(coeff * val.planned_outgoing, round_value) ret['to_procure'] = rounding(coe... | if val.active_uom: coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {}) coeff = coeff_uom2def * coeff_def2uom ret['planned_outgoing'] = rounding(coeff * val.planned_outgoing, round_value) ret['to_procu... | coeff_uom2def = self._to_default_uom_factor(cr, uid, val, val.active_uom.id, {}) | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'history' : fields.text('Procurement History', readonly=True, help = "History of procurement or internal supply of this planning line."), | 'history': fields.text('Procurement History', readonly=True, help = "History of procurement or internal supply of this planning line."), | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'warehouse_id' : fields.many2one('stock.warehouse','Warehouse', required=True), | 'warehouse_id': fields.many2one('stock.warehouse','Warehouse', required=True), | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'product_uom' : fields.many2one('product.uom', 'UoM', required=True, help = "Unit of Measure used to show the quanities of stock calculation." \ | 'product_uom': fields.many2one('product.uom', 'UoM', required=True, help = "Unit of Measure used to show the quanities of stock calculation." \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'product_uos_categ' : fields.many2one('product.uom.categ', 'Product UoM Category'), | 'product_uos_categ': fields.many2one('product.uom.categ', 'Product UoM Category'), | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'active_uom' :fields.many2one('product.uom', string = "Active UoM"), 'planned_outgoing' : fields.float('Planned Out', required=True, \ | 'active_uom': fields.many2one('product.uom', string = "Active UoM"), 'planned_outgoing': fields.float('Planned Out', required=True, \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'line_time' : fields.function(_get_past_future, method=True,type='char', string='Past/Future'), 'minimum_op' : fields.function(_get_op, method=True, type='float', string = 'Minimum Rule', multi= 'minimum', \ | 'line_time': fields.function(_get_past_future, method=True,type='char', string='Past/Future'), 'minimum_op': fields.function(_get_op, method=True, type='float', string = 'Minimum Rule', multi= 'minimum', \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'maximum_op' : fields.function(_get_op, method=True, type='float', string = 'Maximum Rule', multi= 'maximum', \ | 'maximum_op': fields.function(_get_op, method=True, type='float', string = 'Maximum Rule', multi= 'maximum', \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'outgoing_before' : fields.float('Planned Out Before', readonly=True, \ | 'outgoing_before': fields.float('Planned Out Before', readonly=True, \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'stock_start' : fields.float('Initial Stock', readonly=True, \ | 'stock_start': fields.float('Initial Stock', readonly=True, \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'already_out' : fields.float('Already Out', readonly=True, \ | 'already_out': fields.float('Already Out', readonly=True, \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'already_in' : fields.float('Already In', readonly=True, \ | 'already_in': fields.float('Already In', readonly=True, \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'stock_only' : fields.boolean("Stock Location Only", help = "Check to calculate stock location of selected warehouse only. " \ | 'stock_only': fields.boolean("Stock Location Only", help = "Check to calculate stock location of selected warehouse only. " \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
"procure_to_stock" : fields.boolean("Procure To Stock Location", help = "Chect to make procurement to stock location of selected warehouse. " \ | "procure_to_stock": fields.boolean("Procure To Stock Location", help = "Chect to make procurement to stock location of selected warehouse. " \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
"confirmed_forecasts_only" : fields.boolean("Validated Forecasts", help = "Check to take validated forecasts only. " \ | "confirmed_forecasts_only": fields.boolean("Validated Forecasts", help = "Check to take validated forecasts only. " \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'supply_warehouse_id' : fields.many2one('stock.warehouse','Source Warehouse', help = "Warehouse used as source in supply pick move created by 'Supply from Another Warhouse'."), "stock_supply_location" : fields.boolean("Stock Supply Location", help = "Check to supply from Stock location of Supply Warehouse. " \ | 'supply_warehouse_id': fields.many2one('stock.warehouse','Source Warehouse', help = "Warehouse used as source in supply pick move created by 'Supply from Another Warhouse'."), "stock_supply_location": fields.boolean("Stock Supply Location", help = "Check to supply from Stock location of Supply Warehouse. " \ | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'to_procure' : 0.0, 'planned_outgoing' : 0.0, | 'to_procure': 0.0, 'planned_outgoing': 0.0, | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
} | } | coeff = coeff_uom2def * coeff_def2uom | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _to_default_uom_factor(self, cr, uid, val, uom_id, context): | def _to_default_uom_factor(self, cr, uid, val, uom_id, context=None): | def _to_default_uom_factor(self, cr, uid, val, uom_id, context): uom_obj = self.pool.get('product.uom') uom = uom_obj.browse(cr, uid, uom_id, context=context) coef = uom.factor if uom.category_id.id != val.product_id.uom_id.category_id.id: coef = coef / val.product_id.uos_coeff return val.product_id.uom_id.factor / co... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
coef = uom.factor | coef = uom.factor | def _to_default_uom_factor(self, cr, uid, val, uom_id, context): uom_obj = self.pool.get('product.uom') uom = uom_obj.browse(cr, uid, uom_id, context=context) coef = uom.factor if uom.category_id.id != val.product_id.uom_id.category_id.id: coef = coef / val.product_id.uos_coeff return val.product_id.uom_id.factor / co... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def _from_default_uom_factor(self, cr, uid, val, uom_id, context): | def _from_default_uom_factor(self, cr, uid, val, uom_id, context=None): | def _from_default_uom_factor(self, cr, uid, val, uom_id, context): uom_obj = self.pool.get('product.uom') uom = uom_obj.browse(cr, uid, uom_id, context=context) res = uom.factor if uom.category_id.id != val.product_id.uom_id.category_id.id: res = res / val.product_id.uos_coeff return res / val.product_id.uom_id.factor,... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) | current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) | def calculate_planning(self, cr, uid, ids, context, *args): one_minute = RelativeDateTime(minutes=1) current_date_beginning_c = mx.DateTime.today() current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) # to get hour 23:59:00 current_date_beginning = current_date_beginning_c.strftime('%Y... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
current=True | current = True | def calculate_planning(self, cr, uid, ids, context, *args): one_minute = RelativeDateTime(minutes=1) current_date_beginning_c = mx.DateTime.today() current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) # to get hour 23:59:00 current_date_beginning = current_date_beginning_c.strftime('%Y... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
current=False | current = False | def calculate_planning(self, cr, uid, ids, context, *args): one_minute = RelativeDateTime(minutes=1) current_date_beginning_c = mx.DateTime.today() current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) # to get hour 23:59:00 current_date_beginning = current_date_beginning_c.strftime('%Y... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'stock_start' : rounding(stock_start[0]*factor,round_value), | 'stock_start': rounding(stock_start[0]*factor,round_value), | def calculate_planning(self, cr, uid, ids, context, *args): one_minute = RelativeDateTime(minutes=1) current_date_beginning_c = mx.DateTime.today() current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) # to get hour 23:59:00 current_date_beginning = current_date_beginning_c.strftime('%Y... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def calculate_planning(self, cr, uid, ids, context, *args): one_minute = RelativeDateTime(minutes=1) current_date_beginning_c = mx.DateTime.today() current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) # to get hour 23:59:00 current_date_beginning = current_date_beginning_c.strftime('%Y... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
def calculate_planning(self, cr, uid, ids, context, *args): one_minute = RelativeDateTime(minutes=1) current_date_beginning_c = mx.DateTime.today() current_date_end_c = current_date_beginning_c + RelativeDateTime(days=1, minutes=-1) # to get hour 23:59:00 current_date_beginning = current_date_beginning_c.strftime('%Y... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
uom_qty = rounding(val.incoming_left * coeff_uom2def * coeff_def2uom, round_value) | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
'location_id': obj.procure_to_stock and obj.warehouse_id.lot_stock_id.id or obj.warehouse_id.lot_input_id.id, | 'location_id': obj.procure_to_stock and obj.warehouse_id.lot_stock_id.id or obj.warehouse_id.lot_input_id.id, | def procure_incomming_left(self, cr, uid, ids, context, *args): for obj in self.browse(cr, uid, ids): if obj.incoming_left <= 0: raise osv.except_osv(_('Error !'), _('Incoming Left must be greater than 0 !')) uom_qty, uom, uos_qty, uos = self._qty_to_standard(cr, uid, obj, context) user = self.pool.get('res.users').bro... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
'date' : obj.period_id.date_start, | 'date' : obj.period_id.date_start, | def internal_supply(self, cr, uid, ids, context, *args): for obj in self.browse(cr, uid, ids): if obj.incoming_left <= 0: raise osv.except_osv(_('Error !'), _('Incoming Left must be greater than 0 !')) if not obj.supply_warehouse_id: raise osv.except_osv(_('Error !'), _('You must specify a Source Warehouse !')) if obj.... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
def internal_supply(self, cr, uid, ids, context, *args): for obj in self.browse(cr, uid, ids): if obj.incoming_left <= 0: raise osv.except_osv(_('Error !'), _('Incoming Left must be greater than 0 !')) if not obj.supply_warehouse_id: raise osv.except_osv(_('Error !'), _('You must specify a Source Warehouse !')) if obj.... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py | ||
ret={} | ret = {} | def product_id_change(self, cr, uid, ids, product_id): ret={} if product_id: product_rec = self.pool.get('product.product').browse(cr, uid, product_id) ret['product_uom'] = product_rec.uom_id.id ret['active_uom'] = product_rec.uom_id.id ret['product_uom_categ'] = product_rec.uom_id.category_id.id ret['product_uos_cate... | 6a21b5d661b74602c870fac41f3c8c42e8bc6c33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6a21b5d661b74602c870fac41f3c8c42e8bc6c33/stock_planning.py |
self.__exp[i] = (fargs[0], 'in', right) | if right == []: self.__exp[i] = ( 'id', '=', 0 ) else: self.__exp[i] = (fargs[0], 'in', right) | def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent) | cc64d52b33cdaba5a2e3563525bc6b189251eea2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cc64d52b33cdaba5a2e3563525bc6b189251eea2/expression.py |
self.__exp[i] = ('id', 'in', right1) | if right1 == []: self.__exp[i] = ( 'id', '=', 0 ) else: self.__exp[i] = ('id', 'in', right1) | def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent) | cc64d52b33cdaba5a2e3563525bc6b189251eea2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cc64d52b33cdaba5a2e3563525bc6b189251eea2/expression.py |
vals['partner_id'] = __get_partner_id(cr, uid, \ | vals['partner_id'] = self.__get_partner_id(cr, uid, \ | def create(self, cr, uid, vals, context=None): if not context: context = {} vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False) if not vals['parent_id']: vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context) if not vals.get('res_id', False) and cont... | e8bf4a4f18fe70d52192f8893105ba9291abef4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e8bf4a4f18fe70d52192f8893105ba9291abef4a/document.py |
if False: obj_model = self.pool.get(vals['res_model']) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_m... | obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and ... | def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ if False: obj_model = self.pool.get(vals['res_model']) if obj_model._name... | e8bf4a4f18fe70d52192f8893105ba9291abef4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e8bf4a4f18fe70d52192f8893105ba9291abef4a/document.py |
unit=False, context=None): | unit=False, journal_id=False, context=None): | def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ... | 039ef25d0da26ebdd88259486ce84ae1c14fb481 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/039ef25d0da26ebdd88259486ce84ae1c14fb481/account_analytic_line.py |
flag = False | def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ... | 039ef25d0da26ebdd88259486ce84ae1c14fb481 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/039ef25d0da26ebdd88259486ce84ae1c14fb481/account_analytic_line.py | |
pricetype=self.pool.get('product.price.type').browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) | pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], cont... | def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ... | 039ef25d0da26ebdd88259486ce84ae1c14fb481 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/039ef25d0da26ebdd88259486ce84ae1c14fb481/account_analytic_line.py |
'amount': - round(amount, prec), | 'amount': result, | def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') if prod_id: prod = product_obj.browse(cr, uid, prod_id) a ... | 039ef25d0da26ebdd88259486ce84ae1c14fb481 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/039ef25d0da26ebdd88259486ce84ae1c14fb481/account_analytic_line.py |
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, context=None): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id... | def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partn... | def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, context=None): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id... | 81d69bc2523fe482df695b9f0a441c368d821bb0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/81d69bc2523fe482df695b9f0a441c368d821bb0/account_analytic_plans.py |
company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) | company_id = company_obj._company_default_get(cr, uid, 'account.analytic.line', context=context) | def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id, unit=False, journal_id=False, context=None): if context==None: context={} if not journal_id: j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')]) j_id = j_ids and j_ids[0] or False if not journal_id or no... | 0e34d1d2efc976813f0a24f2452df14715461d9e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0e34d1d2efc976813f0a24f2452df14715461d9e/account_analytic_line.py |
return {'value': { 'amount': result, 'general_account_id': a, | return {'value': { 'amount': result, 'general_account_id': a, | def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id, unit=False, journal_id=False, context=None): if context==None: context={} if not journal_id: j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')]) j_id = j_ids and j_ids[0] or False if not journal_id or no... | 0e34d1d2efc976813f0a24f2452df14715461d9e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0e34d1d2efc976813f0a24f2452df14715461d9e/account_analytic_line.py |
('cancel','Cancel')] | ('cancel','Cancelled')] | def run(self, cr, uid, ids, context=None): logger = netsvc.Logger() if context is None: context = {} for action in self.browse(cr, uid, ids, context): obj_pool = self.pool.get(action.model_id.model) obj = obj_pool.browse(cr, uid, context['active_id'], context=context) cxt = { 'context': dict(context), # copy context to... | 3f84f966af1bf1d4695edd4198c619b9e21c8c4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3f84f966af1bf1d4695edd4198c619b9e21c8c4c/ir_actions.py |
def ics_datetime(idate, short=False): if idate: if short or len(idate)<=10: return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d'))) else: return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S') else: return False | ed1f081a9ec70d70708784cc9694bf6748379219 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed1f081a9ec70d70708784cc9694bf6748379219/base_calendar.py | ||
for meeting_id in ids: result[meeting_id] = {} if "attendees" in name: attendee_ids = attendee_obj.search(cr, uid, [('ref','=','%s,%d'%(self._name, meeting_id))]) result[meeting_id]["attendees"] = attendee_obj.export_cal(cr, uid, attendee_ids) if "alarms" in name: alarm_ids = alarm_obj.search(cr, uid, [('model_id','=',... | def _get_data(self, cr, uid, ids, name, arg, context): result = {} attendee_obj = self.pool.get('calendar.attendee') alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0] for meeting_id in ids: result[meeting_id] = {} if "at... | 7314cc0c9bbccb251ea85689068e11d75a553b57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7314cc0c9bbccb251ea85689068e11d75a553b57/crm_meeting.py | |
attendee_ids = attendee_obj.search(cr, uid, [('ref','=','%s,%d'%(self._name, meeting.id))]) | def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') attendee_obj = self.pool.get('calendar.attendee') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0] | 7314cc0c9bbccb251ea85689068e11d75a553b57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7314cc0c9bbccb251ea85689068e11d75a553b57/crm_meeting.py | |
'attendee_ids': [(6,0, attendee_ids)], | 'attendee_ids': [(6,0, map(lambda x:x.id, meeting.attendee_ids))], | def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') attendee_obj = self.pool.get('calendar.attendee') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0] | 7314cc0c9bbccb251ea85689068e11d75a553b57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7314cc0c9bbccb251ea85689068e11d75a553b57/crm_meeting.py |
'event_end_date' : meeting.date_deadline, | def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') attendee_obj = self.pool.get('calendar.attendee') model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0] | 7314cc0c9bbccb251ea85689068e11d75a553b57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7314cc0c9bbccb251ea85689068e11d75a553b57/crm_meeting.py | |
cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ | cr.execute("select m.id, m.rrule, m.date, m.exdate from crm_meeting m\ | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if isinstance(select, (str, int, long)): ids = [select] else: ids = select result = [] if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting... | 7314cc0c9bbccb251ea85689068e11d75a553b57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7314cc0c9bbccb251ea85689068e11d75a553b57/crm_meeting.py |
def _map_ids(self, method, cr, uid, ids, *args, **argv): if isinstance(ids, (str, int, long)): select = [ids] else: select = ids case_data = self.browse(cr, uid, select) new_ids = [] for case in case_data: if case.inherit_case_id: new_ids.append(case.inherit_case_id.id) res = getattr(self.pool.get('crm.case'), method)(... | def _map_ids(self, method, cr, uid, ids, *args, **argv): if isinstance(ids, (str, int, long)): select = [ids] else: select = ids case_data = self.browse(cr, uid, select) new_ids = [] for case in case_data: if case.inherit_case_id: new_ids.append(case.inherit_case_id.id) res = getattr(self.pool.get('crm.case'), method)(... | 7314cc0c9bbccb251ea85689068e11d75a553b57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7314cc0c9bbccb251ea85689068e11d75a553b57/crm_meeting.py | |
cr.execute("SELECT crm_case.user_id, 'busy' as status \ FROM crm_meeting meeting, crm_case \ WHERE meeting.inherit_case_id = crm_case.id \ and crm_case.date <= %s and crm_case.date_deadline >= %s and crm_case.user_id = ANY(%s) and meeting.show_as = %s", | cr.execute("SELECT m.user_id, 'busy' as status \ FROM crm_meeting m\ where m.date <= %s and m.date_deadline >= %s \ and m.user_id = ANY(%s) and m.show_as = %s", | def _get_user_avail(self, cr, uid, ids, context=None): current_datetime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') res = super(res_users, self)._get_user_avail(cr, uid, ids, context) cr.execute("SELECT crm_case.user_id, 'busy' as status \ FROM crm_meeting meeting, crm_case \ WHERE meeting.inherit_case_id =... | 7314cc0c9bbccb251ea85689068e11d75a553b57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7314cc0c9bbccb251ea85689068e11d75a553b57/crm_meeting.py |
'picking_id': fields.many2one('stock.picking', 'Picking List', select=True,states={'done': [('readonly', True)]}), | 'picking_id': fields.many2one('stock.picking', 'Reference', select=True,states={'done': [('readonly', True)]}), | def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return Tru... | f7dda35ecc888f92a2e12aa4d622769938e8de8f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f7dda35ecc888f92a2e12aa4d622769938e8de8f/stock.py |
if (not os.path.exists(f)) and '_' in iso_lang: | if (not f) and '_' in iso_lang: | def update_translations(self, cr, uid, ids, filter_lang=None, context={}): logger = logging.getLogger('i18n') if not filter_lang: pool = pooler.get_pool(cr.dbname) lang_obj = pool.get('res.lang') lang_ids = lang_obj.search(cr, uid, [('translatable', '=', True)]) filter_lang = [lang.code for lang in lang_obj.browse(cr, ... | e037e96f6db49f670a99ddd2c76a2516923d018c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e037e96f6db49f670a99ddd2c76a2516923d018c/module.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.