rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
date=context['date'] | date = context['date'] | def _current_rate(self, cr, uid, ids, name, arg, context={}): res={} if 'date' in context: date=context['date'] else: date=time.strftime('%Y-%m-%d') date= date or time.strftime('%Y-%m-%d') for id in ids: cr.execute("SELECT currency_id, rate FROM res_currency_rate WHERE currency_id = %s AND name <= %s ORDER BY name desc LIMIT 1" ,(id, date)) if cr.rowcount: id, rate=cr.fetchall()[0] res[id]=rate else: res[id]=0 return res | 36b0157f8b336cf9d43a953525eed60e7d679f75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/36b0157f8b336cf9d43a953525eed60e7d679f75/res_currency.py |
date=time.strftime('%Y-%m-%d') date= date or time.strftime('%Y-%m-%d') | date = time.strftime('%Y-%m-%d') date = date or time.strftime('%Y-%m-%d') | def _current_rate(self, cr, uid, ids, name, arg, context={}): res={} if 'date' in context: date=context['date'] else: date=time.strftime('%Y-%m-%d') date= date or time.strftime('%Y-%m-%d') for id in ids: cr.execute("SELECT currency_id, rate FROM res_currency_rate WHERE currency_id = %s AND name <= %s ORDER BY name desc LIMIT 1" ,(id, date)) if cr.rowcount: id, rate=cr.fetchall()[0] res[id]=rate else: res[id]=0 return res | 36b0157f8b336cf9d43a953525eed60e7d679f75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/36b0157f8b336cf9d43a953525eed60e7d679f75/res_currency.py |
id, rate=cr.fetchall()[0] res[id]=rate | id, rate = cr.fetchall()[0] res[id] = rate | def _current_rate(self, cr, uid, ids, name, arg, context={}): res={} if 'date' in context: date=context['date'] else: date=time.strftime('%Y-%m-%d') date= date or time.strftime('%Y-%m-%d') for id in ids: cr.execute("SELECT currency_id, rate FROM res_currency_rate WHERE currency_id = %s AND name <= %s ORDER BY name desc LIMIT 1" ,(id, date)) if cr.rowcount: id, rate=cr.fetchall()[0] res[id]=rate else: res[id]=0 return res | 36b0157f8b336cf9d43a953525eed60e7d679f75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/36b0157f8b336cf9d43a953525eed60e7d679f75/res_currency.py |
res[id]=0 | res[id] = 0 | def _current_rate(self, cr, uid, ids, name, arg, context={}): res={} if 'date' in context: date=context['date'] else: date=time.strftime('%Y-%m-%d') date= date or time.strftime('%Y-%m-%d') for id in ids: cr.execute("SELECT currency_id, rate FROM res_currency_rate WHERE currency_id = %s AND name <= %s ORDER BY name desc LIMIT 1" ,(id, date)) if cr.rowcount: id, rate=cr.fetchall()[0] res[id]=rate else: res[id]=0 return res | 36b0157f8b336cf9d43a953525eed60e7d679f75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/36b0157f8b336cf9d43a953525eed60e7d679f75/res_currency.py |
currency_rate_obj=self.pool.get('res.currency.rate') currency_date=currency_rate_obj.read(cr,user,rates[0],['name'])['name'] r['date']=currency_date | currency_rate_obj= self.pool.get('res.currency.rate') currency_date = currency_rate_obj.read(cr,user,rates[0],['name'])['name'] r['date'] = currency_date | def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): res=super(osv.osv, self).read(cr, user, ids, fields, context, load) for r in res: if r.__contains__('rate_ids'): rates=r['rate_ids'] if rates: currency_rate_obj=self.pool.get('res.currency.rate') currency_date=currency_rate_obj.read(cr,user,rates[0],['name'])['name'] r['date']=currency_date return res | 36b0157f8b336cf9d43a953525eed60e7d679f75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/36b0157f8b336cf9d43a953525eed60e7d679f75/res_currency.py |
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context={}, account=None, account_invert=False): | def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} | def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context={}, account=None, account_invert=False): if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: code = from_currency.code else: code = to_currency.code raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (code, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate) | 36b0157f8b336cf9d43a953525eed60e7d679f75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/36b0157f8b336cf9d43a953525eed60e7d679f75/res_currency.py |
return dict([(a["id"], "%s (%s)" % (a['email_id'], a['name'])) for a in self.read(cr, uid, ids, ['name', 'email_id'], context=context)]) | return [(a["id"], "%s (%s)" % (a['email_id'], a['name'])) for a in self.read(cr, uid, ids, ['name', 'email_id'], context=context)] | def name_get(self, cr, uid, ids, context=None): return dict([(a["id"], "%s (%s)" % (a['email_id'], a['name'])) for a in self.read(cr, uid, ids, ['name', 'email_id'], context=context)]) | 9dad4a098e637ab9e45ef7b483634d0571cfda52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9dad4a098e637ab9e45ef7b483634d0571cfda52/email_template_account.py |
@param details: Description, Ddtails of case history if any | @param details: Description, Details of case history if any | def history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, email_cc=None, \ email_bcc=None, email_date=None, context=None): """ @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 cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email-To / Recipient address @param email_from: Email From / Sender address if any @param email_cc: Comma-Separated list of Carbon Copy Emails To addresse if any @param email_bcc: Comma-Separated list of Blind Carbon Copy Emails To addresses if any @param email_date: Email Date string if different from now, in server Timezone @param details: Description, Ddtails of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = [] | 91147298af06d8794f21edb9c87d76078f43d951 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/91147298af06d8794f21edb9c87d76078f43d951/mail_gateway.py |
'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner"), | 'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner", store=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 True | 56e877f5ab679222d4f483ad3c30d040da778190 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/56e877f5ab679222d4f483ad3c30d040da778190/stock.py |
if context.get('active_model','') in ['res.partner']: partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0] | if context is None: context = {} if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']: partner = self.pool.get(context['active_model']).read(cr, uid, context['active_ids'], ['supplier','customer'])[0] | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): journal_obj = self.pool.get('account.journal') if context.get('active_model','') in ['res.partner']: partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0] if not view_type: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0] view_type = 'tree' if view_type == 'form': if partner['supplier'] and not partner['customer']: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0] else: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0] res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) type = context.get('journal_type', 'sale') for field in res['fields']: if field == 'journal_id': journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1) res['fields'][field]['selection'] = journal_select | 87372a16dea552b4113d4877f1bbfd9df0532551 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/87372a16dea552b4113d4877f1bbfd9df0532551/invoice.py |
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0] | view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')])[0] | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): journal_obj = self.pool.get('account.journal') if context.get('active_model','') in ['res.partner']: partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0] if not view_type: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0] view_type = 'tree' if view_type == 'form': if partner['supplier'] and not partner['customer']: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0] else: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0] res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) type = context.get('journal_type', 'sale') for field in res['fields']: if field == 'journal_id': journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1) res['fields'][field]['selection'] = journal_select | 87372a16dea552b4113d4877f1bbfd9df0532551 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/87372a16dea552b4113d4877f1bbfd9df0532551/invoice.py |
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0] | view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.supplier.form')])[0] | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): journal_obj = self.pool.get('account.journal') if context.get('active_model','') in ['res.partner']: partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0] if not view_type: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0] view_type = 'tree' if view_type == 'form': if partner['supplier'] and not partner['customer']: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0] else: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0] res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) type = context.get('journal_type', 'sale') for field in res['fields']: if field == 'journal_id': journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1) res['fields'][field]['selection'] = journal_select | 87372a16dea552b4113d4877f1bbfd9df0532551 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/87372a16dea552b4113d4877f1bbfd9df0532551/invoice.py |
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0] | view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.form')])[0] | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): journal_obj = self.pool.get('account.journal') if context.get('active_model','') in ['res.partner']: partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0] if not view_type: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0] view_type = 'tree' if view_type == 'form': if partner['supplier'] and not partner['customer']: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0] else: view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0] res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) type = context.get('journal_type', 'sale') for field in res['fields']: if field == 'journal_id': journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1) res['fields'][field]['selection'] = journal_select | 87372a16dea552b4113d4877f1bbfd9df0532551 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/87372a16dea552b4113d4877f1bbfd9df0532551/invoice.py |
def msg_new(self, msg): message = self.msg_body_get(msg) data = { 'name': self._decode_header(msg['Subject']), 'email_from': self._decode_header(msg['From']), 'email_cc': self._decode_header(msg['Cc'] or ''), 'canal_id': self.canal_id, 'user_id': False, 'description': message['body'], } data.update(self.partner_get(self._decode_header(msg['From']))) | 50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc/openerp_mailgate.py |
||
def replace(match): return '' | 50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc/openerp_mailgate.py |
||
'description': body['body'], | def msg_user(self, msg, id): body = self.msg_body_get(msg) | 50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc/openerp_mailgate.py |
|
self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], message['body']) | self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], body['body']) | def msg_user(self, msg, id): body = self.msg_body_get(msg) | 50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc/openerp_mailgate.py |
body2 = '\n'.join(map(lambda l: '> '+l, (body or '').split('\n'))) data = { 'description':body, } self.rpc(self.model, 'write', [id], data) | def msg_partner(self, msg, id): message = self.msg_body_get(msg) body = message['body'] act = 'case_open' self.rpc(self.model, act, [id]) body2 = '\n'.join(map(lambda l: '> '+l, (body or '').split('\n'))) data = { 'description':body, } self.rpc(self.model, 'write', [id], data) self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], message['body']) return id | 50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc/openerp_mailgate.py |
|
def parse(self, msg): case_str = reference_re.search(msg.get('References', '')) if case_str: case_str = case_str.group(1) else: case_str = case_re.search(msg.get('Subject', '')) if case_str: case_str = case_str.group(1) (case_id, emails) = self.msg_test(msg, case_str) if case_id: if emails[0] and self.email_get(emails[0])==self.email_get(self._decode_header(msg['From'])): self.msg_user(msg, case_id) else: self.msg_partner(msg, case_id) else: case_id = self.msg_new(msg) subject = self._decode_header(msg['subject']) if msg.get('Subject', ''): del msg['Subject'] msg['Subject'] = '['+str(case_id)+'] '+subject msg['Message-Id'] = '<'+str(time.time())+'-openerpcrm-'+str(case_id)+'@'+socket.gethostname()+'>' | 50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50005078fc6a0c1da2fc90e8a4bd7a52c3231bcc/openerp_mailgate.py |
||
except ExceptionNoTb: | except security.ExceptionNoTb: | def check(self, db, uid, passwd): try: return super(users,self).check(db, uid, passwd) except ExceptionNoTb: # AccessDenied pass cr = pooler.get_db(db).cursor() user = self.browse(cr, 1, uid) logger = logging.getLogger('orm.ldap') if user and user.company_id.ldaps: for res_company_ldap in user.company_id.ldaps: try: l = ldap.open(res_company_ldap.ldap_server, res_company_ldap.ldap_server_port) if l.simple_bind_s(res_company_ldap.ldap_binddn, res_company_ldap.ldap_password): base = res_company_ldap.ldap_base scope = ldap.SCOPE_SUBTREE filter = filter_format(res_company_ldap.ldap_filter, (user.login,)) retrieve_attributes = None result_id = l.search(base, scope, filter, retrieve_attributes) timeout = 60 result_type, result_data = l.result(result_id, timeout) if result_data and result_type == ldap.RES_SEARCH_RESULT and len(result_data) == 1: dn = result_data[0][0] if l.bind_s(dn, passwd): l.unbind() self._uid_cache.setdefault(db, {})[uid] = passwd cr.close() return True l.unbind() except Exception, e: logger.warning('cannot check', exc_info=True) pass cr.close() raise security.ExceptionNoTb('AccessDenied') | bb8533edc6ed45ecb4996f1f7951b5ccbaccd9c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bb8533edc6ed45ecb4996f1f7951b5ccbaccd9c0/users_ldap.py |
if form['qty'+str(i)] > 0 and form['qty'+str(i)] not in vals.values(): vals['qty'+str(qtys)] = form['qty'+str(i)] qtys += 1 | vals['qty'+str(qtys)] = form['qty'+str(i)] qtys += 1 | def _get_titles(self,form): lst = [] vals = {} qtys = 1 | aa7b817b4222f234e8e037c630dd89e3baba3594 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aa7b817b4222f234e8e037c630dd89e3baba3594/product_pricelist.py |
else: self.quantity.append(0) | def _set_quantity(self,form): for i in range(1,6): q = 'qty%d'%i if form[q] >0 and form[q] not in self.quantity: self.quantity.append(form[q]) | aa7b817b4222f234e8e037c630dd89e3baba3594 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aa7b817b4222f234e8e037c630dd89e3baba3594/product_pricelist.py |
|
val['qty'+str(i)] = "" | val['qty'+str(i)] = 0.0 | def _get_categories(self, products,form): cat_ids=[] res=[] self.pricelist = form['price_list'] self._set_quantity(form) pool = pooler.get_pool(self.cr.dbname) pro_ids=[] for product in products: pro_ids.append(product.id) if product.categ_id.id not in cat_ids: cat_ids.append(product.categ_id.id) cats = pool.get('product.category').read(self.cr, self.uid, cat_ids, ['name']) for cat in cats: product_ids=pool.get('product.product').search(self.cr, self.uid, [('id','in',pro_ids),('categ_id','=',cat['id'])]) products = [] for product in pool.get('product.product').read(self.cr, self.uid, product_ids, ['name','code']): val={ 'id':product['id'], 'name':product['name'], 'code':product['code'] } i = 1 for qty in self.quantity: if qty == 0: val['qty'+str(i)] = "" else: val['qty'+str(i)]=self._get_price(self.pricelist, product['id'], qty) i += 1 products.append(val) res.append({'name':cat['name'],'products':products}) return res | aa7b817b4222f234e8e037c630dd89e3baba3594 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aa7b817b4222f234e8e037c630dd89e3baba3594/product_pricelist.py |
i += 1 | i += 1 | def _get_categories(self, products,form): cat_ids=[] res=[] self.pricelist = form['price_list'] self._set_quantity(form) pool = pooler.get_pool(self.cr.dbname) pro_ids=[] for product in products: pro_ids.append(product.id) if product.categ_id.id not in cat_ids: cat_ids.append(product.categ_id.id) cats = pool.get('product.category').read(self.cr, self.uid, cat_ids, ['name']) for cat in cats: product_ids=pool.get('product.product').search(self.cr, self.uid, [('id','in',pro_ids),('categ_id','=',cat['id'])]) products = [] for product in pool.get('product.product').read(self.cr, self.uid, product_ids, ['name','code']): val={ 'id':product['id'], 'name':product['name'], 'code':product['code'] } i = 1 for qty in self.quantity: if qty == 0: val['qty'+str(i)] = "" else: val['qty'+str(i)]=self._get_price(self.pricelist, product['id'], qty) i += 1 products.append(val) res.append({'name':cat['name'],'products':products}) return res | aa7b817b4222f234e8e037c630dd89e3baba3594 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aa7b817b4222f234e8e037c630dd89e3baba3594/product_pricelist.py |
res.append({'name':cat['name'],'products':products}) | res.append({'name':cat['name'],'products': products}) | def _get_categories(self, products,form): cat_ids=[] res=[] self.pricelist = form['price_list'] self._set_quantity(form) pool = pooler.get_pool(self.cr.dbname) pro_ids=[] for product in products: pro_ids.append(product.id) if product.categ_id.id not in cat_ids: cat_ids.append(product.categ_id.id) cats = pool.get('product.category').read(self.cr, self.uid, cat_ids, ['name']) for cat in cats: product_ids=pool.get('product.product').search(self.cr, self.uid, [('id','in',pro_ids),('categ_id','=',cat['id'])]) products = [] for product in pool.get('product.product').read(self.cr, self.uid, product_ids, ['name','code']): val={ 'id':product['id'], 'name':product['name'], 'code':product['code'] } i = 1 for qty in self.quantity: if qty == 0: val['qty'+str(i)] = "" else: val['qty'+str(i)]=self._get_price(self.pricelist, product['id'], qty) i += 1 products.append(val) res.append({'name':cat['name'],'products':products}) return res | aa7b817b4222f234e8e037c630dd89e3baba3594 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aa7b817b4222f234e8e037c630dd89e3baba3594/product_pricelist.py |
def compute_tax(self, cr, uid, ids, context={}): tax_pool = self.pool.get('account.tax') partner_pool = self.pool.get('res.partner') position_pool = self.pool.get('account.fiscal.position') voucher_line_pool = self.pool.get('account.voucher.line') voucher_pool = self.pool.get('account.voucher') for voucher in voucher_pool.browse(cr, uid, ids, context): voucher_amount = 0.0 for line in voucher.line_ids: voucher_amount += line.untax_amount or line.amount line.amount = line.untax_amount or line.amount voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount}) if not voucher.tax_id: continue tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)] partner = partner_pool.browse(cr, uid, voucher.partner_id.id) or False taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax) tax = tax_pool.browse(cr, uid, taxes) total = voucher_amount total_tax = 0.0 if not tax[0].price_include: for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes'): total_tax += tax_line.get('amount') total += total_tax else: line_ids2 = [] for line in voucher.line_ids: line_total = 0.0 line_tax = 0.0 for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes'): line_tax += tax_line.get('amount') line_total += tax_line.get('price_unit') total_tax += line_tax untax_amount = line.untax_amount or line.amount voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount}) self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax}) return True | d6ae30d2ff5b5823d9f4e563059913cc8e4b0ac0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d6ae30d2ff5b5823d9f4e563059913cc8e4b0ac0/voucher.py |
||
period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])[0]['date_start'] period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])[0]['date_stop'] | period_obj = self.pool.get('account.period') period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])['date_start'] period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])['date_stop'] | def _build_context(self, cr, uid, ids, data, context = None): result = {} result['fiscalyear'] = data['form']['fiscalyear_id'] and data['form']['fiscalyear_id'] or False if data['form']['filter'] == 'filter_date': result['date_from'] = data['form']['date_from'] result['date_to'] = data['form']['date_to'] elif data['form']['filter'] == 'filter_period': period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])[0]['date_start'] period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])[0]['date_stop'] cr.execute('SELECT id FROM account_period WHERE date_start >= %s AND date_stop <= %s', (period_date_start, period_date_stop)) result['periods'] = lambda x: x[0], cr.fetchall() return result | 41255ffacfd1eb78d16a18981694ad4842de21df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/41255ffacfd1eb78d16a18981694ad4842de21df/account_common_report.py |
query_line = obj_acc_move_line._query_get(cr, uid, obj='l', context=used_context) | query_line = obj_acc_move_line._query_get(cr, uid, obj='l', context=used_context) | def check_report(self, cr, uid, ids, context=None): obj_acc_move_line = self.pool.get('account.move.line') data = {} data['ids'] = context.get('active_ids',[]) data['model'] = context.get('active_model', 'ir.ui.menu') data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id'])[0] used_context = self._build_context(cr, uid, ids, data, context) query_line = obj_acc_move_line._query_get(cr, uid, obj='l', context=used_context) return self._print_report(cr, uid, ids, data, query_line, context) | 41255ffacfd1eb78d16a18981694ad4842de21df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/41255ffacfd1eb78d16a18981694ad4842de21df/account_common_report.py |
qu1 = ' where '+string.join(qu1, ' and ') | qu1 = ' where ' qu1 += ' and '.join(qu1) | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s with or without domain | a828eea7255bf501d3547db89a206df63cbe9cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a828eea7255bf501d3547db89a206df63cbe9cbc/orm.py |
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s with or without domain | a828eea7255bf501d3547db89a206df63cbe9cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a828eea7255bf501d3547db89a206df63cbe9cbc/orm.py |
||
if len(qu1_join): qu1 = qu1 + ' and ' qu1 += ' and '.join(qu1_join) | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s with or without domain | a828eea7255bf501d3547db89a206df63cbe9cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a828eea7255bf501d3547db89a206df63cbe9cbc/orm.py |
|
if not args: | if args is None: | def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if not args: args = [] if not context: context = {} args = args[:] if name: args += [(self._rec_name, operator, name)] ids = self.search(cr, user, args, limit=limit, context=context) res = self.name_get(cr, name_get_uid or user, ids, context) return res | a828eea7255bf501d3547db89a206df63cbe9cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a828eea7255bf501d3547db89a206df63cbe9cbc/orm.py |
if not context: | if context is None: | def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if not args: args = [] if not context: context = {} args = args[:] if name: args += [(self._rec_name, operator, name)] ids = self.search(cr, user, args, limit=limit, context=context) res = self.name_get(cr, name_get_uid or user, ids, context) return res | a828eea7255bf501d3547db89a206df63cbe9cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a828eea7255bf501d3547db89a206df63cbe9cbc/orm.py |
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values | a828eea7255bf501d3547db89a206df63cbe9cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a828eea7255bf501d3547db89a206df63cbe9cbc/orm.py |
||
res.update({'product_qty': move.product_qty.id}) | res.update({'product_qty': move.product_qty}) | def default_get(self, cr, uid, fields, context=None): """ Get default values @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for default value @param context: A standard dictionary @return: default values of fields """ res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context) move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context) if 'product_id' in fields: res.update({'product_id': move.product_id.id}) if 'product_uom' in fields: res.update({'product_uom': move.product_uom.id}) if 'product_qty' in fields: res.update({'product_qty': move.product_qty.id}) if 'location_id' in fields: res.update({'location_id': move.location_id.id}) return res | c5f3a4c94137645f9a6ad3bda19348334af27727 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5f3a4c94137645f9a6ad3bda19348334af27727/stock_move.py |
email_text = MIMEText(email_body, _subtype=subtype, _charset='utf-8') | try: email_text = MIMEText(email_body.encode('utf8') or '',_subtype=subtype,_charset='utf-8') except: email_text = MIMEText(email_body or '',_subtype=subtype,_charset='utf-8') | def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attach=None, openobject_id=False, ssl=False, debug=False, subtype='plain', x_headers=None, priority='3'): """Send an email. Arguments: `email_from`: A string used to fill the `From` header, if falsy, config['email_from'] is used instead. Also used for the `Reply-To` header if `reply_to` is not provided `email_to`: a sequence of addresses to send the mail to. """ import smtplib from email.MIMEText import MIMEText from email.MIMEBase import MIMEBase from email.MIMEMultipart import MIMEMultipart from email.Header import Header from email.Utils import formatdate, COMMASPACE from email.Utils import formatdate, COMMASPACE from email import Encoders import netsvc if x_headers is None: x_headers = {} if not ssl: ssl = config.get('smtp_ssl', False) if not (email_from or config['email_from']): raise ValueError("Sending an email requires either providing a sender " "address or having configured one") if not email_from: email_from = config.get('email_from', False) if not email_cc: email_cc = [] if not email_bcc: email_bcc = [] if not body: body = u'' try: email_body = body.encode('utf-8') except (UnicodeEncodeError, UnicodeDecodeError): email_body = body email_text = MIMEText(email_body, _subtype=subtype, _charset='utf-8') if attach: msg = MIMEMultipart() else: msg = email_text msg['Subject'] = Header(ustr(subject), 'utf-8') msg['From'] = email_from del msg['Reply-To'] if reply_to: msg['Reply-To'] = reply_to else: msg['Reply-To'] = msg['From'] msg['To'] = COMMASPACE.join(email_to) if email_cc: msg['Cc'] = COMMASPACE.join(email_cc) if email_bcc: msg['Bcc'] = COMMASPACE.join(email_bcc) msg['Date'] = formatdate(localtime=True) # Add OpenERP Server information msg['X-Generated-By'] = 'OpenERP (http://www.openerp.com)' msg['X-OpenERP-Server-Host'] = socket.gethostname() msg['X-OpenERP-Server-Version'] = release.version msg['X-Priority'] = priorities.get(priority, '3 (Normal)') # Add dynamic X Header for key, value in x_headers.iteritems(): msg['X-OpenERP-%s' % key] = str(value) if openobject_id: msg['Message-Id'] = "<%s-openobject-%s@%s>" % (time.time(), openobject_id, socket.gethostname()) if attach: msg.attach(email_text) for (fname,fcontent) in attach: part = MIMEBase('application', "octet-stream") part.set_payload( fcontent ) Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % (fname,)) msg.attach(part) class WriteToLogger(object): def __init__(self): self.logger = netsvc.Logger() def write(self, s): self.logger.notifyChannel('email_send', netsvc.LOG_DEBUG, s) smtp_server = config['smtp_server'] if smtp_server.startswith('maildir:/'): from mailbox import Maildir maildir_path = smtp_server[8:] try: mdir = Maildir(maildir_path,factory=None, create = True) mdir.add(msg.as_string(True)) return True except Exception,e: netsvc.Logger().notifyChannel('email_send (maildir)', netsvc.LOG_ERROR, e) return False try: oldstderr = smtplib.stderr s = smtplib.SMTP() try: # in case of debug, the messages are printed to stderr. if debug: smtplib.stderr = WriteToLogger() s.set_debuglevel(int(bool(debug))) # 0 or 1 s.connect(smtp_server, config['smtp_port']) if ssl: s.ehlo() s.starttls() s.ehlo() if config['smtp_user'] or config['smtp_password']: s.login(config['smtp_user'], config['smtp_password']) s.sendmail(email_from, flatten([email_to, email_cc, email_bcc]), msg.as_string() ) finally: s.quit() if debug: smtplib.stderr = oldstderr except Exception, e: netsvc.Logger().notifyChannel('email_send', netsvc.LOG_ERROR, e) return False return True | faec4cbc803b18194a72b6a4a5bc3bc66495bc87 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/faec4cbc803b18194a72b6a4a5bc3bc66495bc87/misc.py |
if app_acc_in.company_id.id != company_id and app_acc_exp.company_id.id != company_id: | if app_acc_in and app_acc_in.company_id.id != company_id and app_acc_exp and app_acc_exp.company_id.id != company_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): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") ) if not product: if type in ('in_invoice', 'in_refund'): return {'value': {'categ_id': False}, 'domain':{'product_uom':[]}} else: return {'value': {'price_unit': 0.0, 'categ_id': False}, 'domain':{'product_uom':[]}} part = self.pool.get('res.partner').browse(cr, uid, partner_id) fpos_obj = self.pool.get('account.fiscal.position') fpos = fposition_id and fpos_obj.browse(cr, uid, fposition_id) or False | 940eaa4a68a69a565da9f8f87a8a948b94b32621 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/940eaa4a68a69a565da9f8f87a8a948b94b32621/invoice.py |
netsvc.Logger().notifyChannel("web-services", netsvc.LOG_WARNING, "Netrpc: closing because of exception %s" % str(e)) | import logging logging.getLogger('web-services').warning("Netrpc: closing because of exception %s" % str(e)) | def run(self): # import select try: self.running = True while self.running: (clientsocket, address) = self.socket.accept() ct = TinySocketClientThread(clientsocket, self.threads) clientsocket = None self.threads.append(ct) ct.start() lt = len(self.threads) if (lt > 10) and (lt % 10 == 0): # Not many threads should be serving at the same time, so log # their abuse. netsvc.Logger().notifyChannel("web-services", netsvc.LOG_DEBUG, "Netrpc: %d threads" % len(self.threads)) self.socket.close() except Exception, e: netsvc.Logger().notifyChannel("web-services", netsvc.LOG_WARNING, "Netrpc: closing because of exception %s" % str(e)) self.socket.close() return False | d4d1302faeb9c691a71d4e014d8b13d85815ae34 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d4d1302faeb9c691a71d4e014d8b13d85815ae34/netrpc_server.py |
res = super(stock_move, self)._auto_init(cursor, context=contexts) | res = super(stock_move, self)._auto_init(cursor, context=context) | def _auto_init(self, cursor, context=None): res = super(stock_move, self)._auto_init(cursor, context=contexts) cursor.execute('SELECT indexname \ FROM pg_indexes \ WHERE indexname = \'stock_move_location_id_location_dest_id_product_id_state\'') if not cursor.fetchone(): cursor.execute('CREATE INDEX stock_move_location_id_location_dest_id_product_id_state \ ON stock_move (location_id, location_dest_id, product_id, state)') cursor.commit() return res | 140211673f3b353958df7056663537a003335621 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/140211673f3b353958df7056663537a003335621/stock.py |
location_obj = self.pool.get('stock.location') | def action_move_create(self, cr, uid, ids,context=None): proc_obj = self.pool.get('procurement.order') move_obj = self.pool.get('stock.move') location_obj = self.pool.get('stock.location') picking_obj=self.pool.get('stock.picking') wf_service = netsvc.LocalService("workflow") for proc in proc_obj.browse(cr, uid, ids, context=context): line = None for line in proc.product_id.flow_pull_ids: if line.location_id==proc.location_id: break assert line, 'Line can not be False if we are on this state of the workflow' origin = (proc.origin or proc.name or '').split(':')[0] +':'+line.name picking_id =picking_obj.create(cr, uid, { 'origin': origin, 'company_id': line.company_id and line.company_id.id or False, 'type': line.picking_type, 'stock_journal_id': line.journal_id and line.journal_id.id or False, 'move_type': 'one', 'address_id': line.partner_address_id.id, 'note': line.name, # TODO: note on procurement ? 'invoice_state': line.invoice_state, }) move_id =move_obj.create(cr, uid, { 'name': line.name, 'picking_id': picking_id, 'company_id': line.company_id and line.company_id.id or False, 'product_id': proc.product_id.id, 'date': proc.date_planned, 'product_qty': proc.product_qty, 'product_uom': proc.product_uom.id, 'product_uos_qty': (proc.product_uos and proc.product_uos_qty)\ or proc.product_qty, 'product_uos': (proc.product_uos and proc.product_uos.id)\ or proc.product_uom.id, 'address_id': line.partner_address_id.id, 'location_id': line.location_src_id.id, 'location_dest_id': line.location_id.id, 'move_dest_id': proc.move_id and proc.move_id.id or False, # to verif, about history ? 'tracking_id': False, 'cancel_cascade': line.cancel_cascade, 'state': 'confirmed', 'note': line.name, # TODO: same as above }) if proc.move_id and proc.move_id.state in ('confirmed'): move_obj.write(cr,uid, [proc.move_id.id], { 'state':'waiting' }, context=context) proc_id = proc_obj.create(cr, uid, { 'name': line.name, 'origin': origin, 'company_id': line.company_id and line.company_id.id or False, 'date_planned': proc.date_planned, 'product_id': proc.product_id.id, 'product_qty': proc.product_qty, 'product_uom': proc.product_uom.id, 'product_uos_qty': (proc.product_uos and proc.product_uos_qty)\ or proc.product_qty, 'product_uos': (proc.product_uos and proc.product_uos.id)\ or proc.product_uom.id, 'location_id': line.location_src_id.id, 'procure_method': line.procure_method, 'move_id': move_id, }) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) if proc.move_id: move_obj.write(cr, uid, [proc.move_id.id], {'location_id':proc.location_id.id}) | 9e1ee6bc40d5898da2b52a5d26c56de5a89a7cc5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9e1ee6bc40d5898da2b52a5d26c56de5a89a7cc5/mrp_pull.py |
|
return self.write(cr, uid, ids, {'state': 'installed'}, context) | res = self.write(cr, uid, ids, {'state': 'installed'}, context) if res: return "Installed" | def button_install(self, cr, uid, ids, context={}): return self.write(cr, uid, ids, {'state': 'installed'}, context) | ecd53f7ea025862e25168dd9a6b2b56f028e0832 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ecd53f7ea025862e25168dd9a6b2b56f028e0832/module_web.py |
return self.write(cr, uid, ids, {'state': 'uninstalled'}, context) | res = self.write(cr, uid, ids, {'state': 'uninstalled'}, context) if res: return "Uninstalled" | def button_uninstall(self, cr, uid, ids, context={}): return self.write(cr, uid, ids, {'state': 'uninstalled'}, context) | ecd53f7ea025862e25168dd9a6b2b56f028e0832 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ecd53f7ea025862e25168dd9a6b2b56f028e0832/module_web.py |
self.write(cr, uid, id, {'history':history or '' + "\n" + time.strftime("%Y-%m-%d %H:%M:%S") + ": " + tools.ustr(message)}, context) | self.write(cr, uid, id, {'history': (history or '' )+ "\n" + time.strftime("%Y-%m-%d %H:%M:%S") + ": " + tools.ustr(message)}, context) | def historise(self, cr, uid, ids, message='', context=None): for id in ids: history = self.read(cr, uid, id, ['history'], context).get('history', '') self.write(cr, uid, id, {'history':history or '' + "\n" + time.strftime("%Y-%m-%d %H:%M:%S") + ": " + tools.ustr(message)}, context) | 300556bc1f9c0753fc50f7c02067ad63d000ef1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/300556bc1f9c0753fc50f7c02067ad63d000ef1b/email_template_mailbox.py |
case_obj.write(cr, uid, case.id, {'ref': 'sale.order,%s' % new_id}) | case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id}) | def _makeOrder(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.case') sale_obj = pool.get('sale.order') partner_obj = pool.get('res.partner') sale_line_obj = pool.get('sale.order.line') | 4c338ea12f041a03556bc7f0a7ee90ca0311b276 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4c338ea12f041a03556bc7f0a7ee90ca0311b276/makesale.py |
self.write(cr, uid, ids, {'state':'done'}, context=context) | self.write(cr, uid, ids, {'state':'close'}, context=context) | def set_done(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'done'}, context=context) return True | a70ea4f2619b778b564e481733a5289787669b9f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a70ea4f2619b778b564e481733a5289787669b9f/project.py |
cr.execute('update project_task set active=True where project_id in ('+','.join(map(str, ids))+')') | if ids: cr.execute('update project_task set active=True where project_id in ('+','.join(map(str, ids))+')') | def copy(self, cr, uid, id, default={},context={}): proj = self.browse(cr, uid, id, context=context) default = default or {} context['active_test'] = False default['state'] = 'open' if not default.get('name', False): default['name'] = proj.name+_(' (copy)') res = super(project, self).copy(cr, uid, id, default, context) ids = self.search(cr, uid, [('parent_id','child_of', [res])]) cr.execute('update project_task set active=True where project_id in ('+','.join(map(str, ids))+')') return res | a70ea4f2619b778b564e481733a5289787669b9f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a70ea4f2619b778b564e481733a5289787669b9f/project.py |
cr.execute('select id from project_project where parent_id=%s', (proj.id,)) res = cr.fetchall() project_ids = [x[0] for x in res] for child in project_ids: self.duplicate_template(cr, uid, [child],context={'parent_id':new_id}) | child_ids = self.search(cr, uid, [('parent_id','=', proj.id)]) if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id':new_id}) | def duplicate_template(self, cr, uid, ids,context={}): for proj in self.browse(cr, uid, ids): parent_id=context.get('parent_id',False) new_id=self.pool.get('project.project').copy(cr, uid, proj.id,default={'name':proj.name+_(' (copy)'),'state':'open','parent_id':parent_id}) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() for (tasks_id,) in res: self.pool.get('project.task').copy(cr, uid, tasks_id,default={'project_id':new_id,'active':True}, context=context) cr.execute('select id from project_project where parent_id=%s', (proj.id,)) res = cr.fetchall() project_ids = [x[0] for x in res] for child in project_ids: self.duplicate_template(cr, uid, [child],context={'parent_id':new_id}) | a70ea4f2619b778b564e481733a5289787669b9f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a70ea4f2619b778b564e481733a5289787669b9f/project.py |
cr.execute('select id from project_project where parent_id=%s', (proj.id,)) project_ids = [x[0] for x in cr.fetchall()] for child in project_ids: self.setActive(cr, uid, [child], value, context) | child_ids = self.search(cr, uid, [('parent_id','=', proj.id)]) if child_ids: self.setActive(cr, uid, child_ids, value, context) | def setActive(self, cr, uid, ids, value=True, context={}): for proj in self.browse(cr, uid, ids, context): self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context) cr.execute('select id from project_task where project_id=%s', (proj.id,)) tasks_id = [x[0] for x in cr.fetchall()] if tasks_id: self.pool.get('project.task').write(cr, uid, tasks_id, {'active': value}, context) cr.execute('select id from project_project where parent_id=%s', (proj.id,)) project_ids = [x[0] for x in cr.fetchall()] for child in project_ids: self.setActive(cr, uid, [child], value, context) return True | a70ea4f2619b778b564e481733a5289787669b9f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a70ea4f2619b778b564e481733a5289787669b9f/project.py |
if not line.sequence: account_bank_statement_line_obj.write(cr, uid, [line.id], {'sequence': seq}, context=context) | account_bank_statement_line_obj.write(cr, uid, [line.id], {'sequence': seq}, context=context) | def write(self, cr, uid, ids, vals, context=None): res = super(account_bank_statement, self).write(cr, uid, ids, vals, context=context) account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') for statement in self.browse(cr, uid, ids, context): seq = 0 for line in statement.line_ids: seq += 1 if not line.sequence: account_bank_statement_line_obj.write(cr, uid, [line.id], {'sequence': seq}, context=context) return res | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
return st_number + ' - ' + str(st_line.sequence) | return st_number + '/' + str(st_line.sequence) | def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None): return st_number + ' - ' + str(st_line.sequence) | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): | def onchange_type(self, cr, uid, line_id, partner_id, type, context=None): | def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') 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(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, 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 | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
line = self.browse(cursor, user, line_id) | line = self.browse(cr, uid, line_id) | def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') 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(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, 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 | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
part = obj_partner.browse(cursor, user, partner_id, context=context) | part = obj_partner.browse(cr, uid, partner_id, context=context) | def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') 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(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, 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 | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
if account_id and (not line or (line and not line[0].amount)) and not context.get('amount', False): company_currency_id = res_users_obj.browse(cursor, user, user, context=context).company_id.currency_id.id if not currency_id: currency_id = company_currency_id cursor.execute('SELECT sum(debit-credit) \ FROM account_move_line \ WHERE (reconcile_id is null) \ AND partner_id = %s \ AND account_id=%s', (partner_id, account_id)) pgres = cursor.fetchone() balance = pgres and pgres[0] or 0.0 balance = res_currency_obj.compute(cursor, user, company_currency_id, currency_id, balance, context=context) res['value']['amount'] = balance | def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') 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(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, 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 | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
|
'name': fields.char('Name', size=64, required=True), | 'name': fields.char('Communication', size=64, required=True), | def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') 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(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, 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 | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') 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(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, 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 | 02d922e3957cc2244cf163acbaedabfef204b660 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/02d922e3957cc2244cf163acbaedabfef204b660/account_bank_statement.py |
||
def create(self, cr, user, vals, context={}): """ Create a new record for a model idea_idea @param cr: A database cursor @param user: ID of the user currently logged in @param vals: provides data for new record @param context: context arguments, like lang, time zone | 95b83f741efe93d8e9749dd0e6a149b09b9d5bdb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/95b83f741efe93d8e9749dd0e6a149b09b9d5bdb/idea.py |
||
def create(self, cr, user, vals, context={}): """ Create a new record for a model idea_idea @param cr: A database cursor @param user: ID of the user currently logged in @param vals: provides data for new record @param context: context arguments, like lang, time zone | 95b83f741efe93d8e9749dd0e6a149b09b9d5bdb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/95b83f741efe93d8e9749dd0e6a149b09b9d5bdb/idea.py |
||
visibility = False if vals.get('category_id', False): category_pool = self.pool.get('idea.category') category = category_pool.browse(cr, user, vals.get('category_id'), context) visibility = category.visibility vals.update({ 'visibility':visibility }) | def write(self, cr, user, ids, vals, context=None): """ Update redord(s) exist in {ids}, with new value provided in {vals} | 95b83f741efe93d8e9749dd0e6a149b09b9d5bdb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/95b83f741efe93d8e9749dd0e6a149b09b9d5bdb/idea.py |
|
src_model = rec.get('src_model','').encode('utf-8') | src_model = rec.get('src_model','').encode('utf-8') | def _tag_act_window(self, cr, rec, data_node=None): name = rec.get('name','').encode('utf-8') xml_id = rec.get('id','').encode('utf8') self._test_xml_id(xml_id) type = rec.get('type','').encode('utf-8') or 'ir.actions.act_window' view_id = False if rec.get('view'): view_id = self.id_get(cr, 'ir.actions.act_window', rec.get('view','').encode('utf-8')) domain = rec.get('domain','').encode('utf-8') or '{}' context = rec.get('context','').encode('utf-8') or '{}' res_model = rec.get('res_model','').encode('utf-8') src_model = rec.get('src_model','').encode('utf-8') view_type = rec.get('view_type','').encode('utf-8') or 'form' view_mode = rec.get('view_mode','').encode('utf-8') or 'tree,form' usage = rec.get('usage','').encode('utf-8') limit = rec.get('limit','').encode('utf-8') auto_refresh = rec.get('auto_refresh','').encode('utf-8') uid = self.uid # def ref() added because , if context has ref('id') eval wil use this ref | 17b9f5802f563fcd1cd22750afc384f65d892de9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/17b9f5802f563fcd1cd22750afc384f65d892de9/convert.py |
def _tag_act_window(self, cr, rec, data_node=None): name = rec.get('name','').encode('utf-8') xml_id = rec.get('id','').encode('utf8') self._test_xml_id(xml_id) type = rec.get('type','').encode('utf-8') or 'ir.actions.act_window' view_id = False if rec.get('view'): view_id = self.id_get(cr, 'ir.actions.act_window', rec.get('view','').encode('utf-8')) domain = rec.get('domain','').encode('utf-8') or '{}' context = rec.get('context','').encode('utf-8') or '{}' res_model = rec.get('res_model','').encode('utf-8') src_model = rec.get('src_model','').encode('utf-8') view_type = rec.get('view_type','').encode('utf-8') or 'form' view_mode = rec.get('view_mode','').encode('utf-8') or 'tree,form' usage = rec.get('usage','').encode('utf-8') limit = rec.get('limit','').encode('utf-8') auto_refresh = rec.get('auto_refresh','').encode('utf-8') uid = self.uid # def ref() added because , if context has ref('id') eval wil use this ref | 17b9f5802f563fcd1cd22750afc384f65d892de9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/17b9f5802f563fcd1cd22750afc384f65d892de9/convert.py |
||
rcal = self.export_cal(cr, uid, r_ids, 'vevent', context=context) | r_datas = model_obj.read(cr, uid, r_ids, context=context) rcal = CalDAV.export_cal(self, cr, uid, r_datas, 'vevent', context=context) for revents in rcal.contents.get('vevent', []): ical.contents['vevent'].append(revents) | def create_ics(self, cr, uid, datas, name, ical, context=None): """ create calendaring and scheduling information @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 """ | 26ca4db0831e90cd5348874bd2ae18ddabdf9878 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/26ca4db0831e90cd5348874bd2ae18ddabdf9878/calendar.py |
def export_cal(self, cr, uid, datas, vobj=None, context=None): """ Export Calendar @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 datas: Get Data's for caldav @param context: A standard dictionary for contextual values """ | 26ca4db0831e90cd5348874bd2ae18ddabdf9878 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/26ca4db0831e90cd5348874bd2ae18ddabdf9878/calendar.py |
||
data_ids = mod_obj.search(cr, uid, line_domain, context=context) | data_ids = mod_obj.search(cr, uid, line_domain, order="id", context=context) | def get_calendar_objects(self, cr, uid, ids, parent=None, domain=None, context=None): if not context: context = {} if not domain: domain = [] res = [] ctx_res_id = context.get('res_id', None) ctx_model = context.get('model', None) for cal in self.browse(cr, uid, ids): for line in cal.line_ids: if ctx_model and ctx_model != line.object_id.model: continue if line.name in ('valarm', 'attendee'): continue line_domain = eval(line.domain or '[]') line_domain += domain if ctx_res_id: line_domain += [('id','=',ctx_res_id)] mod_obj = self.pool.get(line.object_id.model) data_ids = mod_obj.search(cr, uid, line_domain, context=context) for data in mod_obj.browse(cr, uid, data_ids, context): ctx = parent and parent.context or None node = res_node_calendar('%s.ics' %data.id, parent, ctx, data, line.object_id.model, data.id) res.append(node) return res | 26ca4db0831e90cd5348874bd2ae18ddabdf9878 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/26ca4db0831e90cd5348874bd2ae18ddabdf9878/calendar.py |
def export_cal(self, cr, uid, ids, vobj='vevent', context=None): """ Export Calendar @param ids: List of calendar’s IDs @param vobj: the type of object to export @return the ical data. """ if not context: context = {} ctx_model = context.get('model', None) ctx_res_id = context.get('res_id', None) ical = vobject.iCalendar() for cal in self.browse(cr, uid, ids): for line in cal.line_ids: if ctx_model and ctx_model != line.object_id.model: continue if line.name in ('valarm', 'attendee'): continue domain = eval(line.domain or '[]') if ctx_res_id: domain += [('id','=',ctx_res_id)] mod_obj = self.pool.get(line.object_id.model) data_ids = mod_obj.search(cr, uid, domain, context=context) datas = mod_obj.read(cr, uid, data_ids, context=context) context.update({'model': line.object_id.model, 'calendar_id': cal.id }) self.__attribute__ = get_attribute_mapping(cr, uid, line.name, context) self.create_ics(cr, uid, datas, line.name, ical, context=context) return ical.serialize() | 26ca4db0831e90cd5348874bd2ae18ddabdf9878 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/26ca4db0831e90cd5348874bd2ae18ddabdf9878/calendar.py |
||
def import_cal(self, cr, uid, content, data_id=None, context=None): """ Import Calendar @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 data_id: Get Data’s ID or False @param context: A standard dictionary for contextual values """ | 26ca4db0831e90cd5348874bd2ae18ddabdf9878 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/26ca4db0831e90cd5348874bd2ae18ddabdf9878/calendar.py |
||
def get_children(self,uri, filters=None): | def get_childs(self,uri, filters=None): | def get_children(self,uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get children: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True) | f25e5da78726c2efe93b2d140e3ab87a37baf7f4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f25e5da78726c2efe93b2d140e3ab87a37baf7f4/dav_fs.py |
fp = Popen(['file','-b',fname], shell=False, stdout=PIPE).stdout | fp = Popen(['file','-b','--mime',fname], shell=False, stdout=PIPE).stdout | def doIndex(self,content, filename=None, content_type=None, realfname = None, debug=False): fobj = None fname = None mime = None if content_type and self.mimes.has_key(content_type): mime = content_type fobj = self.mimes[content_type] elif filename: bname,ext = os.path.splitext(filename) if self.exts.has_key(ext): fobj = self.exts[ext] mime = fobj._getDefMime(ext) if content_type and not fobj: mime,fobj = mime_match(content_type, self.mimes) if not fobj: try: if realfname : fname = realfname else: bname,ext = os.path.splitext(filename) fd, fname = tempfile.mkstemp(suffix=ext) os.write(fd, content) os.close(fd) #fp = Popen(['file','-b','--mime-type',fname], shell=False, stdout=PIPE).stdout fp = Popen(['file','-b',fname], shell=False, stdout=PIPE).stdout result = fp.read() fp.close() mime2 = result.strip() self.__logger.debug('File gave us: %s', mime2) # Note that the temporary file still exists now. mime,fobj = mime_match(mime2, self.mimes) if not mime: mime = mime2 except Exception: self.__logger.exception('Cannot determine mime type') try: if fobj: res = (mime, fobj.indexContent(content,filename,fname or realfname) ) else: self.__logger.debug("Have no object, return (%s, None)", mime) res = (mime, None ) except Exception: self.__logger.exception("Could not index file %s (%s)", filename, fname or realfname) res = None # If we created a tmp file, unlink it now if not realfname and fname: try: os.unlink(fname) except Exception: self.__logger.exception("Could not unlink %s", fname) return res | 71fa375ac07ed23e7105f253fc45fff98890c1c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/71fa375ac07ed23e7105f253fc45fff98890c1c4/content_index.py |
mime2 = result.strip() | mime2 = result.split(';')[0] | def doIndex(self,content, filename=None, content_type=None, realfname = None, debug=False): fobj = None fname = None mime = None if content_type and self.mimes.has_key(content_type): mime = content_type fobj = self.mimes[content_type] elif filename: bname,ext = os.path.splitext(filename) if self.exts.has_key(ext): fobj = self.exts[ext] mime = fobj._getDefMime(ext) if content_type and not fobj: mime,fobj = mime_match(content_type, self.mimes) if not fobj: try: if realfname : fname = realfname else: bname,ext = os.path.splitext(filename) fd, fname = tempfile.mkstemp(suffix=ext) os.write(fd, content) os.close(fd) #fp = Popen(['file','-b','--mime-type',fname], shell=False, stdout=PIPE).stdout fp = Popen(['file','-b',fname], shell=False, stdout=PIPE).stdout result = fp.read() fp.close() mime2 = result.strip() self.__logger.debug('File gave us: %s', mime2) # Note that the temporary file still exists now. mime,fobj = mime_match(mime2, self.mimes) if not mime: mime = mime2 except Exception: self.__logger.exception('Cannot determine mime type') try: if fobj: res = (mime, fobj.indexContent(content,filename,fname or realfname) ) else: self.__logger.debug("Have no object, return (%s, None)", mime) res = (mime, None ) except Exception: self.__logger.exception("Could not index file %s (%s)", filename, fname or realfname) res = None # If we created a tmp file, unlink it now if not realfname and fname: try: os.unlink(fname) except Exception: self.__logger.exception("Could not unlink %s", fname) return res | 71fa375ac07ed23e7105f253fc45fff98890c1c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/71fa375ac07ed23e7105f253fc45fff98890c1c4/content_index.py |
'planned_hours': fields.float('Planned Hours', required=True, help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'), | 'planned_hours': fields.float('Planned Hours', help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'), | def _is_template(self, cr, uid, ids, field_name, arg, context=None): res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = True if task.project_id: if task.project_id.active == False or task.project_id.state == 'template': res[task.id] = False return res | 993a1f275e6b0ab4aee514f02014591118b04e53 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/993a1f275e6b0ab4aee514f02014591118b04e53/project.py |
('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model !'), ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model !'), | ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model (Credit Or Debit Must Be "0")!'), ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model (Credit + Debit Must Be greater "0")!'), | def generate(self, cr, uid, ids, datas={}, context={}): move_ids = [] for model in self.browse(cr, uid, ids, context): period_id = self.pool.get('account.period').find(cr,uid, context=context) if not period_id: raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !')) period_id = period_id[0] move_id = self.pool.get('account.move').create(cr, uid, { 'ref': model.ref, 'period_id': period_id, 'journal_id': model.journal_id.id, }) move_ids.append(move_id) for line in model.lines_id: val = { 'move_id': move_id, 'journal_id': model.journal_id.id, 'period_id': period_id } val.update({ 'name': line.name, 'quantity': line.quantity, 'debit': line.debit, 'credit': line.credit, 'account_id': line.account_id.id, 'move_id': move_id, 'ref': line.ref, 'partner_id': line.partner_id.id, 'date': time.strftime('%Y-%m-%d'), 'date_maturity': time.strftime('%Y-%m-%d') }) c = context.copy() c.update({'journal_id': model.journal_id.id,'period_id': period_id}) self.pool.get('account.move.line').create(cr, uid, val, context=c) return move_ids | c25b354ed78c5bf0d9ce67931eb52862580d8b5f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c25b354ed78c5bf0d9ce67931eb52862580d8b5f/account.py |
result = obj_model.read(cr, uid, [vals['res_id']], context=context) | result = obj_model.read(cr, uid, [vals['res_id']], ['name', 'partner_id', 'address_id'], context=context) | def create(self, cr, uid, vals, context=None): if not context: context = {} vals['title'] = vals['name'] 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 context.get('default_res_id', False): vals['res_id'] = context.get('default_res_id', False) if not vals.get('res_model', False) and context.get('default_res_model', False): vals['res_model'] = context.get('default_res_model', False) if vals.get('res_id', False) and vals.get('res_model', False): obj_model = self.pool.get(vals['res_model']) result = obj_model.read(cr, uid, [vals['res_id']], context=context) if len(result): obj = result[0] if obj.get('name', False): vals['title'] = (obj.get('name', ''))[:60] if obj_model._name == 'res.partner': vals['partner_id'] = obj['id'] elif obj.get('address_id', False): if isinstance(obj['address_id'], tuple) or isinstance(obj['address_id'], list): address_id = obj['address_id'][0] else: address_id = obj['address_id'] address = self.pool.get('res.partner.address').read(cr, uid, [address_id], context=context) if len(address): vals['partner_id'] = address[0]['partner_id'][0] or False elif obj.get('partner_id', False): if isinstance(obj['partner_id'], tuple) or isinstance(obj['partner_id'], list): vals['partner_id'] = obj['partner_id'][0] else: vals['partner_id'] = obj['partner_id'] | d91fa1c56eb25cd2a9afde75186428effd9a08ed /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d91fa1c56eb25cd2a9afde75186428effd9a08ed/document.py |
if not ids: raise osv.except_osv(_('Invalid !'), _('Please save voucher before selection partner !')) line_ids = line_pool.search(cr, uid, [('voucher_id','=',ids[0])]) if line_ids: line_pool.unlink(cr, uid, line_ids) voucher_id = ids[0] | voucher_id = ids and ids[0] or False | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, context={}): """ Returns a dict that contains new values and context @param cr: A database cursor @param user: ID of the user currently logged in @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context arguments, like lang, time zone @return: Returns a dict which contains new values, and context """ move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') res = [] context.update({ 'type':ttype, 'partner_id':partner_id, 'voucher':True, }) default = { 'value':{}, 'context':context, } if not partner_id or not ttype: if ids: line_ids = line_pool.search(cr, uid, [('voucher_id','=',ids[0])]) if line_ids: line_pool.unlink(cr, uid, line_ids) return default if ttype not in ('payment', 'receipt'): return default if not ids: raise osv.except_osv(_('Invalid !'), _('Please save voucher before selection partner !')) line_ids = line_pool.search(cr, uid, [('voucher_id','=',ids[0])]) if line_ids: line_pool.unlink(cr, uid, line_ids) voucher_id = ids[0] ids = move_pool.search(cr, uid, [('reconcile_id','=', False), ('state','=','posted'), ('partner_id','=',partner_id)], context=context) for move in move_pool.browse(cr, uid, ids): rs = { 'ref':move.ref or '/', 'move_id':move.id, 'voucher_id':voucher_id, } if ttype == 'payment': rs.update({ 'account_id':move.partner_id.property_account_payable.id, 'type':'dr', 'amount':move.amount }) elif ttype == 'receipt': rs.update({ 'account_id':move.partner_id.property_account_receivable.id, 'type':'cr', 'amount':move.amount }) line_id = line_pool.create(cr, uid, rs) res += [line_id] return { 'value':{'payment_ids':res}, 'context':context, } | 4359aaefcdb807ccafa0133705b8777e68fa4809 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4359aaefcdb807ccafa0133705b8777e68fa4809/voucher.py |
result[id] = price | result[id] = price result['item_id'] = {id: item_id} | def price_get(self, cr, uid, ids, prod_id, qty, partner=None, context=None): ''' context = { 'uom': Unit of Measure (int), 'partner': Partner ID (int), 'date': Date of the pricelist (%Y-%m-%d), } ''' context = context or {} currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') supplierinfo_obj = self.pool.get('product.supplierinfo') price_type_obj = self.pool.get('product.price.type') | e72c090ed9ab83f8857499ac40273aed7dc04fd0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e72c090ed9ab83f8857499ac40273aed7dc04fd0/pricelist.py |
'type': 'other', | 'type': 'liquidity', | def execute(self, cr, uid, ids, context=None): obj_multi = self.browse(cr, uid, ids[0]) obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') obj_data = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_tax_code = self.pool.get('account.tax.code') # Creating Account obj_acc_root = obj_multi.chart_template_id.account_root_id tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id company_id = obj_multi.company_id.id | 8e59d73e71dc2406f96ee3bb4fe2477532f46993 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8e59d73e71dc2406f96ee3bb4fe2477532f46993/account.py |
vals_journal['type'] = 'cash' | vals_journal['type'] = line.account_type == 'cash' and 'cash' or 'bank' | def execute(self, cr, uid, ids, context=None): obj_multi = self.browse(cr, uid, ids[0]) obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') obj_data = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_tax_code = self.pool.get('account.tax.code') # Creating Account obj_acc_root = obj_multi.chart_template_id.account_root_id tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id company_id = obj_multi.company_id.id | 8e59d73e71dc2406f96ee3bb4fe2477532f46993 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8e59d73e71dc2406f96ee3bb4fe2477532f46993/account.py |
if type(sel_list) == type([]): r = [x[1] for x in sel_list if r==x[0]][0] | if r and type(sel_list) == type([]): r = [x[1] for x in sel_list if r==x[0]] r = r and r[0] or False | def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False | 9f1015621bd3024bba5ec1cb0f544fc0b882837b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f1015621bd3024bba5ec1cb0f544fc0b882837b/orm.py |
def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): """ To produce final product based on production mode (consume/consume&produce). If Production mode is consume, all stock move lines of raw materials will be done/consumed. If Production mode is consume & produce, all stock move lines of raw materials will be done/consumed and stock move lines of final product will be also done/produced. @param production_id: the ID of mrp.production object @param production_qty: specify qty to produce @param production_mode: specify production mode (consume/consume&produce). @return: True """ stock_mov_obj = self.pool.get('stock.move') production = self.browse(cr, uid, production_id) raw_product_todo = [] final_product_todo = [] | 2eaf0ee8a420b5273e173e5069355a17c874349e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2eaf0ee8a420b5273e173e5069355a17c874349e/mrp.py |
||
consumed_products[consumed_product.product_id.id] = 0 consumed_products[consumed_product.product_id.id] -= consumed_product.product_qty | consumed_products[consumed_product.product_id.id] = consumed_product.product_qty check[consumed_product.product_id.id] = 0 for f in production.product_lines: if f.product_id.id == consumed_product.product_id.id: if (len(production.move_lines2) - scraped) > len(production.product_lines): check[consumed_product.product_id.id] += consumed_product.product_qty consumed = check[consumed_product.product_id.id] rest_consumed = produced_qty * f.product_qty / production.product_qty - consumed consumed_products[consumed_product.product_id.id] = rest_consumed | def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): """ To produce final product based on production mode (consume/consume&produce). If Production mode is consume, all stock move lines of raw materials will be done/consumed. If Production mode is consume & produce, all stock move lines of raw materials will be done/consumed and stock move lines of final product will be also done/produced. @param production_id: the ID of mrp.production object @param production_qty: specify qty to produce @param production_mode: specify production mode (consume/consume&produce). @return: True """ stock_mov_obj = self.pool.get('stock.move') production = self.browse(cr, uid, production_id) raw_product_todo = [] final_product_todo = [] | 2eaf0ee8a420b5273e173e5069355a17c874349e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2eaf0ee8a420b5273e173e5069355a17c874349e/mrp.py |
if f.product_id.id==raw_product.product_id.id: | if f.product_id.id == raw_product.product_id.id: | def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): """ To produce final product based on production mode (consume/consume&produce). If Production mode is consume, all stock move lines of raw materials will be done/consumed. If Production mode is consume & produce, all stock move lines of raw materials will be done/consumed and stock move lines of final product will be also done/produced. @param production_id: the ID of mrp.production object @param production_qty: specify qty to produce @param production_mode: specify production mode (consume/consume&produce). @return: True """ stock_mov_obj = self.pool.get('stock.move') production = self.browse(cr, uid, production_id) raw_product_todo = [] final_product_todo = [] | 2eaf0ee8a420b5273e173e5069355a17c874349e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2eaf0ee8a420b5273e173e5069355a17c874349e/mrp.py |
rest_qty = production_qty * f.product_qty / production.product_qty - consumed_qty if rest_qty > 0: stock_mov_obj.action_consume(cr, uid, [raw_product.id], rest_qty, production.location_src_id.id, context=context) | if consumed_qty == 0: consumed_qty = production_qty * f.product_qty / production.product_qty if consumed_qty > 0: stock_mov_obj.action_consume(cr, uid, [raw_product.id], consumed_qty, production.location_src_id.id, context=context) | def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): """ To produce final product based on production mode (consume/consume&produce). If Production mode is consume, all stock move lines of raw materials will be done/consumed. If Production mode is consume & produce, all stock move lines of raw materials will be done/consumed and stock move lines of final product will be also done/produced. @param production_id: the ID of mrp.production object @param production_qty: specify qty to produce @param production_mode: specify production mode (consume/consume&produce). @return: True """ stock_mov_obj = self.pool.get('stock.move') production = self.browse(cr, uid, production_id) raw_product_todo = [] final_product_todo = [] | 2eaf0ee8a420b5273e173e5069355a17c874349e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2eaf0ee8a420b5273e173e5069355a17c874349e/mrp.py |
vals_line['amount'] = 00.0 | vals_line['amount'] = 0.0 | def create(self, cr, uid, vals, *args, **kwargs): obj_timesheet = self.pool.get('hr.analytic.timesheet') task_obj = self.pool.get('project.task') vals_line = {} obj_task = task_obj.browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.analytic_account_id.id vals_line['account_id'] = acc_id res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] amount = vals_line['unit_amount'] prod_id = vals_line['product_id'] unit = False timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=kwargs['context']) | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=kwargs['context']) | timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context) | def create(self, cr, uid, vals, *args, **kwargs): obj_timesheet = self.pool.get('hr.analytic.timesheet') task_obj = self.pool.get('project.task') vals_line = {} obj_task = task_obj.browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.analytic_account_id.id vals_line['account_id'] = acc_id res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] amount = vals_line['unit_amount'] prod_id = vals_line['product_id'] unit = False timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=kwargs['context']) | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
prod_id, amount, unit, context=kwargs['context']) if amount_unit: vals_line['amount'] = (-1) * vals['hours']* (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj_timesheet.write(cr, uid, [timeline_id], vals_line, {}) | prod_id, amount, unit, context=context) if amount_unit and 'amount' in amount_unit.get('value',{}): updv = { 'amount': amount_unit['value']['amount'] * (-1.0) } obj_timesheet.write(cr, uid, [timeline_id], updv, context=context) | def create(self, cr, uid, vals, *args, **kwargs): obj_timesheet = self.pool.get('hr.analytic.timesheet') task_obj = self.pool.get('project.task') vals_line = {} obj_task = task_obj.browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.analytic_account_id.id vals_line['account_id'] = acc_id res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] amount = vals_line['unit_amount'] prod_id = vals_line['product_id'] unit = False timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=kwargs['context']) | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
vals_line = {} | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_id # in case,if a record is deleted from timesheet,but we change it from tasks! list_avail_ids = timesheet_obj.search(cr, uid, [], context=context) if line_id in list_avail_ids: if 'name' in vals: vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/') if 'user_id' in vals: vals_line['user_id'] = vals['user_id'] result = self.get_user_related_details(cr, uid, vals['user_id']) vals_line['product_id'] = result['product_id'] vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['product_uom_id'] = result['product_uom_id'] if 'date' in vals: vals_line['date'] = vals['date'][:10] if 'hours' in vals: vals_line['unit_amount'] = vals['hours'] # Compute based on pricetype unit = False amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context=context) if amount_unit: vals_line['amount'] = (-1) * vals['hours'] * (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj.write(cr, uid, [line_id], vals_line, context=context) | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
|
task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_id list_avail_ids = timesheet_obj.search(cr, uid, [], context=context) if line_id in list_avail_ids: | if isinstance(ids, (long, int)): ids = [ids,] for task in self.browse(cr, uid, ids, context=context): line_id = task.hr_analytic_timesheet_id if not line_id: continue vals_line = {} | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_id # in case,if a record is deleted from timesheet,but we change it from tasks! list_avail_ids = timesheet_obj.search(cr, uid, [], context=context) if line_id in list_avail_ids: if 'name' in vals: vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/') if 'user_id' in vals: vals_line['user_id'] = vals['user_id'] result = self.get_user_related_details(cr, uid, vals['user_id']) vals_line['product_id'] = result['product_id'] vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['product_uom_id'] = result['product_uom_id'] if 'date' in vals: vals_line['date'] = vals['date'][:10] if 'hours' in vals: vals_line['unit_amount'] = vals['hours'] # Compute based on pricetype unit = False amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context=context) if amount_unit: vals_line['amount'] = (-1) * vals['hours'] * (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj.write(cr, uid, [line_id], vals_line, context=context) | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
vals_line['product_id'] = result['product_id'] vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['product_uom_id'] = result['product_uom_id'] | for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'): if result.get(fld, False): vals_line[fld] = result[fld] | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_id # in case,if a record is deleted from timesheet,but we change it from tasks! list_avail_ids = timesheet_obj.search(cr, uid, [], context=context) if line_id in list_avail_ids: if 'name' in vals: vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/') if 'user_id' in vals: vals_line['user_id'] = vals['user_id'] result = self.get_user_related_details(cr, uid, vals['user_id']) vals_line['product_id'] = result['product_id'] vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['product_uom_id'] = result['product_uom_id'] if 'date' in vals: vals_line['date'] = vals['date'][:10] if 'hours' in vals: vals_line['unit_amount'] = vals['hours'] # Compute based on pricetype unit = False amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context=context) if amount_unit: vals_line['amount'] = (-1) * vals['hours'] * (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj.write(cr, uid, [line_id], vals_line, context=context) | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
unit = False amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context=context) if amount_unit: vals_line['amount'] = (-1) * vals['hours'] * (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj.write(cr, uid, [line_id], vals_line, context=context) | amount_unit = obj.on_change_unit_amount(cr, uid, line_id.id, prod_id=prod_id, unit_amount=vals_line['unit_amount'], unit=False, context=context) if amount_unit and 'amount' in amount_unit.get('value',{}): vals_line['amount'] = amount_unit['value']['amount'] * (-1.0) obj.write(cr, uid, [line_id.id], vals_line, context=context) | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_id # in case,if a record is deleted from timesheet,but we change it from tasks! list_avail_ids = timesheet_obj.search(cr, uid, [], context=context) if line_id in list_avail_ids: if 'name' in vals: vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/') if 'user_id' in vals: vals_line['user_id'] = vals['user_id'] result = self.get_user_related_details(cr, uid, vals['user_id']) vals_line['product_id'] = result['product_id'] vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['product_uom_id'] = result['product_uom_id'] if 'date' in vals: vals_line['date'] = vals['date'][:10] if 'hours' in vals: vals_line['unit_amount'] = vals['hours'] # Compute based on pricetype unit = False amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context=context) if amount_unit: vals_line['amount'] = (-1) * vals['hours'] * (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj.write(cr, uid, [line_id], vals_line, context=context) | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] | hat_obj = self.pool.get('hr.analytic.timesheet') hat_ids = [] for task in self.browse(cr, uid, ids): if task.hr_analytic_timesheet_id: hat_ids.append(task.hr_analytic_timesheet_id) | def unlink(self, cr, uid, ids, *args, **kwargs): pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
list_avail_ids = pool_analytic_timesheet.search(cr, uid, []) if timesheet_id in list_avail_ids: obj = pool_analytic_timesheet.unlink(cr, uid, [timesheet_id], *args, **kwargs) | if hat_ids: hat_obj.unlink(cr, uid, hat_ids, *args, **kwargs) | def unlink(self, cr, uid, ids, *args, **kwargs): pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
'hr_analytic_timesheet_id':fields.integer('Related Timeline Id') | 'hr_analytic_timesheet_id':fields.many2one('hr.analytic.timesheet','Related Timeline Id', ondelete='set null'), | def unlink(self, cr, uid, ids, *args, **kwargs): pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] | c7aa00c70f256f0611b6d06a92928cb15447ab24 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c7aa00c70f256f0611b6d06a92928cb15447ab24/project_timesheet.py |
def _lang_get(self, cr, uid, context={}): | def _lang_get(self, cr, uid, context=None): | def _lang_get(self, cr, uid, context={}): """ Get language for language selection field. @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 @return: list of dictionary which contain code and name and id. """ obj = self.pool.get('res.lang') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['code', 'name'], context=context) res = [((r['code']).replace('_', '-').lower(), r['name']) for r in res] return res | ff92d26b785376d922a04928216940ff42bc351d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ff92d26b785376d922a04928216940ff42bc351d/base_calendar.py |
def _tz_get(self, cr, uid, context={}): | def _tz_get(self, cr, uid, context=None): | def _tz_get(self, cr, uid, context={}): return [(x.lower(), x) for x in pytz.all_timezones] | ff92d26b785376d922a04928216940ff42bc351d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ff92d26b785376d922a04928216940ff42bc351d/base_calendar.py |
def onchange_allday(self, cr, uid, ids, allday, context={}): | def onchange_allday(self, cr, uid, ids, allday, context=None): | def onchange_allday(self, cr, uid, ids, allday, context={}): """Sets duration as 24 Hours if event is selcted for all day @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 calendar event’s IDs. @param allday: Value of allday boolean @param context: A standard dictionary for contextual values """ if not allday or not ids: return {} event = self.browse(cr, uid, ids, context=context)[0] value = { 'duration': 24 } return {'value': value} | ff92d26b785376d922a04928216940ff42bc351d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ff92d26b785376d922a04928216940ff42bc351d/base_calendar.py |
def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}): | def browse(self, cr, uid, ids, context=None, list_class=None, fields_process=None): | def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}): """ Overrides orm browse 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 context: A standard dictionary for contextual values @return: the object list. """ if isinstance(ids, (str, int, long)): select = [ids] else: select = ids select = map(lambda x: base_calendar_id2real_id(x), select) res = super(calendar_event, self).browse(cr, uid, select, context, \ list_class, fields_process) if isinstance(ids, (str, int, long)): return res and res[0] or False | ff92d26b785376d922a04928216940ff42bc351d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ff92d26b785376d922a04928216940ff42bc351d/base_calendar.py |
WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %s", (date1, date2, a['id'])) | WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %s", (date1, date2, a['id'])) | def _lines_p(self, date1, date2): res = [] acc_obj = self.pool.get('account.account') | e36331787c17b71bcb2d7a5977d19917b2457494 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e36331787c17b71bcb2d7a5977d19917b2457494/analytic_check.py |
WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %s", (date1, date2, a['id'])) | WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %s", (date1, date2, a['id'])) | def _lines_p(self, date1, date2): res = [] acc_obj = self.pool.get('account.account') | e36331787c17b71bcb2d7a5977d19917b2457494 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e36331787c17b71bcb2d7a5977d19917b2457494/analytic_check.py |
'confirmed': "is scheduled for the '" + datetime.strptime(pick.min_date, '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d') + "'.", | 'confirmed': "is scheduled for the '" + msg , | def log_picking(self, cr, uid, ids, context=None): """ This function will create log messages for picking. @param cr: the database cursor @param uid: the current user's ID for security checks, @param ids: List of Picking Ids @param context: A standard dictionary for contextual values """ for pick in self.browse(cr, uid, ids, context=context): type_list = { 'out':'Picking List', 'in':'Reception', 'internal': 'Internal picking', 'delivery': 'Delivery order' } message = type_list.get(pick.type, _('Document')) + " '" + (pick.name or 'n/a') + "' " state_list = { 'confirmed': "is scheduled for the '" + datetime.strptime(pick.min_date, '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d') + "'.", 'assigned': 'is ready to process.', 'cancel': 'is Cancelled.', 'done': 'is processed.', 'draft':'is draft.', } message += state_list[pick.state] self.log(cr, uid, pick.id, message) return True | fa4e65df71ad1b87927438c040f34e634eb74604 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fa4e65df71ad1b87927438c040f34e634eb74604/stock.py |
self.styles[style.get('name')] = self._para_style_update(style) | sname = style.get('name') self.styles[sname] = self._para_style_update(style) self.styles_obj[sname] = reportlab.lib.styles.ParagraphStyle(sname, self.default_style["Normal"], **self.styles[sname]) | def __init__(self, nodes, localcontext): self.localcontext = localcontext self.styles = {} self.names = {} self.table_styles = {} for node in nodes: for style in node.findall('blockTableStyle'): self.table_styles[style.get('id')] = self._table_style_get(style) for style in node.findall('paraStyle'): self.styles[style.get('name')] = self._para_style_update(style) for variable in node.findall('initialize'): for name in variable.findall('name'): self.names[ name.get('id')] = name.get('value') | 1bfd4b60d0c9062ff808b28698b1b334ffd59186 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1bfd4b60d0c9062ff808b28698b1b334ffd59186/trml2pdf.py |
if node.get('style'): if node.get('style') in self.styles: styles = reportlab.lib.styles.getSampleStyleSheet() sname = node.get('style') style = reportlab.lib.styles.ParagraphStyle(sname, styles["Normal"], **self.styles[sname]) | sname = node.get('style') if sname: if sname in self.styles_obj: style = self.styles_obj[sname] | def para_style_get(self, node): style = False if node.get('style'): if node.get('style') in self.styles: styles = reportlab.lib.styles.getSampleStyleSheet() sname = node.get('style') style = reportlab.lib.styles.ParagraphStyle(sname, styles["Normal"], **self.styles[sname]) else: sys.stderr.write('Warning: style not found, %s - setting default!\n' % (node.get('style'),) ) if not style: styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Normal'] style.__dict__.update(self._para_style_update(node)) return style | 1bfd4b60d0c9062ff808b28698b1b334ffd59186 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1bfd4b60d0c9062ff808b28698b1b334ffd59186/trml2pdf.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.