rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
master_line = move_line_pool.create(cr, uid, move_line) | if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0): master_line = move_line_pool.create(cr, uid, move_line) | def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False | 3db30f732752ade5c9c2e3f43b43414620071ca3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3db30f732752ade5c9c2e3f43b43414620071ca3/voucher.py |
if inv.tax_id: | if inv.tax_id and inv.type in ('sale', 'purchase'): | def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False | 3db30f732752ade5c9c2e3f43b43414620071ca3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3db30f732752ade5c9c2e3f43b43414620071ca3/voucher.py |
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False | 3db30f732752ade5c9c2e3f43b43414620071ca3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3db30f732752ade5c9c2e3f43b43414620071ca3/voucher.py |
||
if inv.journal_id.type in ('sale','sale_refund', 'cash','bank'): | if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'): | def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False | 3db30f732752ade5c9c2e3f43b43414620071ca3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3db30f732752ade5c9c2e3f43b43414620071ca3/voucher.py |
move_pool.post(cr, uid, [move_id], context={}) | def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False | 3db30f732752ade5c9c2e3f43b43414620071ca3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3db30f732752ade5c9c2e3f43b43414620071ca3/voucher.py |
|
value = {} | value = dict.fromkeys(fields_list) | def default_get(self, cr, uid, fields_list, context=None): self.view_init(cr, uid, fields_list, context) if not context: context = {} value = {} # get the default values for the inherited fields for f in fields_list: if f in self._defaults: if callable(self._defaults[f]): value[f] = self._defaults[f](self, cr, uid, context) else: value[f] = self._defaults[f] | c4da7a2c7c276cf373d20493cc6f7079d14252e1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c4da7a2c7c276cf373d20493cc6f7079d14252e1/orm.py |
if r['res_model'] not in res_dict: res_dict[r['res_model']] = True | t = (r['res_model'], r['res_id']) if t not in res_dict: res_dict[t] = True | def get(self, cr, uid, context=None): unread_log_ids = self.search(cr, uid, [('user_id','=',uid), ('read', '=', False)], context=context) res = self.read(cr, uid, unread_log_ids, ['name','res_model','res_id'], context=context) res.reverse() result = [] res_dict = {} for r in res: if r['res_model'] not in res_dict: res_dict[r['res_model']] = True result.insert(0,r) self.write(cr, uid, unread_log_ids, {'read': True}, context=context) return result | 34976a6fcb023cfe2cb0e6f93b800edad0cc555b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/34976a6fcb023cfe2cb0e6f93b800edad0cc555b/res_log.py |
def convert_to_period(self, cr, uid, context={}): period_obj = self.pool.get('account.period') #check if the period_id changed in the context from client side if context.get('period_id', False): period_id = context.get('period_id') if type(period_id) == str: ids = period_obj.search(cr, uid, [('name','ilike',period_id)]) context.update({ 'period_id':ids[0] }) | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def convert_to_period(self, cr, uid, context={}): period_obj = self.pool.get('account.period') #check if the period_id changed in the context from client side if context.get('period_id', False): period_id = context.get('period_id') if type(period_id) == str: ids = period_obj.search(cr, uid, [('name','ilike',period_id)]) context.update({ 'period_id':ids[0] }) | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def _default_get(self, cr, uid, fields, context={}): period_obj = self.pool.get('account.period') | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def _default_get(self, cr, uid, fields, context={}): period_obj = self.pool.get('account.period') | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def _invoice(self, cursor, user, ids, name, arg, context=None): invoice_obj = self.pool.get('account.invoice') res = {} for line_id in ids: res[line_id] = False cursor.execute('SELECT l.id, i.id ' \ 'FROM account_move_line l, account_invoice i ' \ 'WHERE l.move_id = i.move_id ' \ 'AND l.id IN %s', (tuple(ids),)) invoice_ids = [] for line_id, invoice_id in cursor.fetchall(): res[line_id] = invoice_id invoice_ids.append(invoice_id) invoice_names = {False: ''} for invoice_id, name in invoice_obj.name_get(cursor, user, invoice_ids, context=context): invoice_names[invoice_id] = name for line_id in res.keys(): invoice_id = res[line_id] res[line_id] = (invoice_id, invoice_names[invoice_id]) return res | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
result['toolbar']['action'] = [] | if result.get('toolbar', False): result['toolbar']['action'] = [] | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': result['toolbar']['action'] = [] | 7b409568c140153319fd7867d4d38891793958c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b409568c140153319fd7867d4d38891793958c8/account_move_line.py |
||
if not os.path.exists(os.path.dirname(self.rcfile)): | rc_exists = os.path.exists(self.rcfile) if not rc_exists and not os.path.exists(os.path.dirname(self.rcfile)): | def save(self): p = ConfigParser.ConfigParser() loglevelnames = dict(zip(self._LOGLEVELS.values(), self._LOGLEVELS.keys())) p.add_section('options') for opt in self.options.keys(): if opt in ('version', 'language', 'translate_out', 'translate_in', 'init', 'update'): continue if opt in ('log_level', 'assert_exit_level'): p.set('options', opt, loglevelnames.get(self.options[opt], self.options[opt])) else: p.set('options', opt, self.options[opt]) | af817028c693ce1e500f9d3939c8bd7f688a3a68 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af817028c693ce1e500f9d3939c8bd7f688a3a68/config.py |
os.chmod(self.rcfile, 0600) | if not rc_exists: os.chmod(self.rcfile, 0600) | def save(self): p = ConfigParser.ConfigParser() loglevelnames = dict(zip(self._LOGLEVELS.values(), self._LOGLEVELS.keys())) p.add_section('options') for opt in self.options.keys(): if opt in ('version', 'language', 'translate_out', 'translate_in', 'init', 'update'): continue if opt in ('log_level', 'assert_exit_level'): p.set('options', opt, loglevelnames.get(self.options[opt], self.options[opt])) else: p.set('options', opt, self.options[opt]) | af817028c693ce1e500f9d3939c8bd7f688a3a68 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af817028c693ce1e500f9d3939c8bd7f688a3a68/config.py |
import random | def generate_phases(self, cr, uid, ids, *args): import random phase_obj = self.pool.get('document.change.process.phase') phase_type_obj = self.pool.get('document.change.process.phase.type') document_type_obj = self.pool.get('document.change.type') directory_obj = self.pool.get('document.directory') document_obj = self.pool.get('ir.attachment') new_doc_ids = [] for process in self.browse(cr, uid, ids): if process.process_model_id: directory_ids = directory_obj.search(cr, uid, [('parent_id','child_of',process.structure_id and process.structure_id.id)]) for phase_type_id in process.process_model_id.phase_type_ids: phase_value = { 'name' : '%s-%s' %(phase_type_id.name, process.name), 'phase_type_id': phase_type_id.id, 'process_id': process.id } phase_id = phase_obj.create(cr, uid, phase_value) cr.execute('select document_type_id from document_type_phase_type_rel where phase_type_id = %s' % phase_type_id.id) document_type_ids = map(lambda x: x[0], cr.fetchall()) document_ids = document_obj.search(cr, uid, [ ('parent_id','in',directory_ids), ('change_type_id','in',document_type_ids)]) for document_id in document_ids: vals = {'process_phase_id': phase_id} if process.pending_directory_id: vals.update({'parent_id':process.pending_directory_id.id}) new_doc_ids.append(document_obj.copy(cr, uid, document_id, vals)) phase_obj.write(cr, uid, [phase_id], {'phase_document_ids': [(6,0,document_ids)]}) self.write(cr, uid, [process.id],{'process_document_ids': [(6,0,new_doc_ids)]}) | adc7ead3129a777d96ed0e7e201e3519e14927d3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/adc7ead3129a777d96ed0e7e201e3519e14927d3/document_change.py |
|
Raises `LookupError`: if we couldn't find *any* previous todo `ValueError`: if no state is provided anything ir_actions_todo.write can throw | def _set_previous_todo(self, cr, uid, state, context=None): """ lookup the previous (which is still the next at this point) ir.actions.todo, set it to whatever state was provided. | 31346d6259e4e605f7abaa2b438a2c1fabbcc982 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/31346d6259e4e605f7abaa2b438a2c1fabbcc982/res_config.py |
|
case_pool=pool.get('crm.case') | case_pool=pool.get(data['model']) | def _mass_mail_send(self, cr, uid, data, context): attach = filter(lambda x: x, [data['form']['doc1'], data['form']['doc2'], data['form']['doc3']]) attach = map(lambda x: x and ('Attachment'+str(attach.index(x)+1), base64.decodestring(x)), attach) pool = pooler.get_pool(cr.dbname) case_pool=pool.get('crm.case') case = case_pool.browse(cr,uid,data['ids'])[0] case_pool.write(cr, uid, [case.id], { 'som': False, 'canal_id': False, }) emails = [data['form']['to']] + (data['form']['cc'] or '').split(',') emails = filter(None, emails) body = data['form']['text'] if not case.user_id.address_id.email: raise wizard.except_wizard(_('Warning!'),_("Please specify user's email address !")) if case.user_id.signature: body += '\n\n%s' % (case.user_id.signature) case_pool._history(cr, uid, [case], _('Send'), history=True, email=False, details=body) flag = tools.email_send( case.user_id.address_id.email, emails, data['form']['subject'], body, case_pool.format_body(body), attach=attach, reply_to=case.section_id.reply_to, tinycrm=str(case.id) ) if flag: if data['form']['state'] == 'unchanged': pass elif data['form']['state'] == 'done': case_pool.case_close(cr, uid, data['ids']) elif data['form']['state'] == 'pending': case_pool.case_pending(cr, uid, data['ids']) cr.commit() else: raise wizard.except_wizard(_('Warning!'),_("Email not sent !")) return {} | 6ed7e4ca628406c9b1d6ea4d501012c632de12a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6ed7e4ca628406c9b1d6ea4d501012c632de12a8/wizard_crm_new_send_email.py |
case = pool.get('crm.lead').browse(cr, uid, data['id']) | case = pool.get(data['model']).browse(cr, uid, data['id']) | def _get_info(self, cr, uid, data, context): if not data['id']: return {} pool = pooler.get_pool(cr.dbname) case = pool.get('crm.lead').browse(cr, uid, data['id']) if not case.user_id: raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!')) return { 'to': case.email_from, 'subject': case.name, 'cc': case.email_cc or '' } | 6ed7e4ca628406c9b1d6ea4d501012c632de12a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6ed7e4ca628406c9b1d6ea4d501012c632de12a8/wizard_crm_new_send_email.py |
def _equal_balance(self, cr, uid, ids, statement, context={}): if statement.balance_end != statement.balance_end_cash: return False else: return True def _user_allow(self, cr, uid, ids, statement, context={}): return True | def onchange_journal_id(self, cr, uid, statement_id, journal_id, context={}): """ Changes balance start and starting details if journal_id changes" @param statement_id: Changed statement_id @param journal_id: Changed journal_id @return: Dictionary of changed values """ cash_pool = self.pool.get('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement') | 17af0113924d412540ea92b2ce6f471d43bd411b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/17af0113924d412540ea92b2ce6f471d43bd411b/account_cash_statement.py |
|
if st.balance_end != st.balance_end_cash: | if not self._equal_balance(cr, uid, ids, st, context): | def button_confirm(self, cr, uid, ids, context={}): """ Check the starting and ending detail of statement @return: True """ done = [] res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') | 17af0113924d412540ea92b2ce6f471d43bd411b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/17af0113924d412540ea92b2ce6f471d43bd411b/account_cash_statement.py |
msg_txt = email.message_from_string(message) | def parse_message(self, message): #TOCHECK: put this function in mailgateway module msg_txt = email.message_from_string(message) message_id = msg_txt.get('message-id', False) msg = {} msg_txt = email.message_from_string(message) fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = message_id | c5ef622acbb52c8289d110ea9d078c023d4089d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5ef622acbb52c8289d110ea9d078c023d4089d6/partner.py |
|
def parse_message(self, message): #TOCHECK: put this function in mailgateway module msg_txt = email.message_from_string(message) message_id = msg_txt.get('message-id', False) msg = {} msg_txt = email.message_from_string(message) fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = message_id | c5ef622acbb52c8289d110ea9d078c023d4089d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5ef622acbb52c8289d110ea9d078c023d4089d6/partner.py |
||
msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)]) | msg_ids = [] | def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)]) res = {} res_ids = [] if msg_ids and len(msg_ids): return 0 | c5ef622acbb52c8289d110ea9d078c023d4089d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5ef622acbb52c8289d110ea9d078c023d4089d6/partner.py |
if msg_ids and len(msg_ids): return 0 | if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)]) if msg_ids and len(msg_ids): return 0 | def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)]) res = {} res_ids = [] if msg_ids and len(msg_ids): return 0 | c5ef622acbb52c8289d110ea9d078c023d4089d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5ef622acbb52c8289d110ea9d078c023d4089d6/partner.py |
def allow_cancel(self, cr, uid, ids, context={}): for pick in self.browse(cr, uid, ids, context=context): if not pick.move_lines: return True for move in pick.move_lines: if move.state == 'done': return False return True | def test_cancel(self, cr, uid, ids, context=None): """ Test whether the move lines are canceled or not. @return: True or False """ for pick in self.browse(cr, uid, ids, context=context): if not pick.move_lines: return False for move in pick.move_lines: if move.state not in ('cancel',): return False return True | b792ea494ec867ed773e55d56ef347472410ca71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b792ea494ec867ed773e55d56ef347472410ca71/stock.py |
|
self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) | ctx2 = data['form'].get('used_context',{}).copy() ctx2.update({'initial_bal': True}) self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2) | def set_context(self, objects, data, ids, report_type=None): obj_move = self.pool.get('account.move.line') self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {})) self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) self.reconcil = data['form'].get('reconcil', True) self.initial_balance = data['form'].get('initial_balance', True) self.result_selection = data['form'].get('result_selection', 'customer') self.amount_currency = data['form'].get('amount_currency', False) self.target_move = data['form'].get('target_move', 'all') PARTNER_REQUEST = '' move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] | 5c07eacf45e06e17e8f8a51bfe94ed14e3745fb9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5c07eacf45e06e17e8f8a51bfe94ed14e3745fb9/account_partner_ledger.py |
html = html.replace('\n',' ') | def html2plaintext(html, body_id=None, encoding='utf-8'): ## (c) Fry-IT, www.fry-it.com, 2007 ## <[email protected]> ## download here: http://www.peterbe.com/plog/html2plaintext """ from an HTML text, convert the HTML to plain text. If @body_id is provided then this is the tag where the body (not necessarily <body>) starts. """ html = ustr(html) try: from BeautifulSoup import BeautifulSoup, SoupStrainer, Comment except: return html urls = [] if body_id is not None: strainer = SoupStrainer(id=body_id) else: strainer = SoupStrainer('body') soup = BeautifulSoup(html, parseOnlyThese=strainer, fromEncoding=encoding) for link in soup.findAll('a'): title = link.renderContents() for url in [x[1] for x in link.attrs if x[0]=='href']: urls.append(dict(url=ustr(url), tag=ustr(link), title=ustr(title))) html = ustr(soup.__str__()) url_index = [] i = 0 for d in urls: if d['title'] == d['url'] or 'http://'+d['title'] == d['url']: html = html.replace(d['tag'], d['url']) else: i += 1 html = html.replace(d['tag'], '%s [%s]' % (d['title'], i)) url_index.append(d['url']) html = html.replace('<strong>','*').replace('</strong>','*') html = html.replace('<b>','*').replace('</b>','*') html = html.replace('<h3>','*').replace('</h3>','*') html = html.replace('<h2>','**').replace('</h2>','**') html = html.replace('<h1>','**').replace('</h1>','**') html = html.replace('<em>','/').replace('</em>','/') # the only line breaks we respect is those of ending tags and # breaks html = html.replace('\n',' ') html = html.replace('<br>', '\n') html = html.replace('<tr>', '\n') html = html.replace('</p>', '\n\n') html = re.sub('<br\s*/>', '\n', html) html = html.replace(' ' * 2, ' ') # for all other tags we failed to clean up, just remove then and # complain about them on the stderr def desperate_fixer(g): #print >>sys.stderr, "failed to clean up %s" % str(g.group()) return ' ' html = re.sub('<.*?>', desperate_fixer, html) # lstrip all lines html = '\n'.join([x.lstrip() for x in html.splitlines()]) for i, url in enumerate(url_index): if i == 0: html += '\n\n' html += ustr('[%s] %s\n') % (i+1, url) return html | 59fe0a4d123be14ac56195e3636c52c0d4fe4c57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/59fe0a4d123be14ac56195e3636c52c0d4fe4c57/misc.py |
|
def run_test(self, cr, uid, module_path): pool = pooler.get_pool(cr.dbname) module_name = module_path.split('/')[-1] obj_list = self.get_objects(cr, uid, module_name) | 22278b6242afd032468d7c6f732f1cfc90f65253 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/22278b6242afd032468d7c6f732f1cfc90f65253/speed_test.py |
||
pool.get(obj).read(cr, uid, [ids[0]]) cnt = cr.count pool.get(obj).read(cr, uid, [ids[0]]) code_base_complexity = cr.count - cnt | pool.get(obj).read(cr, uid, ids) | def run_test(self, cr, uid, module_path): pool = pooler.get_pool(cr.dbname) module_name = module_path.split('/')[-1] obj_list = self.get_objects(cr, uid, module_name) | 22278b6242afd032468d7c6f732f1cfc90f65253 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/22278b6242afd032468d7c6f732f1cfc90f65253/speed_test.py |
pool.get(obj).read(cr, uid, ids[:size/2]) cnt = cr.count pool.get(obj).read(cr, uid, ids[:size/2]) code_half_complexity = cr.count - cnt | ccr.reset() pool.get(obj).read(ccr, uid, [ids[0]]) code_base_complexity = ccr.count | def run_test(self, cr, uid, module_path): pool = pooler.get_pool(cr.dbname) module_name = module_path.split('/')[-1] obj_list = self.get_objects(cr, uid, module_name) | 22278b6242afd032468d7c6f732f1cfc90f65253 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/22278b6242afd032468d7c6f732f1cfc90f65253/speed_test.py |
pool.get(obj).read(cr, uid, ids) cnt = cr.count pool.get(obj).read(cr, uid, ids) code_size_complexity = cr.count - cnt | ccr.reset() pool.get(obj).read(ccr, uid, ids[:size/2]) code_half_complexity = ccr.count ccr.reset() pool.get(obj).read(ccr, uid, ids) code_size_complexity = ccr.count | def run_test(self, cr, uid, module_path): pool = pooler.get_pool(cr.dbname) module_name = module_path.split('/')[-1] obj_list = self.get_objects(cr, uid, module_name) | 22278b6242afd032468d7c6f732f1cfc90f65253 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/22278b6242afd032468d7c6f732f1cfc90f65253/speed_test.py |
datetime.strptime(guarantee_limit, '%Y-%m-%d') < datetime.now()): | datetime.strptime(guarantee_limit, '%Y-%m-%d') < datetime.now()) | def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit): """ On change of operation type it sets source location, destination location and to invoice field. @param product: Changed operation type. @param guarantee_limit: Guarantee limit of current record. @return: Dictionary of values. """ if not type: return {'value': { 'location_id': False, 'location_dest_id': False } } | c36a3d33908bf17dd4ade84985a9c7d7ee213456 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c36a3d33908bf17dd4ade84985a9c7d7ee213456/mrp_repair.py |
self.obj_pl = report_pl.report_pl_account_horizontal(cr, uid, name, context=context) | self.obj_pl = account_profit_loss.report_pl_account_horizontal(cr, uid, name, context=context) | def __init__(self, cr, uid, name, context=None): super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context=context) self.obj_pl = report_pl.report_pl_account_horizontal(cr, uid, name, context=context) self.result_sum_dr = 0.0 self.result_sum_cr = 0.0 self.result = {} self.res_bl = {} self.result_temp = [] self.localcontext.update({ 'time': time, 'get_abs' : self.get_abs, 'get_lines' : self.get_lines, 'get_lines_another' : self.get_lines_another, 'get_company': self._get_company, 'get_currency': self._get_currency, 'sum_dr' : self.sum_dr, 'sum_cr' : self.sum_cr, 'get_data':self.get_data, 'get_pl_balance':self.get_pl_balance, 'get_fiscalyear': self._get_fiscalyear, 'get_account': self._get_account, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, 'get_sortby': self._get_sortby, 'get_filter': self._get_filter, 'get_journal': self._get_journal, 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, 'get_company':self._get_company, | df3fd62fe5313aea54699dceb6d18e6a1c85abe6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/df3fd62fe5313aea54699dceb6d18e6a1c85abe6/account_balance_sheet.py |
ids = map(lambda x: base_calendar_id2real_id(x), ids) | ids = map(lambda x: base_calendar.base_calendar_id2real_id(x), ids) | def export_cal(self, cr, uid, ids, context={}): ids = map(lambda x: base_calendar_id2real_id(x), ids) event_data = self.read(cr, uid, ids) event_obj = self.pool.get('basic.calendar.event') ical = event_obj.export_cal(cr, uid, event_data, context={'model': self._name}) return ical.serialize() | 71beda7a3f69690a2351cc4100b38d7c893f8da3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/71beda7a3f69690a2351cc4100b38d7c893f8da3/crm_caldav.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_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': if data['form']['period_from'] == False or data['form']['period_to'] == False: raise osv.except_osv(_('Error'),_('Select Start period and End 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 | bc752eeb6ba75ccffd13114288eb8a75ae2f78dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bc752eeb6ba75ccffd13114288eb8a75ae2f78dd/account_common_report.py |
new_qty = data['form']['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_stock_return_history: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False | def _create_returns(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) move_obj = pool.get('stock.move') pick_obj = pool.get('stock.picking') uom_obj = pool.get('product.uom') pick=pick_obj.browse(cr, uid, [data['id']])[0] new_picking=None date_cur=time.strftime('%Y-%m-%d %H:%M:%S') for move in move_obj.browse(cr, uid, data['form'].get('returns',[])): if not new_picking: if pick.type=='out': new_type='in' elif pick.type=='in': new_type='out' else: new_type='internal' new_picking=pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['form']['invoice_state'],}) new_location=move.location_dest_id.id new_move=move_obj.copy(cr, uid, move.id, { 'product_qty': data['form']['return%s' % move.id], 'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id, data['form']['return%s' % move.id], move.product_uos.id), 'picking_id':new_picking, 'state':'draft', 'location_id':new_location, 'location_dest_id':move.location_id.id, 'date':date_cur, 'date_planned':date_cur,}) move_obj.write(cr, uid, [move.id], {'move_stock_return_history':[(4,new_move)]}) if new_picking: wf_service = netsvc.LocalService("workflow") if new_picking: wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr) pick_obj.force_assign(cr, uid, [new_picking], context) return new_picking | e811f5a9018bfce4110831c47726f587fd883754 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e811f5a9018bfce4110831c47726f587fd883754/wizard_return.py |
|
'product_qty': data['form']['return%s' % move.id], | 'product_qty': new_qty, | def _create_returns(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) move_obj = pool.get('stock.move') pick_obj = pool.get('stock.picking') uom_obj = pool.get('product.uom') pick=pick_obj.browse(cr, uid, [data['id']])[0] new_picking=None date_cur=time.strftime('%Y-%m-%d %H:%M:%S') for move in move_obj.browse(cr, uid, data['form'].get('returns',[])): if not new_picking: if pick.type=='out': new_type='in' elif pick.type=='in': new_type='out' else: new_type='internal' new_picking=pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['form']['invoice_state'],}) new_location=move.location_dest_id.id new_move=move_obj.copy(cr, uid, move.id, { 'product_qty': data['form']['return%s' % move.id], 'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id, data['form']['return%s' % move.id], move.product_uos.id), 'picking_id':new_picking, 'state':'draft', 'location_id':new_location, 'location_dest_id':move.location_id.id, 'date':date_cur, 'date_planned':date_cur,}) move_obj.write(cr, uid, [move.id], {'move_stock_return_history':[(4,new_move)]}) if new_picking: wf_service = netsvc.LocalService("workflow") if new_picking: wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr) pick_obj.force_assign(cr, uid, [new_picking], context) return new_picking | e811f5a9018bfce4110831c47726f587fd883754 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e811f5a9018bfce4110831c47726f587fd883754/wizard_return.py |
data['form']['return%s' % move.id], move.product_uos.id), | new_qty, move.product_uos.id), | def _create_returns(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) move_obj = pool.get('stock.move') pick_obj = pool.get('stock.picking') uom_obj = pool.get('product.uom') pick=pick_obj.browse(cr, uid, [data['id']])[0] new_picking=None date_cur=time.strftime('%Y-%m-%d %H:%M:%S') for move in move_obj.browse(cr, uid, data['form'].get('returns',[])): if not new_picking: if pick.type=='out': new_type='in' elif pick.type=='in': new_type='out' else: new_type='internal' new_picking=pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['form']['invoice_state'],}) new_location=move.location_dest_id.id new_move=move_obj.copy(cr, uid, move.id, { 'product_qty': data['form']['return%s' % move.id], 'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id, data['form']['return%s' % move.id], move.product_uos.id), 'picking_id':new_picking, 'state':'draft', 'location_id':new_location, 'location_dest_id':move.location_id.id, 'date':date_cur, 'date_planned':date_cur,}) move_obj.write(cr, uid, [move.id], {'move_stock_return_history':[(4,new_move)]}) if new_picking: wf_service = netsvc.LocalService("workflow") if new_picking: wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr) pick_obj.force_assign(cr, uid, [new_picking], context) return new_picking | e811f5a9018bfce4110831c47726f587fd883754 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e811f5a9018bfce4110831c47726f587fd883754/wizard_return.py |
addr, port = self.request.getsockname() | if hasattr(self.request, 'getsockname'): addr, port = self.request.getsockname() | def setup(self): self.davpath = '/'+config.get_misc('webdav','vdir','webdav') addr, port = self.server.server_name, self.server.server_port server_proto = getattr(self.server,'proto', 'http').lower() try: addr, port = self.request.getsockname() except Exception, e: self.log_error("Cannot calculate own address:" , e) # Too early here to use self.headers self.baseuri = "%s://%s:%d/"% (server_proto, addr, port) self.IFACE_CLASS = openerp_dav_handler(self, self.verbose) | 8ce30bcea65ae55572506e2f8b895192fc944305 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8ce30bcea65ae55572506e2f8b895192fc944305/webdav_server.py |
self.log_error("Cannot calculate own address:" , e) | self.log_error("Cannot calculate own address: %s" , e) | def setup(self): self.davpath = '/'+config.get_misc('webdav','vdir','webdav') addr, port = self.server.server_name, self.server.server_port server_proto = getattr(self.server,'proto', 'http').lower() try: addr, port = self.request.getsockname() except Exception, e: self.log_error("Cannot calculate own address:" , e) # Too early here to use self.headers self.baseuri = "%s://%s:%d/"% (server_proto, addr, port) self.IFACE_CLASS = openerp_dav_handler(self, self.verbose) | 8ce30bcea65ae55572506e2f8b895192fc944305 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8ce30bcea65ae55572506e2f8b895192fc944305/webdav_server.py |
reference = obj_inv.reference or number or '' | reference = obj_inv.reference or '' | def action_number(self, cr, uid, ids, *args): #TODO: not correct fix but required a frech values before reading it. self.write(cr, uid, ids, {}) | 8add10403c5d9277ae93b84db9928f7a04035f35 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8add10403c5d9277ae93b84db9928f7a04035f35/invoice.py |
ref = reference | if not reference: ref = self._convert_ref(cr, uid, number) else: ref = reference | def action_number(self, cr, uid, ids, *args): #TODO: not correct fix but required a frech values before reading it. self.write(cr, uid, ids, {}) | 8add10403c5d9277ae93b84db9928f7a04035f35 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8add10403c5d9277ae93b84db9928f7a04035f35/invoice.py |
ttype = context.get('ttype', False) | ttype = context.get('type', False) | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Returns a list of ids based on search domain {args} @param cr: A database cursor @param user: ID of the user currently logged in @param args: list of conditions to be applied in search opertion @param offset: default from first record, you can start from nth record @param limit: number of records to be obtained as a result of search opertion @param order: ordering on any field(s) @param context: context arguments, like lang, time zone @param count: @return: Returns a list of ids based on search domain """ if not context: context = {} ttype = context.get('ttype', False) partner = context.get('partner_id', False) voucher = context.get('voucher', False) if voucher and not partner: raise osv.except_osv(_('Invalid Partner !'), _('Please select the partner !')) if ttype and ttype in ('receipt'): args += [('journal_id.type','in', ['sale', 'purchase_refund'])] elif ttype and ttype in ('payment'): args += [('journal_id.type','in', ['purchase', 'sale_refund'])] elif ttype and ttype in('sale', 'purchase'): raise osv.except_osv(_('Invalid action !'), _('You can not reconcile sales, purchase, or journal voucher with invoice !')) args += [('journal_id.type','=', 'do_not_allow_search')] res = super(account_move, self).search(cr, user, args, offset, limit, order, context, count) return res | 57362a8ac0406ca29ecb3bb4f9b73d70de828639 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/57362a8ac0406ca29ecb3bb4f9b73d70de828639/voucher.py |
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): | if (m.product_id.cost_method == 'average'): | def view_init(self, cr, uid, fields_list, context=None): res = super(stock_partial_move, self).view_init(cr, uid, fields_list, context=context) move_obj = self.pool.get('stock.move') if not context: context={} for m in move_obj.browse(cr, uid, context.get('active_ids', [])): if m.state in ('done', 'cancel'): raise osv.except_osv(_('Invalid action !'), _('Cannot deliver products which are already delivered !')) | 8259566f5354c077fb1a8488e173546ed1031041 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8259566f5354c077fb1a8488e173546ed1031041/stock_partial_move.py |
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): | if m.product_id.cost_method == 'average': | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(stock_partial_move, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) move_obj = self.pool.get('stock.move') move_ids = context.get('active_ids', False) move_ids = move_obj.search(cr, uid, [('id','in',move_ids)]) _moves_arch_lst = """<form string="Deliver Products"> <separator colspan="4" string="Delivery Information"/> <field name="date" colspan="2"/> <separator colspan="4" string="Move Detail"/> """ _moves_fields = result['fields'] if move_ids and view_type in ['form']: for m in move_obj.browse(cr, uid, move_ids, context): if m.state in ('done', 'cancel'): continue _moves_fields.update({ 'move%s_product_id'%(m.id) : { 'string': _('Product'), 'type' : 'many2one', 'relation': 'product.product', 'required' : True, 'readonly' : True, }, 'move%s_product_qty'%(m.id) : { 'string': _('Quantity'), 'type' : 'float', 'required': True, }, 'move%s_product_uom'%(m.id) : { 'string': _('Product UOM'), 'type' : 'many2one', 'relation': 'product.uom', 'required' : True, 'readonly' : True, }, 'move%s_prodlot_id'%(m.id): { 'string': _('Production Lot'), 'type': 'many2one', 'relation': 'stock.production.lot', } }) | 8259566f5354c077fb1a8488e173546ed1031041 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8259566f5354c077fb1a8488e173546ed1031041/stock_partial_move.py |
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): | if m.product_id.cost_method == 'average': | def do_partial(self, cr, uid, ids, context): """ Makes partial moves and pickings done. @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 which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ | 8259566f5354c077fb1a8488e173546ed1031041 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8259566f5354c077fb1a8488e173546ed1031041/stock_partial_move.py |
def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): | def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 for data in cr.dictfetchall(): start_date = base_start_date and datetime.datetime.strptime(base_start_date, "%Y-%m-%d") or False until_date = base_until_date and datetime.datetime.strptime(base_until_date, "%Y-%m-%d") or False if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: if start_date and event_date < start_date: continue if until_date and event_date > until_date: continue idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: r_date = datetime.datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S") if start_date and r_date < start_date: continue if until_date and r_date > until_date: continue idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids | bfbc90b73e50e34661c5b23f22b2c1f805e5af72 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bfbc90b73e50e34661c5b23f22b2c1f805e5af72/crm_meeting.py |
result = [] | def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 for data in cr.dictfetchall(): start_date = base_start_date and datetime.datetime.strptime(base_start_date, "%Y-%m-%d") or False until_date = base_until_date and datetime.datetime.strptime(base_until_date, "%Y-%m-%d") or False if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: if start_date and event_date < start_date: continue if until_date and event_date > until_date: continue idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: r_date = datetime.datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S") if start_date and r_date < start_date: continue if until_date and r_date > until_date: continue idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids | bfbc90b73e50e34661c5b23f22b2c1f805e5af72 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bfbc90b73e50e34661c5b23f22b2c1f805e5af72/crm_meeting.py |
|
ids = result return ids | if isinstance(select, (str, int, long)): return result and result[0] or False return result | def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 for data in cr.dictfetchall(): start_date = base_start_date and datetime.datetime.strptime(base_start_date, "%Y-%m-%d") or False until_date = base_until_date and datetime.datetime.strptime(base_until_date, "%Y-%m-%d") or False if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: if start_date and event_date < start_date: continue if until_date and event_date > until_date: continue idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: r_date = datetime.datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S") if start_date and r_date < start_date: continue if until_date and r_date > until_date: continue idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids | bfbc90b73e50e34661c5b23f22b2c1f805e5af72 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bfbc90b73e50e34661c5b23f22b2c1f805e5af72/crm_meeting.py |
if not isinstance(res,list): res= [res] | def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): start_date = arg[2] elif arg[1] in ('<', '<='): until_date = arg[2] res = super(crm_meeting, self).search(cr, uid, args_without_date, offset, limit, order, context, count) if not isinstance(res,list): res= [res] return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) | bfbc90b73e50e34661c5b23f22b2c1f805e5af72 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bfbc90b73e50e34661c5b23f22b2c1f805e5af72/crm_meeting.py |
|
'name': name, | 'name' : name, | def action_move_line_create(self, cr, uid, ids, *args): for inv in self.browse(cr, uid, ids): if inv.move_id: continue company_currency = inv.company_id.currency_id.id | b98827bb140df79b47070e2be2b2d4db059f050d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b98827bb140df79b47070e2be2b2d4db059f050d/voucher.py |
'voucher_type':inv.type, | 'type' : inv.type, | def action_move_line_create(self, cr, uid, ids, *args): for inv in self.browse(cr, uid, ids): if inv.move_id: continue company_currency = inv.company_id.currency_id.id | b98827bb140df79b47070e2be2b2d4db059f050d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b98827bb140df79b47070e2be2b2d4db059f050d/voucher.py |
def onchange_type(self, cr, uid, ids, type, currency): | def onchange_type(self, cr, uid, ids, type, currency, context=None): | def onchange_type(self, cr, uid, ids, type, currency): obj_data = self.pool.get('ir.model.data') user_pool = self.pool.get('res.users') | 024bb524f6cda18b41563712e6c39a589dc0b963 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/024bb524f6cda18b41563712e6c39a589dc0b963/account.py |
pricelist_version_ids = product_pricelist_version_obj.search(cr, uid, []) | pricelist_version_ids = self.pool.get('product.pricelist').search(cr, uid, []) | def _create_parent_category_list(id, lst): if not id: return [] parent = product_category_tree.get(id) if parent: lst.append(parent) return _create_parent_category_list(parent, lst) else: return lst | 29cf676c6573b43275e4b70f2849314af88dee36 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/29cf676c6573b43275e4b70f2849314af88dee36/pricelist.py |
def _create_parent_category_list(id, lst): if not id: return [] parent = product_category_tree.get(id) if parent: lst.append(parent) return _create_parent_category_list(parent, lst) else: return lst | 29cf676c6573b43275e4b70f2849314af88dee36 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/29cf676c6573b43275e4b70f2849314af88dee36/pricelist.py |
||
obj = self.pool.get(template.object_name.model) | def unlink_action(self, cr, uid, ids, context): for template in self.browse(cr, uid, ids, context): obj = self.pool.get(template.object_name.model) try: if template.ref_ir_act_window: self.pool.get('ir.actions.act_window').unlink(cr, uid, template.ref_ir_act_window.id, context) if template.ref_ir_value: self.pool.get('ir.values').unlink(cr, uid, template.ref_ir_value.id, context) except: raise osv.except_osv(_("Warning"), _("Deletion of Record failed")) | dce4e7401055390d5d7eb1259553f9332ac6949d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/dce4e7401055390d5d7eb1259553f9332ac6949d/email_template.py |
|
if not ids: raise ValueError() prop = self.browse(cr, uid, ids[0]) type_ = prop.type | if ids: prop = self.browse(cr, uid, ids[0]) type_ = prop.type else: type_ = self._defaults['type'] | def _update_values(self, cr, uid, ids, values): value = values.pop('value', None) if not value: return values | 5158948630d9c45d78aa832550bcf6e9b7eb6d1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5158948630d9c45d78aa832550bcf6e9b7eb6d1b/ir_property.py |
def _sheet_search(self, cursor, user, obj, name, args, context): | def _sheet_search(self, cursor, user, obj, name, args, context=None): | def _sheet_search(self, cursor, user, obj, name, args, context): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') | e70dd4a5a43cb9ef4822f8f07fe967fafd058823 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e70dd4a5a43cb9ef4822f8f07fe967fafd058823/hr_timesheet_sheet.py |
def _sheet_search(self, cursor, user, obj, name, args, context={}): | def _sheet_search(self, cursor, user, obj, name, args, context=None): | def _sheet_search(self, cursor, user, obj, name, args, context={}): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') | e70dd4a5a43cb9ef4822f8f07fe967fafd058823 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e70dd4a5a43cb9ef4822f8f07fe967fafd058823/hr_timesheet_sheet.py |
super(Workflow, self).__init__(**kwargs) | super(ActWindow, self).__init__(**kwargs) | def __init__(self, model, action, **kwargs): self.model = model self.action = action super(Workflow, self).__init__(**kwargs) | 2b3611cb376cd49c57243e74387b0facedd4f537 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2b3611cb376cd49c57243e74387b0facedd4f537/yaml_test.py |
class Ref(YamlTag): def __init__(self, xmlid): self.xmlid = xmlid super(Ref, self).__init__() | class IrSet(YamlTag): def __init__(self): super(IrSet, self).__init__() | def __init__(self, expression): self.expression = expression super(Eval, self).__init__() | 2b3611cb376cd49c57243e74387b0facedd4f537 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2b3611cb376cd49c57243e74387b0facedd4f537/yaml_test.py |
def ref_constructor(loader, node): xmlid = loader.construct_scalar(node) return Ref(xmlid) | def ir_set_constructor(loader, node): kwargs = loader.construct_mapping(node) return IrSet(**kwargs) | def ref_constructor(loader, node): xmlid = loader.construct_scalar(node) return Ref(xmlid) | 2b3611cb376cd49c57243e74387b0facedd4f537 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2b3611cb376cd49c57243e74387b0facedd4f537/yaml_test.py |
yaml.add_constructor(u"!ref", ref_constructor) | yaml.add_constructor(u"!ir_set", ir_set_constructor) | def ref_constructor(loader, node): xmlid = loader.construct_scalar(node) return Ref(xmlid) | 2b3611cb376cd49c57243e74387b0facedd4f537 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2b3611cb376cd49c57243e74387b0facedd4f537/yaml_test.py |
def is_ref(node): return isinstance(node, Ref) | def is_ir_set(node): return _is_yaml_mapping(node, IrSet) | def is_ref(node): return isinstance(node, Ref) | 2b3611cb376cd49c57243e74387b0facedd4f537 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2b3611cb376cd49c57243e74387b0facedd4f537/yaml_test.py |
AND l2.id IN %%s AND """ + \ | AND l2.id IN %s AND """ + \ | def _balance(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} c = context.copy() c['initital_bal'] = True sql = """SELECT l2.id, SUM(l1.debit-l1.credit) FROM account_move_line l1, account_move_line l2 WHERE l2.account_id = l1.account_id AND l1.id <= l2.id AND l2.id IN %%s AND """ + \ self._query_get(cr, uid, obj='l1', context=c) + \ " GROUP BY l2.id" | d45fb357424216cbf31ee84d474f56249c16f383 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d45fb357424216cbf31ee84d474f56249c16f383/account_move_line.py |
def _inherit_apply(src, inherit): | def raise_view_error(error_msg, child_view_id): view, child_view = self.pool.get('ir.ui.view').browse(cr, user, [view_id, child_view_id], context) raise AttributeError(("View definition error for inherited view '%(xml_id)s' on '%(model)s' model: " + error_msg) % { 'xml_id': child_view.xml_id, 'parent_xml_id': view.xml_id, 'model': self._name, }) def _inherit_apply(src, inherit, inherit_id=None): | def _inherit_apply(src, inherit): def _find(node, node2): if node2.tag == 'xpath': res = node.xpath(node2.get('expr')) if res: return res[0] else: return None else: for n in node.getiterator(node2.tag): res = True if node2.tag == 'field': # only compare field names, a field can be only once in a given view # at a given level (and for multilevel expressions, we should use xpath # inheritance spec anyway) if node2.get('name') == n.get('name'): return n else: continue for attr in node2.attrib: if attr == 'position': continue if n.get(attr): if n.get(attr) == node2.get(attr): continue res = False if res: return n return None | 5b67a3154e0e02212c6bd648ed6a5ebf91dc831e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5b67a3154e0e02212c6bd648ed6a5ebf91dc831e/orm.py |
raise AttributeError(_('Unknown position in inherited view %s !') % pos) | raise_view_error("Invalid position value: '%s'" % pos, inherit_id) | def _find(node, node2): if node2.tag == 'xpath': res = node.xpath(node2.get('expr')) if res: return res[0] else: return None else: for n in node.getiterator(node2.tag): res = True if node2.tag == 'field': # only compare field names, a field can be only once in a given view # at a given level (and for multilevel expressions, we should use xpath # inheritance spec anyway) if node2.get('name') == n.get('name'): return n else: continue for attr in node2.attrib: if attr == 'position': continue if n.get(attr): if n.get(attr) == node2.get(attr): continue res = False if res: return n return None | 5b67a3154e0e02212c6bd648ed6a5ebf91dc831e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5b67a3154e0e02212c6bd648ed6a5ebf91dc831e/orm.py |
raise AttributeError(_("Couldn't find tag '%s' in parent view !") % tag) | raise_view_error("Element '%s' not found in parent view '%%(parent_xml_id)s'" % tag, inherit_id) | def _find(node, node2): if node2.tag == 'xpath': res = node.xpath(node2.get('expr')) if res: return res[0] else: return None else: for n in node.getiterator(node2.tag): res = True if node2.tag == 'field': # only compare field names, a field can be only once in a given view # at a given level (and for multilevel expressions, we should use xpath # inheritance spec anyway) if node2.get('name') == n.get('name'): return n else: continue for attr in node2.attrib: if attr == 'position': continue if n.get(attr): if n.get(attr) == node2.get(attr): continue res = False if res: return n return None | 5b67a3154e0e02212c6bd648ed6a5ebf91dc831e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5b67a3154e0e02212c6bd648ed6a5ebf91dc831e/orm.py |
result = _inherit_apply(result, inherit) | result = _inherit_apply(result, inherit, id) | def _inherit_apply_rec(result, inherit_id): # get all views which inherit from (ie modify) this view cr.execute('select arch,id from ir_ui_view where inherit_id=%s and model=%s order by priority', (inherit_id, self._name)) sql_inherit = cr.fetchall() for (inherit, id) in sql_inherit: result = _inherit_apply(result, inherit) result = _inherit_apply_rec(result, id) return result | 5b67a3154e0e02212c6bd648ed6a5ebf91dc831e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5b67a3154e0e02212c6bd648ed6a5ebf91dc831e/orm.py |
openerp_site_packages = join('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server') | openerp_site_packages = join(get_python_lib(prefix=''), 'openerp-server') | def data_files(): '''Build list of data files to be installed''' files = [] if os.name == 'nt': for root, _, names in os.walk(join('bin','addons')): files.append((root, [join(root, name) for name in names])) for root, _, names in os.walk('doc'): files.append((root, [join(root, name) for name in names])) files.append(('.', [join('bin', 'import_xml.rng'), join('bin', 'server.pkey'), join('bin', 'server.cert')])) else: man_directory = join('share', 'man') files.append((join(man_directory, 'man1'), ['man/openerp-server.1'])) files.append((join(man_directory, 'man5'), ['man/openerp_serverrc.5'])) doc_directory = join('share', 'doc', 'openerp-server-%s' % version) files.append((doc_directory, filter(isfile, glob.glob('doc/*')))) files.append((join(doc_directory, 'migrate', '3.3.0-3.4.0'), filter(isfile, glob.glob('doc/migrate/3.3.0-3.4.0/*')))) files.append((join(doc_directory, 'migrate', '3.4.0-4.0.0'), filter(isfile, glob.glob('doc/migrate/3.4.0-4.0.0/*')))) openerp_site_packages = join('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server') files.append((openerp_site_packages, [join('bin', 'import_xml.rng'), join('bin', 'server.pkey'), join('bin', 'server.cert')])) if sys.version_info[0:2] == (2,5): files.append((openerp_site_packages, [ join('python25-compat','BaseHTTPServer.py'), join('python25-compat','SimpleXMLRPCServer.py'), join('python25-compat','SocketServer.py')])) for addonname, add_path in find_addons(): addon_path = join('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server','addons', addonname) for root, dirs, innerfiles in os.walk(add_path): innerfiles = filter(lambda fil: os.path.splitext(fil)[1] not in ('.pyc', '.pyd', '.pyo'), innerfiles) if innerfiles: res = os.path.normpath(join(addon_path, root.replace(join(add_path), '.'))) files.extend(((res, map(lambda fil: join(root, fil), innerfiles)),)) return files | 62c4eb806f9ddfd9e9bcb47c435213023d62f01a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/62c4eb806f9ddfd9e9bcb47c435213023d62f01a/setup.py |
addon_path = join('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server','addons', addonname) | addon_path = join(get_python_lib(prefix=''), 'openerp-server','addons', addonname) | def data_files(): '''Build list of data files to be installed''' files = [] if os.name == 'nt': for root, _, names in os.walk(join('bin','addons')): files.append((root, [join(root, name) for name in names])) for root, _, names in os.walk('doc'): files.append((root, [join(root, name) for name in names])) files.append(('.', [join('bin', 'import_xml.rng'), join('bin', 'server.pkey'), join('bin', 'server.cert')])) else: man_directory = join('share', 'man') files.append((join(man_directory, 'man1'), ['man/openerp-server.1'])) files.append((join(man_directory, 'man5'), ['man/openerp_serverrc.5'])) doc_directory = join('share', 'doc', 'openerp-server-%s' % version) files.append((doc_directory, filter(isfile, glob.glob('doc/*')))) files.append((join(doc_directory, 'migrate', '3.3.0-3.4.0'), filter(isfile, glob.glob('doc/migrate/3.3.0-3.4.0/*')))) files.append((join(doc_directory, 'migrate', '3.4.0-4.0.0'), filter(isfile, glob.glob('doc/migrate/3.4.0-4.0.0/*')))) openerp_site_packages = join('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server') files.append((openerp_site_packages, [join('bin', 'import_xml.rng'), join('bin', 'server.pkey'), join('bin', 'server.cert')])) if sys.version_info[0:2] == (2,5): files.append((openerp_site_packages, [ join('python25-compat','BaseHTTPServer.py'), join('python25-compat','SimpleXMLRPCServer.py'), join('python25-compat','SocketServer.py')])) for addonname, add_path in find_addons(): addon_path = join('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server','addons', addonname) for root, dirs, innerfiles in os.walk(add_path): innerfiles = filter(lambda fil: os.path.splitext(fil)[1] not in ('.pyc', '.pyd', '.pyo'), innerfiles) if innerfiles: res = os.path.normpath(join(addon_path, root.replace(join(add_path), '.'))) files.extend(((res, map(lambda fil: join(root, fil), innerfiles)),)) return files | 62c4eb806f9ddfd9e9bcb47c435213023d62f01a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/62c4eb806f9ddfd9e9bcb47c435213023d62f01a/setup.py |
res_id = False | def _process_email(self, cr, uid, server, message, context={}): history_pool = self.pool.get('mail.server.history') msg_txt = email.message_from_string(message) message_id = msg_txt.get('Message-ID', False) msg = {} if not message_id: return False fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = message_id if 'Subject' in fields: msg['subject'] = msg_txt.get('Subject') if 'Content-Type' in fields: msg['content-type'] = msg_txt.get('Content-Type') if 'From' in fields: msg['from'] = msg_txt.get('From') if 'Delivered-To' in fields: msg['to'] = msg_txt.get('Delivered-To') if 'Cc' in fields: msg['cc'] = msg_txt.get('Cc') if 'Reply-To' in fields: msg['reply'] = msg_txt.get('Reply-To') if 'Date' in fields: msg['date'] = msg_txt.get('Date') if 'Content-Transfer-Encoding' in fields: msg['encoding'] = msg_txt.get('Content-Transfer-Encoding') if 'References' in fields: msg['references'] = msg_txt.get('References') | b63dd0fd7aa5d8859a123c459bf30aed5091dab5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b63dd0fd7aa5d8859a123c459bf30aed5091dab5/fetchmail.py |
|
model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context) | if hasattr(model_pool, 'message_update'): model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context) else: logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name)) return False | def _process_email(self, cr, uid, server, message, context={}): history_pool = self.pool.get('mail.server.history') msg_txt = email.message_from_string(message) message_id = msg_txt.get('Message-ID', False) msg = {} if not message_id: return False fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = message_id if 'Subject' in fields: msg['subject'] = msg_txt.get('Subject') if 'Content-Type' in fields: msg['content-type'] = msg_txt.get('Content-Type') if 'From' in fields: msg['from'] = msg_txt.get('From') if 'Delivered-To' in fields: msg['to'] = msg_txt.get('Delivered-To') if 'Cc' in fields: msg['cc'] = msg_txt.get('Cc') if 'Reply-To' in fields: msg['reply'] = msg_txt.get('Reply-To') if 'Date' in fields: msg['date'] = msg_txt.get('Date') if 'Content-Transfer-Encoding' in fields: msg['encoding'] = msg_txt.get('Content-Transfer-Encoding') if 'References' in fields: msg['references'] = msg_txt.get('References') | b63dd0fd7aa5d8859a123c459bf30aed5091dab5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b63dd0fd7aa5d8859a123c459bf30aed5091dab5/fetchmail.py |
res_id = model_pool.message_new(cr, uid, msg, context) | if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_new is not define in model %s' % (model_pool._name)) return False | def _process_email(self, cr, uid, server, message, context={}): history_pool = self.pool.get('mail.server.history') msg_txt = email.message_from_string(message) message_id = msg_txt.get('Message-ID', False) msg = {} if not message_id: return False fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = message_id if 'Subject' in fields: msg['subject'] = msg_txt.get('Subject') if 'Content-Type' in fields: msg['content-type'] = msg_txt.get('Content-Type') if 'From' in fields: msg['from'] = msg_txt.get('From') if 'Delivered-To' in fields: msg['to'] = msg_txt.get('Delivered-To') if 'Cc' in fields: msg['cc'] = msg_txt.get('Cc') if 'Reply-To' in fields: msg['reply'] = msg_txt.get('Reply-To') if 'Date' in fields: msg['date'] = msg_txt.get('Date') if 'Content-Transfer-Encoding' in fields: msg['encoding'] = msg_txt.get('Content-Transfer-Encoding') if 'References' in fields: msg['references'] = msg_txt.get('References') | b63dd0fd7aa5d8859a123c459bf30aed5091dab5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b63dd0fd7aa5d8859a123c459bf30aed5091dab5/fetchmail.py |
self._process_email(cr, uid, server, data[0][1], context) imap_server.store(num, '+FLAGS', '\\Seen') count += 1 logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch %s email(s) from %s' % (count, server.name)) | if self._process_email(cr, uid, server, data[0][1], context): imap_server.store(num, '+FLAGS', '\\Seen') count += 1 logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch/process %s email(s) from %s' % (count, server.name)) | def fetch_mail(self, cr, uid, ids, context={}): fp = os.popen('ping www.google.com -c 1 -w 5',"r") if not fp.read(): logger.notifyChannel('imap', netsvc.LOG_WARNING, 'No address associated with hostname !') | b63dd0fd7aa5d8859a123c459bf30aed5091dab5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b63dd0fd7aa5d8859a123c459bf30aed5091dab5/fetchmail.py |
'period': fields.selection([('month','Monthly'), ('3months','3 Monthly')], 'Periods', required=True), 'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Your Bank and Cash Accounts',required=True), | 'period': fields.selection([('month','Monthly'), ('3months','3 Monthly')], 'Periods', required=True), 'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Your Bank and Cash Accounts'), | def _get_charts(self, cr, uid, context=None): modules = self.pool.get('ir.module.module') ids = modules.search(cr, uid, [('category_id','=','Account Charts')]) charts = list( sorted(((m.name, m.shortdesc) for m in modules.browse(cr, uid, ids)), key=itemgetter(1))) charts.insert(0,('configurable','Generic Chart Of Account')) return charts | 4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d/installer.py |
'date_start': time.strftime('%Y-01-01'), 'date_stop': time.strftime('%Y-12-31'), 'period': lambda *a: 'month', 'sale_tax': lambda *a: 0.0, 'purchase_tax': lambda *a: 0.0, | 'date_start': lambda *a: time.strftime('%Y-01-01'), 'date_stop': lambda *a: time.strftime('%Y-12-31'), 'period': 'month', 'sale_tax': 0.0, 'purchase_tax': 0.0, | def _get_default_charts(self, cr, uid, context=None): module_name = False company_id = self._default_company(cr, uid, context=context) company = self.pool.get('res.company').browse(cr, uid, company_id) address_id = self.pool.get('res.partner').address_get(cr, uid, [company.partner_id.id]) if address_id['default']: address = self.pool.get('res.partner.address').browse(cr, uid, address_id['default']) code = address.country_id.code module_name = (code and 'l10n_' + code.lower()) or False if module_name: module_id = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', module_name)]) if module_id: return module_name return 'configurable' | 4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d/installer.py |
'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True), | 'bank_account_id': fields.many2one('account.installer', 'Bank Account', required=True), | def modules_to_install(self, cr, uid, ids, context=None): modules = super(account_installer, self).modules_to_install( cr, uid, ids, context=context) chart = self.read(cr, uid, ids, ['charts'], context=context)[0]['charts'] self.logger.notifyChannel( 'installer', netsvc.LOG_DEBUG, 'Installing chart of accounts %s'%chart) return modules | set([chart]) | 4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d/installer.py |
def modules_to_install(self, cr, uid, ids, context=None): modules = super(account_installer, self).modules_to_install( cr, uid, ids, context=context) chart = self.read(cr, uid, ids, ['charts'], context=context)[0]['charts'] self.logger.notifyChannel( 'installer', netsvc.LOG_DEBUG, 'Installing chart of accounts %s'%chart) return modules | set([chart]) | 4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4e9fac63375f0cf2eb3df570fcbde6d1ecddff2d/installer.py |
||
s.create_date as date, to_char(s.date_from,'YYYY/mm/dd') as date_from, to_char(s.date_to,'YYYY/mm/dd') as date_to, | date_trunc('seconds',s.create_date) as date, date_trunc('day',s.date_from) as date_from, date_trunc('day',s.date_to) as date_to, | def init(self, cr): tools.drop_view_if_exists(cr, 'hr_holidays_report') cr.execute(""" create or replace view hr_holidays_report as ( select min(s.id) as id, s.create_date as date, to_char(s.date_from,'YYYY/mm/dd') as date_from, to_char(s.date_to,'YYYY/mm/dd') as date_to, s.number_of_days_temp, s.employee_id, s.user_id as user_id, to_char(s.create_date, 'YYYY') as year, to_char(s.create_date, 'MM') as month, s.state from hr_holidays s group by s.create_date,s.state,s.date_from,s.date_to, s.number_of_days_temp,s.employee_id,s.user_id ) """) | 8ea773c793398546341f31360cde91a5f23fecef /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8ea773c793398546341f31360cde91a5f23fecef/hr_holidays_report.py |
self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ' 'WHERE id IN %s', (tuple(ids),)) | if (data['model'] == 'account.journal.period'): self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ' 'WHERE id IN %s', (tuple(ids),)) else: self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ') | def set_context(self, objects, data, ids, report_type=None): super(journal_print, self).set_context(objects, data, ids, report_type) self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ' 'WHERE id IN %s', (tuple(ids),)) res = self.cr.fetchall() self.period_ids, self.journal_ids = zip(*res) | c0253ef988b8e9a8d25016c56c4c7974f2f337cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c0253ef988b8e9a8d25016c56c4c7974f2f337cc/general_journal.py |
def _compute_total(self, cr, uid, ids, name, args, context=None): position_pool = self.pool.get('account.fiscal.position') voucher_pool = self.pool.get('account.voucher') voucher_line_pool = self.pool.get('account.voucher.line') partner_pool = self.pool.get('res.partner') tax_pool = self.pool.get('account.tax') res = {} for voucher in self.browse(cr, uid, ids): total = 0.0 for line in voucher.payment_ids: total += line.amount res[voucher.id] = total + voucher.tax_amount return res | def _compute_total(self, cr, uid, ids, name, args, context=None): position_pool = self.pool.get('account.fiscal.position') voucher_pool = self.pool.get('account.voucher') voucher_line_pool = self.pool.get('account.voucher.line') partner_pool = self.pool.get('res.partner') tax_pool = self.pool.get('account.tax') res = {} for voucher in self.browse(cr, uid, ids): total = 0.0 for line in voucher.payment_ids: total += line.amount | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
|
def create(self, cr, uid, vals, context={}): """ Create a new record for a model account_voucher @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 @return: Returns an id of the new record """ | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
||
def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') res = [] context.update({ 'type':ttype, 'partner_id':partner_id, 'voucher':True, }) if journal_id: context.update({ 'journal_id':journal_id, }) 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 | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
||
ids = move_line_pool.search(cr, uid, [('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) | search_type = 'credit' account_type = False if ttype == 'receipt': search_type = 'debit' account_type = 'receivable' elif ttype == 'payment': search_type = 'credit' account_type = 'payable' ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) total = 0.0 | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') res = [] context.update({ 'type':ttype, 'partner_id':partner_id, 'voucher':True, }) if journal_id: context.update({ 'journal_id':journal_id, }) 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 | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
'type':'dr', | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') res = [] context.update({ 'type':ttype, 'partner_id':partner_id, 'voucher':True, }) if journal_id: context.update({ 'journal_id':journal_id, }) 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 | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
|
'type':'cr', | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') res = [] context.update({ 'type':ttype, 'partner_id':partner_id, 'voucher':True, }) if journal_id: context.update({ 'journal_id':journal_id, }) 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 | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
|
res = {'payment_ids':res, 'account_id':account_id} | res = { 'payment_ids':res, 'account_id':account_id, 'amount':total } | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') res = [] context.update({ 'type':ttype, 'partner_id':partner_id, 'voucher':True, }) if journal_id: context.update({ 'journal_id':journal_id, }) 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 | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
if inv.type == 'sale': | if inv.type in ('sale', 'receipt'): | def action_move_line_create(self, cr, uid, ids, *args): journal_pool = self.pool.get('account.journal') sequence_pool = self.pool.get('ir.sequence') move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') analytic_pool = self.pool.get('account.analytic.line') currency_pool = self.pool.get('res.currency') invoice_pool = self.pool.get('account.invoice') for inv in self.browse(cr, uid, ids): if inv.move_id: continue | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.