rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
LEFT JOIN ir_model model on (model.id = rule.name) \
LEFT JOIN ir_model model on (model.id = rule.model_id) \
def pre_action(self, cr, uid, ids, model, context=None): # Searching for action rules cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \ LEFT JOIN ir_model model on (model.id = rule.name) \ where active") res = cr.fetchall() # Check if any rule matching with current object for obj_name, rule_id in res: if not (model == obj_name): continue else: obj = self.pool.get(obj_name) self._action(cr, uid, [rule_id], obj.browse(cr, uid, ids, context=context)) return True
1d07f4092b58310420993921b0ddeb3ac65bb096 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d07f4092b58310420993921b0ddeb3ac65bb096/base_action_rule.py
model = action_rule.name.model
model = action_rule.model_id.model
def _register_hook(self, cr, uid, ids, context=None): if not context: context = {} for action_rule in self.browse(cr, uid, ids, context=context): model = action_rule.name.model obj_pool = self.pool.get(model) obj_pool.__setattr__('create', self._create(obj_pool.create, model, context=context)) obj_pool.__setattr__('write', self._write(obj_pool.write, model, context=context)) return True
1d07f4092b58310420993921b0ddeb3ac65bb096 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d07f4092b58310420993921b0ddeb3ac65bb096/base_action_rule.py
if action.name.model == action.filter_id.model_id:
if action.model_id.model == action.filter_id.model_id:
def do_check(self, cr, uid, action, obj, context={}): """ check Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param context: A standard dictionary for contextual values """ ok = True if action.filter_id: if action.name.model == action.filter_id.model_id: context.update(eval(action.filter_id.context)) obj_ids = obj._table.search(cr, uid, eval(action.filter_id.domain), context=context) if not obj.id in obj_ids: ok = False else: ok = False if hasattr(obj, 'user_id'): ok = ok and (not action.trg_user_id.id or action.trg_user_id.id==obj.user_id.id) if hasattr(obj, 'partner_id'): ok = ok and (not action.trg_partner_id.id or action.trg_partner_id.id==obj.partner_id.id) ok = ok and ( not action.trg_partner_categ_id.id or ( obj.partner_id.id and (action.trg_partner_categ_id.id in map(lambda x: x.id, obj.partner_id.category_id or [])) ) ) state_to = context.get('state_to', False) if hasattr(obj, 'state'): ok = ok and (not action.trg_state_from or action.trg_state_from==obj.state) if state_to: ok = ok and (not action.trg_state_to or action.trg_state_to==state_to) elif action.trg_state_to: ok = False reg_name = action.regex_name result_name = True if reg_name: ptrn = re.compile(str(reg_name)) _result = ptrn.search(str(obj.name)) if not _result: result_name = False regex_n = not reg_name or result_name ok = ok and regex_n return ok
1d07f4092b58310420993921b0ddeb3ac65bb096 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d07f4092b58310420993921b0ddeb3ac65bb096/base_action_rule.py
elif action.trg_state_to: ok = False
def do_check(self, cr, uid, action, obj, context={}): """ check Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param context: A standard dictionary for contextual values """ ok = True if action.filter_id: if action.name.model == action.filter_id.model_id: context.update(eval(action.filter_id.context)) obj_ids = obj._table.search(cr, uid, eval(action.filter_id.domain), context=context) if not obj.id in obj_ids: ok = False else: ok = False if hasattr(obj, 'user_id'): ok = ok and (not action.trg_user_id.id or action.trg_user_id.id==obj.user_id.id) if hasattr(obj, 'partner_id'): ok = ok and (not action.trg_partner_id.id or action.trg_partner_id.id==obj.partner_id.id) ok = ok and ( not action.trg_partner_categ_id.id or ( obj.partner_id.id and (action.trg_partner_categ_id.id in map(lambda x: x.id, obj.partner_id.category_id or [])) ) ) state_to = context.get('state_to', False) if hasattr(obj, 'state'): ok = ok and (not action.trg_state_from or action.trg_state_from==obj.state) if state_to: ok = ok and (not action.trg_state_to or action.trg_state_to==state_to) elif action.trg_state_to: ok = False reg_name = action.regex_name result_name = True if reg_name: ptrn = re.compile(str(reg_name)) _result = ptrn.search(str(obj.name)) if not _result: result_name = False regex_n = not reg_name or result_name ok = ok and regex_n return ok
1d07f4092b58310420993921b0ddeb3ac65bb096 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d07f4092b58310420993921b0ddeb3ac65bb096/base_action_rule.py
model_obj = self.pool.get(action.name.model)
model_obj = self.pool.get(action.model_id.model)
def _action(self, cr, uid, ids, objects, scrit=None, context={}): """ Do Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Basic Action Rule’s IDs, @param objects: pass objects @param context: A standard dictionary for contextual values """ context.update({'action': True}) if not scrit: scrit = [] for action in self.browse(cr, uid, ids): model_obj = self.pool.get(action.name.model) for obj in objects: ok = self.do_check(cr, uid, action, obj, context=context) if not ok: continue
1d07f4092b58310420993921b0ddeb3ac65bb096 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d07f4092b58310420993921b0ddeb3ac65bb096/base_action_rule.py
if not val: cr.execute("select max(date) from account_bank_statement_line l, account_bank_statement_reconcile s where l.pos_statement_id=%d and l.reconcile_id=s.id"%(order.id)) val=cr.fetchone() val=val and val[0] or None
def _get_date_payment2(self, cr, uid, ids, context, *a):
5631dcd674ad3075de7b238bad9a5ac4b395d89d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5631dcd674ad3075de7b238bad9a5ac4b395d89d/pos.py
ok = True
valid_moves = []
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
company_id=None
company_id = None
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
todo = []
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
if journal.type not in ('purchase','sale'): continue for line in move.line_id: code = amount = 0 key = (line.account_id.id, line.tax_code_id.id) if key in account2: code = account2[key][0] amount = account2[key][1] * (line.debit + line.credit) elif line.account_id.id in account: code = account[line.account_id.id][0] amount = account[line.account_id.id][1] * (line.debit + line.credit) if (code or amount) and not (line.tax_code_id or line.tax_amount): self.pool.get('account.move.line').write(cr, uid, [line.id], { 'tax_code_id': code, 'tax_amount': amount }, context, check=False)
if journal.type in ('purchase','sale'): for line in move.line_id: code = amount = 0 key = (line.account_id.id, line.tax_code_id.id) if key in account2: code = account2[key][0] amount = account2[key][1] * (line.debit + line.credit) elif line.account_id.id in account: code = account[line.account_id.id][0] amount = account[line.account_id.id][1] * (line.debit + line.credit) if (code or amount) and not (line.tax_code_id or line.tax_amount): self.pool.get('account.move.line').write(cr, uid, [line.id], { 'tax_code_id': code, 'tax_amount': amount }, context, check=False) elif journal.centralisation: valid_moves.append(move)
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
continue if journal.centralisation:
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
continue
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
ok = False if ok: list_ids = [] for tmp in move.line_id: list_ids.append(tmp.id) self.pool.get('account.move.line').create_analytic_lines(cr, uid, list_ids, context) return ok
for record in valid_moves: self.pool.get('account.move.line').create_analytic_lines(cr, uid, [line.id for line in record.line_id], context) return len(valid_moves) > 0
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
65ddf755de8d52191634fd06a82995da790eef5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/65ddf755de8d52191634fd06a82995da790eef5e/account.py
return context['project_id']
return int(context['project_id'])
def _default_project(self, cr, uid, context={}): if 'project_id' in context and context['project_id']: return context['project_id'] return False
3974ad0f611e329f6a9d578142e3dfc7cfd762c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3974ad0f611e329f6a9d578142e3dfc7cfd762c7/project.py
coeff_def2uom, rounding = self._from_default_uom_factor( cr, uid, val, product_uom, {})
coeff_def2uom, round_value = self._from_default_uom_factor( cr, uid, val, product_uom, {})
def product_amt_change(self, cr, uid, ids, product_amt = 0.0, product_uom=False): ret={} 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, rounding = self._from_default_uom_factor( cr, uid, val, product_uom, {}) ret['product_qty'] = rounding(coeff_def2uom * product_amt/(val.product_id.product_tmpl_id.list_price), round_value) res = {'value': ret} return res
c10374dced597d27aa4c60eccd682d01cd57e86e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c10374dced597d27aa4c60eccd682d01cd57e86e/stock_planning.py
'domain': fields.char('Domain Value', size=250, required=True), 'context': fields.char('Context Value', size=250, required=True),
'domain': fields.text('Domain Value', required=True), 'context': fields.text('Context Value', required=True),
def get_filters(self, cr, uid, model): act_ids = self.search(cr,uid,[('model_id','=',model),('user_id','=',uid)]) my_acts = self.read(cr, uid, act_ids, ['name', 'domain','context']) return my_acts
c72b7ece204faf6094e65f7c6ffbd3ec55fa8cbf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c72b7ece204faf6094e65f7c6ffbd3ec55fa8cbf/ir_filters.py
states=('paid')
states=('paid',)
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from=context.get('date_from', time.strftime('%Y-01-01')) date_to=context.get('date_to', time.strftime('%Y-12-31')) invoice_state=context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types=() states=() if invoice_state=='paid': states=('paid') elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
a3ed9b34d4df6ff21c06c5f17447504d5b989eae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a3ed9b34d4df6ff21c06c5f17447504d5b989eae/product_margin.py
start_date = base_start_date and datetime.strptime(base_start_date[:10], "%Y-%m-%d") or False until_date = base_until_date and datetime.strptime(base_until_date[:10], "%Y-%m-%d") or False
start_date = base_start_date and datetime.strptime(base_start_date[:10]+ ' 00:00:00' , "%Y-%m-%d %H:%M:%S") or False until_date = base_until_date and datetime.strptime(base_until_date[:10]+ ' 23:59:59', "%Y-%m-%d %H:%M:%S") or False
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): """Gives virtual event ids for recurring events based on value of Recurrence Rule This method gives ids of dates that comes between start date and end date of calendar views @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param base_start_date: Get Start Date @param base_until_date: Get End Date @param limit: The Number of Results to Return """
320cd68fdc4f104fc6ea867a0df22507c47c6b30 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/320cd68fdc4f104fc6ea867a0df22507c47c6b30/base_calendar.py
if arg[0] not in ('date', unicode('date')):
if arg[0] not in ('date', unicode('date'), 'date_deadline', unicode('date_deadline')):
def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): """ Overrides orm search method. @param cr: the current row, from the database cursor, @param user: the current user’s ID for security checks, @param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...]. @param offset: The Number of Results to Pass @param limit: The Number of Results to Return @param context: A standard dictionary for contextual values @param count: If its True the method returns number of records instead of ids @return: List of id """ args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): if start_date: continue start_date = arg[2] elif arg[1] in ('<', '<='): if until_date: continue until_date = arg[2] res = super(calendar_event, self).search(cr, uid, args_without_date, \ offset, limit, order, context, count)
320cd68fdc4f104fc6ea867a0df22507c47c6b30 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/320cd68fdc4f104fc6ea867a0df22507c47c6b30/base_calendar.py
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): cursor.execute('SELECT balance_end_real \
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None): cr.execute('SELECT balance_end_real \
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): cursor.execute('SELECT balance_end_real \ FROM account_bank_statement \ WHERE journal_id = %s AND NOT state = %s \ ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft')) res = cursor.fetchone() balance_start = res and res[0] or 0.0 return {'value': {'balance_start': balance_start}}
382f6fc8c55cb866c4bc8d54c7a4b13694648d46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/382f6fc8c55cb866c4bc8d54c7a4b13694648d46/account_bank_statement.py
res = cursor.fetchone()
res = cr.fetchone()
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): cursor.execute('SELECT balance_end_real \ FROM account_bank_statement \ WHERE journal_id = %s AND NOT state = %s \ ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft')) res = cursor.fetchone() balance_start = res and res[0] or 0.0 return {'value': {'balance_start': balance_start}}
382f6fc8c55cb866c4bc8d54c7a4b13694648d46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/382f6fc8c55cb866c4bc8d54c7a4b13694648d46/account_bank_statement.py
return {'value': {'balance_start': balance_start}}
account_id = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id'], context=context)['default_debit_account_id'] return {'value': {'balance_start': balance_start, 'account_id': account_id}}
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): cursor.execute('SELECT balance_end_real \ FROM account_bank_statement \ WHERE journal_id = %s AND NOT state = %s \ ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft')) res = cursor.fetchone() balance_start = res and res[0] or 0.0 return {'value': {'balance_start': balance_start}}
382f6fc8c55cb866c4bc8d54c7a4b13694648d46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/382f6fc8c55cb866c4bc8d54c7a4b13694648d46/account_bank_statement.py
def onchange_type(self, cr, uid, line_id, partner_id, type, context=None): res = {'value': {}} obj_partner = self.pool.get('res.partner') if context is None: context = {} if not partner_id: return res account_id = False line = self.browse(cr, uid, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cr, uid, partner_id, context=context) if type == 'supplier': account_id = part.property_account_payable.id else: account_id = part.property_account_receivable.id res['value']['account_id'] = account_id return res
382f6fc8c55cb866c4bc8d54c7a4b13694648d46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/382f6fc8c55cb866c4bc8d54c7a4b13694648d46/account_bank_statement.py
'section_id' : opp.section_id and opp.section_id.id or False,
'section_id' : this.section_id.id or opp.section_id.id or False,
def action_apply(self, cr, uid, ids, context=None): """ This converts Opportunity to Phonecall and opens Phonecall view @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Opportunity to Phonecall IDs @param context: A standard dictionary for contextual values
b71bd40386d6ce7e2c544733cf74def62e6825cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b71bd40386d6ce7e2c544733cf74def62e6825cd/crm_opportunity_to_phonecall.py
def has_stockable_products(self, cr, uid, ids, *args): for order in self.browse(cr, uid, ids): for order_line in order.order_line: if order_line.product_id and order_line.product_id.product_tmpl_id.type in ('product', 'consu'): return True return False
29fb35808791ca1e9df549ae2381b3cf08ee38a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/29fb35808791ca1e9df549ae2381b3cf08ee38a7/sale.py
s = decode_header(s)
s = decode_header(s.replace('\r', ''))
def _decode_header(self, s): from email.Header import decode_header s = decode_header(s) return ''.join(map(lambda x:self._to_decode(x[0], [x[1]]), s or []))
823e69341e844235250e5440158254d30fb89d78 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/823e69341e844235250e5440158254d30fb89d78/openerp_mailgate.py
nctx = nodes.get_node_context(cr, uid, context={})
nctx = nodes.get_node_context(cr, uid, context=context)
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) if not bin_size: result[fbro.id] = datas else: result[fbro.id] = size
5633f1b6ba9f9f5bc1416bf023638a611c3f87f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5633f1b6ba9f9f5bc1416bf023638a611c3f87f1/document.py
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) if not bin_size: result[fbro.id] = datas else: result[fbro.id] = size
5633f1b6ba9f9f5bc1416bf023638a611c3f87f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5633f1b6ba9f9f5bc1416bf023638a611c3f87f1/document.py
if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas)
fnode = nodes.node_file(None, None, nctx, fbro) if not bin_size: data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '')
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) if not bin_size: result[fbro.id] = datas else: result[fbro.id] = size
5633f1b6ba9f9f5bc1416bf023638a611c3f87f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5633f1b6ba9f9f5bc1416bf023638a611c3f87f1/document.py
fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) if not bin_size: result[fbro.id] = datas else: result[fbro.id] = size
result[fbro.id] = fnode.get_data_len(cr, fbro)
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) if not bin_size: result[fbro.id] = datas else: result[fbro.id] = size
5633f1b6ba9f9f5bc1416bf023638a611c3f87f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5633f1b6ba9f9f5bc1416bf023638a611c3f87f1/document.py
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) if not bin_size: result[fbro.id] = datas else: result[fbro.id] = size
5633f1b6ba9f9f5bc1416bf023638a611c3f87f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5633f1b6ba9f9f5bc1416bf023638a611c3f87f1/document.py
and ('name' not in vals or fbro.name == vals['name']) :
and ('name' not in vals or fbro.name == vals['name']) or not fbro.parent_id:
def write(self, cr, uid, ids, vals, context=None): result = False if not isinstance(ids, list): ids = [ids] res = self.search(cr, uid, [('id', 'in', ids)]) if not len(res): return False if not self._check_duplication(cr, uid, vals, ids, 'write'): raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
5633f1b6ba9f9f5bc1416bf023638a611c3f87f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5633f1b6ba9f9f5bc1416bf023638a611c3f87f1/document.py
for node in el.findall('image'):
for node in el.findall('.//image'):
def _images(self, el): result = {} for node in el.findall('image'): rc =( node.text or '') result[node.get('name')] = base64.decodestring(rc) return result
77134eca558999c5389a1d408cba1cb017916db9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/77134eca558999c5389a1d408cba1cb017916db9/trml2pdf.py
el = self.etree.findall('docinit')
el = self.etree.findall('.//docinit')
def render(self, out): el = self.etree.findall('docinit') if el: self.docinit(el)
77134eca558999c5389a1d408cba1cb017916db9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/77134eca558999c5389a1d408cba1cb017916db9/trml2pdf.py
el = self.etree.findall('stylesheet')
el = self.etree.findall('.//stylesheet')
def render(self, out): el = self.etree.findall('docinit') if el: self.docinit(el)
77134eca558999c5389a1d408cba1cb017916db9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/77134eca558999c5389a1d408cba1cb017916db9/trml2pdf.py
el = self.etree.findall('images')
el = self.etree.findall('.//images')
def render(self, out): el = self.etree.findall('docinit') if el: self.docinit(el)
77134eca558999c5389a1d408cba1cb017916db9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/77134eca558999c5389a1d408cba1cb017916db9/trml2pdf.py
el = self.etree.findall('template')
el = self.etree.findall('.//template')
def render(self, out): el = self.etree.findall('docinit') if el: self.docinit(el)
77134eca558999c5389a1d408cba1cb017916db9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/77134eca558999c5389a1d408cba1cb017916db9/trml2pdf.py
'description': fields.text('Note'),
'description': fields.text('Notes'),
def _compute_day(self, cr, uid, ids, fields, args, context={}): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual values """ cal_obj = self.pool.get('resource.calendar') res_obj = self.pool.get('resource.resource')
7909755eaa2beeaa9e8b6c4fdece32ba11b6ef67 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7909755eaa2beeaa9e8b6c4fdece32ba11b6ef67/crm_lead.py
def search(self, cr, user, args, offset=0, limit=None, order=None,
def search(self, cr, uid, args, offset=0, limit=None, order=None,
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if context and context.has_key('user_prefence') and context['user_prefence']: cmp_ids = [] data_user = self.pool.get('res.users').browse(cr, user, [user], context=context) map(lambda x: cmp_ids.append(x.id), data_user[0].company_ids) return [data_user[0].company_id.id] + cmp_ids return super(res_company, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
60f1981def2ffbdfc6ac94e8b0a1cd4dba2161da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60f1981def2ffbdfc6ac94e8b0a1cd4dba2161da/res_company.py
if context and context.has_key('user_prefence') and context['user_prefence']: cmp_ids = [] data_user = self.pool.get('res.users').browse(cr, user, [user], context=context) map(lambda x: cmp_ids.append(x.id), data_user[0].company_ids) return [data_user[0].company_id.id] + cmp_ids return super(res_company, self).search(cr, user, args, offset=offset, limit=limit, order=order,
user_preference = context and context.get('user_preference', False) or False if user_preference: user = self.pool.get('res.users').browse(cr, uid, uid, context=context) cmp_ids = list(set([user.company_id.id] + [cmp.id for cmp in user.company_ids])) return cmp_ids return super(res_company, self).search(cr, uid, args, offset=offset, limit=limit, order=order,
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if context and context.has_key('user_prefence') and context['user_prefence']: cmp_ids = [] data_user = self.pool.get('res.users').browse(cr, user, [user], context=context) map(lambda x: cmp_ids.append(x.id), data_user[0].company_ids) return [data_user[0].company_id.id] + cmp_ids return super(res_company, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
60f1981def2ffbdfc6ac94e8b0a1cd4dba2161da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60f1981def2ffbdfc6ac94e8b0a1cd4dba2161da/res_company.py
if (vals.has_key('alarm_id') or vals.has_key('base_calendar_alarm_id'))\ or (vals.has_key('date') or vals.has_key('duration') or vals.has_key('date_deadline')):
if ('alarm_id' in vals or 'base_calendar_alarm_id' in vals)\ or ('date' in vals or 'duration' in vals or 'date_deadline' in vals):
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ Overrides orm write method. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of crm meeting's ids @param vals: Dictionary of field value. @param context: A standard dictionary for contextual values @return: True """ if context is None: context = {} if isinstance(ids, (str, int, long)): select = [ids] else: select = ids new_ids = [] res = False for event_id in select: real_event_id = base_calendar_id2real_id(event_id) if len(str(event_id).split('-')) > 1: data = self.read(cr, uid, event_id, ['date', 'date_deadline', \ 'rrule', 'duration']) if data.get('rrule'): data.update({ 'recurrent_uid': real_event_id, 'recurrent_id': data.get('date'), 'rrule_type': 'none', 'rrule': '' }) data.update(vals) new_id = self.copy(cr, uid, real_event_id, default=data, context=context) context.update({'active_id': new_id, 'active_ids': [new_id]}) continue if not real_event_id in new_ids: new_ids.append(real_event_id)
27be0ec7e4213e6a6493c43fc23ad647a42a84dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/27be0ec7e4213e6a6493c43fc23ad647a42a84dc/base_calendar.py
alarm_obj.do_alarm_create(cr, uid, new_ids, self._name, 'date', \ context=context)
alarm_obj.do_alarm_create(cr, uid, new_ids, self._name, 'date', context=context)
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ Overrides orm write method. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of crm meeting's ids @param vals: Dictionary of field value. @param context: A standard dictionary for contextual values @return: True """ if context is None: context = {} if isinstance(ids, (str, int, long)): select = [ids] else: select = ids new_ids = [] res = False for event_id in select: real_event_id = base_calendar_id2real_id(event_id) if len(str(event_id).split('-')) > 1: data = self.read(cr, uid, event_id, ['date', 'date_deadline', \ 'rrule', 'duration']) if data.get('rrule'): data.update({ 'recurrent_uid': real_event_id, 'recurrent_id': data.get('date'), 'rrule_type': 'none', 'rrule': '' }) data.update(vals) new_id = self.copy(cr, uid, real_event_id, default=data, context=context) context.update({'active_id': new_id, 'active_ids': [new_id]}) continue if not real_event_id in new_ids: new_ids.append(real_event_id)
27be0ec7e4213e6a6493c43fc23ad647a42a84dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/27be0ec7e4213e6a6493c43fc23ad647a42a84dc/base_calendar.py
'state': fields.selection([('change_request', 'Change Request'),('change_proposed', 'Change Proposed'), ('in_production', 'In Production'), ('to_update', 'To Update'), ('validate', 'To Validate'), ('cancel', 'Cancel')], 'Status'), 'target_document_id': fields.many2one('document.directory', 'Target Document'), 'target':fields.binary('Target'),
'state': fields.selection([('in_production', 'In Production'), ('requested', 'Change Request'),('proposed', 'Change Proposed'), ('validated', 'To Validate'), ('cancel', 'Cancel')], 'State'), 'target_directory_id': fields.many2one('document.directory', 'Target Document'), 'target_document_id':fields.binary('Target'),
def state_done_set(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state':'done'}) return True
1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15/document_change.py
'state': lambda *a: 'change_request',
'state': lambda *a: 'in_production',
def state_done_set(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state':'done'}) return True
1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15/document_change.py
def state_set_request(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'change_request'},context=context)
def do_request(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'requested'},context=context)
def state_set_request(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'change_request'},context=context) return True
1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15/document_change.py
def state_set_proposed(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'change_proposed'},context=context) return True def state_set_in_production(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'in_production'}) return True def state_set_update(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'to_update'}) return True def state_set_validated(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'validate'},context=context) return True def state_set_cancel(self, cr, uid, ids, context={}):
def do_propose(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'proposed'},context=context) return True def do_validate(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'validated'},context=context) return True def do_production(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'in_production'},context=context) return True def do_cancel(self, cr, uid, ids, context={}):
def state_set_proposed(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'change_proposed'},context=context) return True
1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1cc0a4f66a306de207bb1f8a2ac9b90f8bb78c15/document_change.py
adrs_detail = dict(map(operator.attrgetter('id', 'address_id'), self.browse(cr, uid, ids, context=context))) for id,adrs in adrs_detail.items(): adrs_detail[id] = adrs.email return adrs_detail
return dict([(user.id, user.address_id.email) for user in self.browse(cr, uid, ids, context=context)])
def _email_get(self, cr, uid, ids, name, arg, context=None): adrs_detail = dict(map(operator.attrgetter('id', 'address_id'), self.browse(cr, uid, ids, context=context)))
3f57fd1716ac02eda1cec98408f0419b6e86145c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3f57fd1716ac02eda1cec98408f0419b6e86145c/res_user.py
'user_type': fields.many2one('account.account.type', 'Account Type', required=True,
'user_type': fields.many2one('account.account.type', 'Account Type', required=True,
def _get_child_ids(self, cr, uid, ids, field_name, arg, context={}): result = {} for record in self.browse(cr, uid, ids, context): if record.child_parent_ids: result[record.id] = [x.id for x in record.child_parent_ids] else: result[record.id] = []
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
def _check_moves(self, cr, uid, ids, method, context): line_obj = self.pool.get('account.move.line') account_ids = self.search(cr, uid, [('id', 'child_of', ids)]) if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]): if method == 'write': raise osv.except_osv(_('Error !'), _('You cannot deactivate an account that contains account moves.')) elif method == 'unlink': raise osv.except_osv(_('Error !'), _('You cannot remove an account which has account entries!. ')) return True
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
def write(self, cr, uid, ids, vals, context=None): if not context: context = {} if 'active' in vals and not vals['active']: self._check_moves(cr, uid, ids, "write", context) return super(account_account, self).write(cr, uid, ids, vals, context=context)
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
def unlink(self, cr, uid, ids, context={}): self._check_moves(cr, uid, ids, "unlink", context) return super(account_account, self).unlink(cr, uid, ids, context)
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
def _amount_compute(self, cr, uid, ids, name, args, context, where =''): if not ids: return {} cr.execute('select move_id,sum(debit) from account_move_line where move_id =ANY(%s) group by move_id',(ids,)) result = dict(cr.fetchall()) for id in ids: result.setdefault(id, 0.0) return result
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
res = [('id', 'in', [k for k,v in result.iteritems() if v <= item[2]])]
res = [('id', 'in', [k for k,v in result.iteritems() if v <= item[2]])]
def _search_amount(self, cr, uid, obj, name, args, context): ids = [] cr.execute('select move_id,sum(debit) from account_move_line group by move_id') result = dict(cr.fetchall())
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
if not ids:
if not ids:
def _search_amount(self, cr, uid, obj, name, args, context): ids = [] cr.execute('select move_id,sum(debit) from account_move_line group by move_id') result = dict(cr.fetchall())
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
if abs(amount) < 10 ** -(int(config['price_accuracy'])1):
if abs(amount) < 10 ** -(int(config['price_accuracy'])):
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
total = 0.0
total = 0.0
def reconcile_partial_check(self, cr, uid, ids, type='auto', context={}): total = 0.0 for rec in self.browse(cr, uid, ids, context): for line in rec.line_partial_ids: total += (line.debit or 0.0) - (line.credit or 0.0) if not total: self.pool.get('account.move.line').write(cr, uid, map(lambda x: x.id, rec.line_partial_ids), {'reconcile_id': rec.id } ) return True
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name','code'], context) res = [] for record in reads: name = record['name'] if record['code']: name = record['code']+' '+name res.append((record['id'],name )) return res
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
def _get_def_cparent(self, cr, uid, context): acc_obj=self.pool.get('account.account') tmpl_obj=self.pool.get('account.account.template') #print "Searching for ",context tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']],['parent_id']) if not tids or not tids[0]['parent_id']: return False ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]],['code']) if not ptids or not ptids[0]['code']: raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!')) res = acc_obj.search(cr,uid,[('code','=',ptids[0]['code'])]) if res: return res[0] else: return False
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
def action_create(self,cr,uid,ids,context=None): acc_obj=self.pool.get('account.account') tmpl_obj=self.pool.get('account.account.template') data= self.read(cr,uid,ids) company_id = acc_obj.read(cr,uid,[data[0]['cparent_id']],['company_id'])[0]['company_id'][0] account_template = tmpl_obj.browse(cr,uid,context['tmpl_ids']) #tax_ids = [] #for tax in account_template.tax_ids: # tax_ids.append(tax_template_ref[tax.id]) vals={ 'name': account_template.name, #'sign': account_template.sign, 'currency_id': account_template.currency_id and account_template.currency_id.id or False, 'code': account_template.code, 'type': account_template.type, 'user_type': account_template.user_type and account_template.user_type.id or False, 'reconcile': account_template.reconcile, 'shortcut': account_template.shortcut, 'note': account_template.note, 'parent_id': data[0]['cparent_id'], # 'tax_ids': [(6,0,tax_ids)], todo!! 'company_id': company_id, } # print "Creating:", vals new_account = acc_obj.create(cr,uid,vals) return {'type':'state', 'state': 'end' }
08f80fef8247f1b3b0e6a471843288c158f6c888 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/08f80fef8247f1b3b0e6a471843288c158f6c888/account.py
password = base64.b64decode(password)
try: password = base64.b64decode(password) except: pass
def open_connection(self, cr, uid, ids, serverid=False, permission=True): if serverid: self.server[serverid] = self.getpassword(cr, uid, [serverid])[0] else: raise osv.except_osv(_('Read Error!'), _('Unable to read Server Settings')) if permission: if not self.check_permissions(cr, uid, [serverid]): raise osv.except_osv(_('Permission Error!'), _('You have no permission to access SMTP Server : %s ') % (self.server[serverid]['name'],) ) if self.server[serverid]: try: self.smtpServer[serverid] = smtplib.SMTP() self.smtpServer[serverid].debuglevel = 0 self.smtpServer[serverid].connect(str(self.server[serverid]['server']),str(self.server[serverid]['port'])) if self.server[serverid]['ssl']: self.smtpServer[serverid].ehlo() self.smtpServer[serverid].starttls() self.smtpServer[serverid].ehlo() if self.server[serverid]['auth']: password = self.server[serverid]['password'] password = base64.b64decode(password) self.smtpServer[serverid].login(str(self.server[serverid]['user']), password)
6cbabb46e6f3d2b9da1d3ed465bb0feba5d42271 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6cbabb46e6f3d2b9da1d3ed465bb0feba5d42271/smtpclient.py
logger = netsvc.Logger() logger.notifyChannel('orm', netsvc.LOG_ERROR, "Programming error: field '%s' does not exist in object '%s' !" % (name, self._table._name)) return None
self.logger.notifyChannel("browse_record", netsvc.LOG_WARNING, "Field '%s' does not exist in object '%s': \n%s" % ( name, self, ''.join(traceback.format_trace()))) raise KeyError("Field '%s' does not exist in object '%s'" % ( name, self))
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
a62d77fa115760328a1fb133b2ddc3f2846849b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a62d77fa115760328a1fb133b2ddc3f2846849b9/orm.py
raise except_orm('NoDataError', 'Field %s in %s%s'%(name,self._table_name,str(ids)))
self.logger.notifyChannel("browse_record", netsvc.LOG_WARNING, "No datas found for ids %s in %s \n%s" % ( ids, self, ''.join(traceback.format_trace()))) raise KeyError('Field %s not found in %s'%(name,self))
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
a62d77fa115760328a1fb133b2ddc3f2846849b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a62d77fa115760328a1fb133b2ddc3f2846849b9/orm.py
logger = netsvc.Logger() logger.notifyChannel("browse_record", netsvc.LOG_ERROR,"Ffields: %s, datas: %s"%(str(fffields),str(datas))) logger.notifyChannel("browse_record", netsvc.LOG_ERROR,"Data: %s, Table: %s"%(str(self._data[self._id]),str(self._table))) raise AttributeError(_('Unknown attribute %s in %s ') % (str(name),self._table_name))
self.logger.notifyChannel("browse_record", netsvc.LOG_ERROR, "Ffields: %s, datas: %s"%(fffields, datas)) self.logger.notifyChannel("browse_record", netsvc.LOG_ERROR, "Data: %s, Table: %s"%(self._data[self._id], self._table)) raise KeyError(_('Unknown attribute %s in %s ') % (name, self))
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
a62d77fa115760328a1fb133b2ddc3f2846849b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a62d77fa115760328a1fb133b2ddc3f2846849b9/orm.py
return self[name]
try: return self[name] except KeyError, e: raise AttributeError(e)
def __getattr__(self, name):
a62d77fa115760328a1fb133b2ddc3f2846849b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a62d77fa115760328a1fb133b2ddc3f2846849b9/orm.py
raise osv.except_osv(_('Error !'), _('You can not modify Project Time Unit as there are open or pending tasks created with current time unit.))
raise osv.except_osv(_('Error !'), _('You cannot modify Project Time Unit as there are open or pending tasks created with current time unit.'))
def write(self, cr, uid, ids,vals, context={}): task_ids=self.pool.get('project.task').search(cr, uid, [('state','in',['open', 'pending'])]) if ('project_time_mode_id' in vals) and task_ids: raise osv.except_osv(_('Error !'), _('You can not modify Project Time Unit as there are open or pending tasks created with current time unit.)) return super(res_company,self).write(cr, uid, ids, vals, context=context)
c63c8e3dfe7e13aff83c05332d082438c5ead49b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c63c8e3dfe7e13aff83c05332d082438c5ead49b/company.py
values['section_id']=case.section_id and case.section_id.id or False,
values['section_id']=case.section_id and case.section_id.id
def action_apply(self, cr, uid, ids, context=None): this = self.browse(cr, uid, ids)[0] values={} record_id = context and context.get('record_id', False) or False if record_id: for case in self.pool.get('crm.phonecall').browse(cr, uid, [record_id], context=context): values['name']=this.name values['user_id']=this.user_id and this.user_id.id values['categ_id']=case.categ_id and case.categ_id.id or False values['section_id']=case.section_id and case.section_id.id or False, values['description']=case.description or '' values['partner_id']=case.partner_id.id values['partner_address_id']=case.partner_address_id.id values['partner_mobile']=case.partner_mobile or False values['priority']=case.priority values['partner_phone']=case.partner_phone or False values['date']=this.date phonecall_proxy = self.pool.get('crm.phonecall') phonecall_id = phonecall_proxy.create(cr, uid, values, context=context) value = { 'name': _('Phone Call'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'crm.phonecall', 'view_id': False, 'type': 'ir.actions.act_window', 'res_id': phonecall_id } return value
f687c22859105bfe605732ad2735eb0f0f15606b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f687c22859105bfe605732ad2735eb0f0f15606b/crm_phonecall2phonecall.py
'db_datas': fields.binary('Data', oldname='datas'), 'index_content': fields.text('Indexed Content'), 'write_date': fields.datetime('Date Modified', readonly=True), 'write_uid': fields.many2one('res.users', 'Last Modification User', readonly=True), 'create_date': fields.datetime('Date Created', readonly=True), 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), 'store_method': fields.selection([('db', 'Database'), ('fs', 'Filesystem'), ('link', 'Link')], "Storing Method"), 'datas': fields.function(_data_get, method=True, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True), 'url': fields.char('File URL',size=64),
def _data_set(self, cr, uid, id, name, value, arg, context): if not value: return True fbro = self.browse(cr, uid, id, context=context) nctx = nodes.get_node_context(cr, uid, context) fnode = nodes.node_file(None, None, nctx, fbro) res = fnode.set_data(cr, base64.decodestring(value), fbro) return res
6eef5d7e360353c60a56d0b1ab4c3484f80059d8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6eef5d7e360353c60a56d0b1ab4c3484f80059d8/document.py
'res_model': fields.char('Attached Model', size=64), 'res_id': fields.integer('Attached ID'), 'partner_id':fields.many2one('res.partner', 'Partner', select=1), 'type':fields.selection([ ('url','URL'), ('binary','Binary'), ],'Type', help="Type is used to separate URL and binary File"), 'company_id': fields.many2one('res.company', 'Company'),
def _data_set(self, cr, uid, id, name, value, arg, context): if not value: return True fbro = self.browse(cr, uid, id, context=context) nctx = nodes.get_node_context(cr, uid, context) fnode = nodes.node_file(None, None, nctx, fbro) res = fnode.set_data(cr, base64.decodestring(value), fbro) return res
6eef5d7e360353c60a56d0b1ab4c3484f80059d8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6eef5d7e360353c60a56d0b1ab4c3484f80059d8/document.py
'store_method': lambda *args: 'db', 'type': 'binary',
def __get_def_directory(self, cr, uid, context=None): dirobj = self.pool.get('document.directory') return dirobj._get_root_directory(cr, uid, context)
6eef5d7e360353c60a56d0b1ab4c3484f80059d8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6eef5d7e360353c60a56d0b1ab4c3484f80059d8/document.py
def export_data(self, cr, uid, ids, fields_to_export, context=None):
ccc031a3999cd05450ce057f89759141d309b3e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ccc031a3999cd05450ce057f89759141d309b3e9/base_report_creator.py
for i in data_l:
for record in data_l:
def export_data(self, cr, uid, ids, fields_to_export, context=None):
ccc031a3999cd05450ce057f89759141d309b3e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ccc031a3999cd05450ce057f89759141d309b3e9/base_report_creator.py
for key, value in i.items(): if key not in fields_to_export: continue
for key in fields_to_export: value = record.get(key,'')
def export_data(self, cr, uid, ids, fields_to_export, context=None):
ccc031a3999cd05450ce057f89759141d309b3e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ccc031a3999cd05450ce057f89759141d309b3e9/base_report_creator.py
def _get_fiscalyear(self, form):
def _get_fiscalyear(self, data):
def _get_fiscalyear(self, form): if data.get('form', False) and data['form'].get('fiscalyear_id', False): return pooler.get_pool(self.cr.dbname).get('account.fiscalyear').browse(self.cr, self.uid, data['form']['fiscalyear_id']).name return ''
78306091144945367666dbf9643b76ca1d321886 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/78306091144945367666dbf9643b76ca1d321886/account_journal_common_default.py
def _get_company(self, form):
def _get_company(self, data):
def _get_company(self, form): if data.get('form', False) and data['form'].get('company_id', False): comp_obj = pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, data['form']['company_id']) return comp_obj.name
78306091144945367666dbf9643b76ca1d321886 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/78306091144945367666dbf9643b76ca1d321886/account_journal_common_default.py
return super(scrum_product_backlog, self).name_search(cr, uid, name, args, operator,context, limit=limit)
return super(project_scrum_product_backlog, self).name_search(cr, uid, name, args, operator,context, limit=limit)
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100): if not args: args=[] if not context: context={} match = re.match('^S\(([0-9]+)\)$', name) if match: ids = self.search(cr, uid, [('sprint_id','=', int(match.group(1)))], limit=limit, context=context) return self.name_get(cr, uid, ids, context=context) return super(scrum_product_backlog, self).name_search(cr, uid, name, args, operator,context, limit=limit)
e018cce62721e614c5be9486a2584276038a34a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e018cce62721e614c5be9486a2584276038a34a8/project_scrum.py
result.append(_name_get(self.read(cr, user, product.id, ['variants','name','default_code'], context=context)))
mydict = { 'id': product.id, 'name': product.name, 'default_code': product.default_code, 'variants': product.variants } result.append(_name_get(mydict))
def _name_get(d): name = d.get('name','') code = d.get('default_code',False) if code: name = '[%s] %s' % (code,name) if d.get('variants'): name = name + ' - %s' % (d['variants'],) return (d['id'], name)
5cc52dfff185f84f110e4b7c95c987fe6e1b417a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5cc52dfff185f84f110e4b7c95c987fe6e1b417a/product.py
cr.execute('select id from %s where recurrent_uid=%s' , (self._table, event_id))
cr.execute("select id from %s where recurrent_uid=%%s" % (self._table), (event_id,))
def unlink_events(self, cr, uid, ids, context=None): """ This function deletes event which are linked with the event with recurrent_uid (Removes the events which refers to the same UID value) """ if not context: context = {} for event_id in ids: cr.execute('select id from %s where recurrent_uid=%s' , (self._table, event_id)) r_ids = map(lambda x: x[0], cr.fetchall()) self.unlink(cr, uid, r_ids, context=context) return True
43642c4ca6456da85f101e4d3a818ae706665bc0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/43642c4ca6456da85f101e4d3a818ae706665bc0/base_calendar.py
valss['journal_id'] = data['journal_id']
vals['journal_id'] = data['journal_id']
def get_in(self, cr, uid, ids, context=None): """ Create the entry of statement in journal. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return :Return of operation of product """ statement_obj = self.pool.get('account.bank.statement') res_obj = self.pool.get('res.users') product_obj = self.pool.get('product.product') bank_statement = self.pool.get('account.bank.statement.line') for data in self.read(cr, uid, ids, context=context): vals = {} curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id statement_id = statement_obj.search(cr, uid, [('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context) if not statement_id: raise osv.except_osv(_('Error !'), _('You have to open at least one cashbox'))
dab7efb97727fff7fae12b3c0a1c66195c0bbae6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/dab7efb97727fff7fae12b3c0a1c66195c0bbae6/pos_box_entries.py
def _create_chained_picking(self, cr, uid, pick_name,picking,ptype,move, context=None):
def _create_chained_picking(self, cr, uid, pick_name, picking, ptype, move, context=None):
def _create_chained_picking(self, cr, uid, pick_name,picking,ptype,move, context=None): res_obj = self.pool.get('res.company') picking_obj = self.pool.get('stock.picking') pick_id= picking_obj.create(cr, uid, { 'name': pick_name, 'origin': str(picking.origin or ''), 'type': ptype, 'note': picking.note, 'move_type': picking.move_type, 'auto_picking': move[0][1][1] == 'auto', 'stock_journal_id': move[0][1][3], 'company_id': move[0][1][4] or res_obj._company_default_get(cr, uid, 'stock.company', context=context), 'address_id': picking.address_id.id, 'invoice_state': 'none', 'date': picking.date, }) return pick_id
48f64d6312199407ca1dd6d5297e50deaa59cf9c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/48f64d6312199407ca1dd6d5297e50deaa59cf9c/stock.py
pick_name = picking.name or ''
def create_chained_picking(self, cr, uid, moves, context=None): new_moves = [] if context is None: context = {} for picking, todo in self._chain_compute(cr, uid, moves, context=context).items(): ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0]) pick_name = picking.name or '' if picking: pickid = self._create_chained_picking(cr, uid, pick_name,picking,ptype,todo,context) else: pickid = False for move, (loc, dummy, delay, dummy, company_id, ptype) in todo: new_id = move_obj.copy(cr, uid, move.id, { 'location_id': move.location_dest_id.id, 'location_dest_id': loc.id, 'date_moved': time.strftime('%Y-%m-%d'), 'picking_id': pickid, 'state': 'waiting', 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) , 'move_history_ids': [], 'date': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'), 'move_history_ids2': []} ) move_obj.write(cr, uid, [move.id], { 'move_dest_id': new_id, 'move_history_ids': [(4, new_id)] }) new_moves.append(self.browse(cr, uid, [new_id])[0]) if pickid: wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr) if new_moves: new_moves += create_chained_picking(self, cr, uid, new_moves, context) return new_moves
48f64d6312199407ca1dd6d5297e50deaa59cf9c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/48f64d6312199407ca1dd6d5297e50deaa59cf9c/stock.py
pickid = self._create_chained_picking(cr, uid, pick_name,picking,ptype,todo,context)
new_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + ptype) pickid = self._create_chained_picking(cr, uid, new_pick_name, picking, ptype, todo, context=context) old_ptype = location_obj.picking_type_get(cr, uid, picking.move_lines[0].location_id, picking.move_lines[0].location_dest_id) if old_ptype != picking.type: old_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + old_ptype) self.pool.get('stock.picking').write(cr, uid, picking.id, {'name': old_pick_name}, context=context)
def create_chained_picking(self, cr, uid, moves, context=None): new_moves = [] if context is None: context = {} for picking, todo in self._chain_compute(cr, uid, moves, context=context).items(): ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0]) pick_name = picking.name or '' if picking: pickid = self._create_chained_picking(cr, uid, pick_name,picking,ptype,todo,context) else: pickid = False for move, (loc, dummy, delay, dummy, company_id, ptype) in todo: new_id = move_obj.copy(cr, uid, move.id, { 'location_id': move.location_dest_id.id, 'location_dest_id': loc.id, 'date_moved': time.strftime('%Y-%m-%d'), 'picking_id': pickid, 'state': 'waiting', 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) , 'move_history_ids': [], 'date': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'), 'move_history_ids2': []} ) move_obj.write(cr, uid, [move.id], { 'move_dest_id': new_id, 'move_history_ids': [(4, new_id)] }) new_moves.append(self.browse(cr, uid, [new_id])[0]) if pickid: wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr) if new_moves: new_moves += create_chained_picking(self, cr, uid, new_moves, context) return new_moves
48f64d6312199407ca1dd6d5297e50deaa59cf9c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/48f64d6312199407ca1dd6d5297e50deaa59cf9c/stock.py
def name_search(self, cr, uid, name='', args=None, operator='ilike', context=None, limit=None): if not args: args = [] if context is None: context = {} if name: ids = self.search(cr, uid, ['|',('name', operator, name),('first_name', operator, name)] + args, limit=limit, context=context) else: ids = self.search(cr, uid, args, limit=limit, context=context) return self.name_get(cr, uid, ids, context=context)
def name_get(self, cr, user, ids, context={}):
3388b58b28696006cfddf3bab2de48747c58966a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3388b58b28696006cfddf3bab2de48747c58966a/base_contact.py
return res def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ search parnter job @param self: The object pointer @param cr: the current row, from the database cursor, @param user: the current user @param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...]. @param offset: The Number of Results to Pass @param limit: The Number of Results to Return @param context: A standard dictionary for contextual values """ job_ids = [] for arg in args: if arg[0] == 'address_id': self._order = 'sequence_partner' elif arg[0] == 'contact_id': self._order = 'sequence_contact' contact_obj = self.pool.get('res.partner.contact') if arg[2] and not count: search_arg = ['|', ('first_name', 'ilike', arg[2]), ('name', 'ilike', arg[2])] contact_ids = contact_obj.search(cr, user, search_arg, offset=offset, limit=limit, order=order, context=context, count=count) if not contact_ids: continue contacts = contact_obj.browse(cr, user, contact_ids, context=context) for contact in contacts: job_ids.extend([item.id for item in contact.job_ids]) res = super(res_partner_job,self).search(cr, user, args, offset=offset,\ limit=limit, order=order, context=context, count=count) if job_ids: res = list(set(res + job_ids))
def name_get(self, cr, uid, ids, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param user: the current user, @param ids: List of partner address’s IDs @param context: A standard dictionary for contextual values """ if context is None: context = {}
3388b58b28696006cfddf3bab2de48747c58966a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3388b58b28696006cfddf3bab2de48747c58966a/base_contact.py
produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
product_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit): """ On change of operation type it sets source location, destination location and to invoice field. @param product: Changed operation type. @param guarantee_limit: Guarantee limit of current record. @return: Dictionary of values. """ if not type: return {'value': { 'location_id': False, 'location_dest_id': False } } produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
be1a8c1e604749abf7ee3480839b37552209b85e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/be1a8c1e604749abf7ee3480839b37552209b85e/mrp_repair.py
'location_id': produc_id,
'location_id': product_id,
def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit): """ On change of operation type it sets source location, destination location and to invoice field. @param product: Changed operation type. @param guarantee_limit: Guarantee limit of current record. @return: Dictionary of values. """ if not type: return {'value': { 'location_id': False, 'location_dest_id': False } } produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
be1a8c1e604749abf7ee3480839b37552209b85e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/be1a8c1e604749abf7ee3480839b37552209b85e/mrp_repair.py
'location_dest_id': produc_id
'location_dest_id': product_id
def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit): """ On change of operation type it sets source location, destination location and to invoice field. @param product: Changed operation type. @param guarantee_limit: Guarantee limit of current record. @return: Dictionary of values. """ if not type: return {'value': { 'location_id': False, 'location_dest_id': False } } produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
be1a8c1e604749abf7ee3480839b37552209b85e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/be1a8c1e604749abf7ee3480839b37552209b85e/mrp_repair.py
def _get_currency(self, data): if data.get('form', False) and data['form'].get('chart_account_id', False): return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr, self.uid, data['form']['chart_account_id']).company_id.currency_id.symbol return ''
b6cf4dfb75931dbb2f5414b31e41e0845cb49c0f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b6cf4dfb75931dbb2f5414b31e41e0845cb49c0f/common_report_header.py
if not pick.move_lines: return False
def test_cancel(self, cr, uid, ids, context=None): """ Test whether the move lines are canceled or not. @return: True or False """ for pick in self.browse(cr, uid, ids, context=context): if not pick.move_lines: return False for move in pick.move_lines: if move.state not in ('cancel',): return False return True
b333a3cb7db86697afa6c676a7dc65570612a164 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b333a3cb7db86697afa6c676a7dc65570612a164/stock.py
create or replace view report_stock_move as ( select
CREATE OR REPLACE view report_stock_move AS ( SELECT
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
sum(value) as value,
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
al.stock_journal as stock_journal
al.stock_journal as stock_journal, sum(al.in_value - al.out_value) as value
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
sum(sm.product_qty) END AS out_qty,
sum(sm.product_qty * pu.factor) ELSE 0.0 END AS out_qty,
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
sum(sm.product_qty) END AS in_qty,
sum(sm.product_qty * pu.factor) ELSE 0.0 END AS in_qty, CASE WHEN sp.type in ('out','delivery') THEN sum(sm.product_qty * pu.factor) * pt.standard_price ELSE 0.0 END AS out_value, CASE WHEN sp.type in ('in') THEN sum(sm.product_qty * pu.factor) * pt.standard_price ELSE 0.0 END AS in_value,
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
sum(sm.product_qty) as product_qty , (pt.standard_price *pu.factor* sum(sm.product_qty)) as value,
sum(sm.product_qty) as product_qty,
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
sp.stock_journal_id as stock_journal from
sp.stock_journal_id AS stock_journal FROM
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
left join stock_picking sp on (sm.picking_id=sp.id) left join product_product pp on (sm.product_id=pp.id) left join product_uom pu on (sm.product_uom=pu.id) left join product_template pt on (pp.product_tmpl_id=pt.id) left join stock_location sl on (sm.location_id = sl.id) group by
LEFT JOIN stock_picking sp ON (sm.picking_id=sp.id) LEFT JOIN product_product pp ON (sm.product_id=pp.id) LEFT JOIN product_uom pu ON (sm.product_uom=pu.id) LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) LEFT JOIN stock_location sl ON (sm.location_id = sl.id) GROUP BY
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
as al group by
AS al GROUP BY
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" create or replace view report_stock_move as ( select min(sm_id) as id, sum(value) as value, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as day_diff2, al.location_id as location_id, al.picking_id as picking_id, al.company_id as company_id, al.location_dest_id as location_dest_id, al.product_qty, al.out_qty as product_qty_out, al.in_qty as product_qty_in, al.address_id as partner_id, al.product_id as product_id, al.state as state , al.product_uom as product_uom, al.categ_id as categ_id, coalesce(al.type, 'other') as type, al.stock_journal as stock_journal FROM (SELECT
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py