rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if res_obj and len(res_obj): res_obj = res_obj[0] | def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}): company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name for att in self.browse(cr, uid, ids, context=context): sign = att.sent_by_uid and att.sent_by_uid.signature or '' sign = '<br>'.join(sign and sign.split('\n') or []) res_obj = att.ref if res_obj and len(res_obj): res_obj = res_obj[0] sub = '[%s Invitation][%d] %s' % (company, att.id, res_obj.name) att_infos = [] other_invitaion_ids = self.search(cr, uid, [('ref','=',att.ref)]) for att2 in self.browse(cr, uid, other_invitaion_ids): att_infos.append(((att2.user_id and att2.user_id.name) or \ (att2.partner_id and att2.partner_id.name) or \ att2.email) + ' - Status: ' + att2.state.title()) body_vals = {'name': res_obj.name, 'start_date': res_obj.date, 'end_date': res_obj.date_deadline or False, 'description': res_obj.description or '-', 'location': res_obj.location or '-', 'attendees': '<br>'.join(att_infos), 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', 'sign': sign, 'company': company } body = html_invitation % body_vals if mail_to and email_from: tools.email_send( email_from, mail_to, sub, body, subtype='html', reply_to=email_from ) return True | 0cac3f59979db983cf71b8f3ad0544f8d2c024d4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0cac3f59979db983cf71b8f3ad0544f8d2c024d4/base_calendar.py |
|
other_invitaion_ids = self.search(cr, uid, [('ref','=',att.ref)]) | other_invitaion_ids = self.search(cr, uid, [('ref','=', att.ref._name + ',' + str(att.ref.id))]) | def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}): company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name for att in self.browse(cr, uid, ids, context=context): sign = att.sent_by_uid and att.sent_by_uid.signature or '' sign = '<br>'.join(sign and sign.split('\n') or []) res_obj = att.ref if res_obj and len(res_obj): res_obj = res_obj[0] sub = '[%s Invitation][%d] %s' % (company, att.id, res_obj.name) att_infos = [] other_invitaion_ids = self.search(cr, uid, [('ref','=',att.ref)]) for att2 in self.browse(cr, uid, other_invitaion_ids): att_infos.append(((att2.user_id and att2.user_id.name) or \ (att2.partner_id and att2.partner_id.name) or \ att2.email) + ' - Status: ' + att2.state.title()) body_vals = {'name': res_obj.name, 'start_date': res_obj.date, 'end_date': res_obj.date_deadline or False, 'description': res_obj.description or '-', 'location': res_obj.location or '-', 'attendees': '<br>'.join(att_infos), 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', 'sign': sign, 'company': company } body = html_invitation % body_vals if mail_to and email_from: tools.email_send( email_from, mail_to, sub, body, subtype='html', reply_to=email_from ) return True | 0cac3f59979db983cf71b8f3ad0544f8d2c024d4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0cac3f59979db983cf71b8f3ad0544f8d2c024d4/base_calendar.py |
if domain is not None: | if vids: | def _get_by_id(self, obj, cr, uid, prop_name, ids, context=None): prop = obj.pool.get('ir.property') vids = [obj._name + ',' + str(oid) for oid in ids] | 50985408b62a1505e09e698c72937e1f5431aad9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50985408b62a1505e09e698c72937e1f5431aad9/fields.py |
return prop.search(cr, uid, domain, context=context) else: return [] | return prop.search(cr, uid, domain, context=context) | def _get_by_id(self, obj, cr, uid, prop_name, ids, context=None): prop = obj.pool.get('ir.property') vids = [obj._name + ',' + str(oid) for oid in ids] | 50985408b62a1505e09e698c72937e1f5431aad9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50985408b62a1505e09e698c72937e1f5431aad9/fields.py |
self._logger.info("Exported service registered: %s" % name) | self._logger.debug("Registered an exported service: %s" % name) | def __init__(self, name, audience=''): ExportService._services[name] = self self.__name = name self._logger.info("Exported service registered: %s" % name) | e69414c7ec6d172603068a3f1f5744475bafb84d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e69414c7ec6d172603068a3f1f5744475bafb84d/netsvc.py |
rec_line_data = property_obj.read(cr,uid,rec_pro_id,['name','value','res_id']) pay_line_data = property_obj.read(cr,uid,pay_pro_id,['name','value','res_id']) rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False | rec_line_data = property_obj.read(cr,uid,rec_pro_id,['name','value_reference','res_id']) pay_line_data = property_obj.read(cr,uid,pay_pro_id,['name','value_reference','res_id']) rec_res_id = rec_line_data and rec_line_data[0].get('value_reference',False) and int(rec_line_data[0]['value_reference'].split(',')[1]) or False pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False | def onchange_partner_id(self, cr, uid, ids, type, partner_id,\ date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): invoice_addr_id = False contact_addr_id = False partner_payment_term = False acc_id = False bank_id = False fiscal_position = False | 476c000425262c0640ebac9e4fc0faacdf420183 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/476c000425262c0640ebac9e4fc0faacdf420183/invoice.py |
rec_line_data = property_obj.read(cr, uid, rec_pro_id, ['name','value','res_id']) pay_line_data = property_obj.read(cr, uid, pay_pro_id, ['name','value','res_id']) rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False | rec_line_data = property_obj.read(cr, uid, rec_pro_id, ['name','value_reference','res_id']) pay_line_data = property_obj.read(cr, uid, pay_pro_id, ['name','value_reference','res_id']) rec_res_id = rec_line_data and rec_line_data[0].get('value_reference',False) and int(rec_line_data[0]['value_reference'].split(',')[1]) or False pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False | def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val = {} dom = {} obj_journal = self.pool.get('account.journal') if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable and partner_obj.property_account_receivable: if partner_obj.property_account_payable.company_id.id != company_id and partner_obj.property_account_receivable.company_id.id != company_id: property_obj = self.pool.get('ir.property') rec_pro_id = property_obj.search(cr, uid, [('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) pay_pro_id = property_obj.search(cr, uid, [('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) if not rec_pro_id: rec_pro_id = property_obj.search(cr, uid, [('name','=','property_account_receivable'),('company_id','=',company_id)]) if not pay_pro_id: pay_pro_id = property_obj.search(cr, uid, [('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = property_obj.read(cr, uid, rec_pro_id, ['name','value','res_id']) pay_line_data = property_obj.read(cr, uid, pay_pro_id, ['name','value','res_id']) rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False if not rec_res_id and not pay_res_id: raise osv.except_osv(_('Configuration Error !'), _('Can not find account chart for this company, Please Create account.')) if type in ('out_invoice', 'out_refund'): acc_id = rec_res_id else: acc_id = pay_res_id val= {'account_id': acc_id} account_obj = self.pool.get('account.account') if ids: if company_id: inv_obj = self.browse(cr,uid,ids) for line in inv_obj[0].invoice_line: if line.account_id: if line.account_id.company_id.id != company_id: result_id = account_obj.search(cr, uid, [('name','=',line.account_id.name),('company_id','=',company_id)]) if not result_id: raise osv.except_osv(_('Configuration Error !'), _('Can not find account chart for this company in invoice line account, Please Create account.')) r_id = self.pool.get('account.invoice.line').write(cr, uid, [line.id], {'account_id': result_id[0]}) else: if invoice_line: for inv_line in invoice_line: obj_l = account_obj.browse(cr, uid, inv_line[2]['account_id']) if obj_l.company_id.id != company_id: raise osv.except_osv(_('Configuration Error !'), _('Invoice line account company does not match with invoice company.')) else: continue if company_id and type: if type in ('out_invoice'): journal_type = 'sale' elif type in ('out_refund'): journal_type = 'sale_refund' elif type in ('in_refund'): journal_type = 'purchase_refund' else: journal_type = 'purchase' journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)]) if journal_ids: val['journal_id'] = journal_ids[0] else: raise osv.except_osv(_('Configuration Error !'), _('Can\'t find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Financial Accounting\Accounts\Journals.' % (journal_type))) dom = {'journal_id': [('id', 'in', journal_ids)]} else: journal_ids = obj_journal.search(cr, uid, []) | 476c000425262c0640ebac9e4fc0faacdf420183 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/476c000425262c0640ebac9e4fc0faacdf420183/invoice.py |
app_acc_in = account_obj.browse(cr, uid, in_pro_id)[0] | my_value = property_obj.read(cr,uid,in_pro_id,['name','value_reference','res_id']) account_id = int (my_value[0]["value_reference"].split(",")[1]) app_acc_in = account_obj.browse(cr, uid, [account_id])[0] | 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 | 476c000425262c0640ebac9e4fc0faacdf420183 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/476c000425262c0640ebac9e4fc0faacdf420183/invoice.py |
t = payment.mode and payment.mode.type.id or None | t = None | def create_payment(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line') payment_obj = self.pool.get('payment.line') if context is None: context = {} data = self.read(cr, uid, ids, [])[0] line_ids = data['entries'] if not line_ids: return {} | 05b5623cd9dcfa532f2f17d5021aca5dfd329805 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/05b5623cd9dcfa532f2f17d5021aca5dfd329805/account_payment_order.py |
'depends': [dep.name for dep in module.dependencies_id], | 'depends': [dep.name for dep in module.dependencies_id if self.search(cr, uid, [ ('name', '=', dep.name), ('web', '=', True) ], context=context)], | def get_web(self, cr, uid, names, context=False): """ get_web(cr, uid, [module_name], context) -> [{name, depends, content}] | 5577f2bc4ac052738be132d9368a6c22a27baf5a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5577f2bc4ac052738be132d9368a6c22a27baf5a/module.py |
company_data = self.pool.get('base.setup.company').read(cr, uid, company_id)[0] | company_data = self.pool.get('base.setup.company').read(cr, uid, company_id) company_data = company_data and company_data[0] | def execute(self, cr, uid, ids, context=None): company_id = self.pool.get('base.setup.company').search(cr, uid, []) company_data = self.pool.get('base.setup.company').read(cr, uid, company_id)[0] country1 = '' if company_data.get('country_id', False): country = self.pool.get('res.country').read(cr, uid, company_data['country_id'],['name'])['name'] for res in self.read(cr, uid, ids): email = res.get('email','') result = "\ncompany: "+ str(company_data.get('name','')) result += "\nname: " + str(res.get('name','')) result += "\nphone: " + str(res.get('phone','')) result += "\ncity: " + str(company_data.get('city','')) result += "\ncountry: " + str(country) result += "\nindustry: " + str(res.get('industry', '')) result += "\ntotal_employees: " + str(res.get('total_employees', '')) result += "\nplan_use: " + str(res.get('use_openerp', False)) result += "\nsell_openerp: " + str(res.get('sell_openerp', False)) result += "\nebook: " + str(res.get('ebook',False)) result += "\ngtk: " + str(True) misc.upload_data(email, result, type='SURVEY') | c3a9e1c4ddf5a96e2a6fe3e80481d924cda68a4d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c3a9e1c4ddf5a96e2a6fe3e80481d924cda68a4d/gtk_contact_form.py |
self.assert_report.record(False, severity) self.logger.log(severity, msg, *args) if severity >= config['assert_exit_level']: raise YamlImportAbortion('Severe assertion failure (%s), aborting.' % logging.getLevelName(severity)) | if isinstance(severity, types.StringTypes): levelname = severity.strip().upper() level = logging.getLevelName(levelname) else: level = severity levelname = logging.getLevelName(level) self.assert_report.record(False, levelname) self.logger.log(level, msg, *args) if level >= config['assert_exit_level']: raise YamlImportAbortion('Severe assertion failure (%s), aborting.' % levelname) | def _log_assert_failure(self, severity, msg, *args): self.assert_report.record(False, severity) self.logger.log(severity, msg, *args) if severity >= config['assert_exit_level']: raise YamlImportAbortion('Severe assertion failure (%s), aborting.' % logging.getLevelName(severity)) return | 41fc8c369af3cb3562b6ce44e333befda15837c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/41fc8c369af3cb3562b6ce44e333befda15837c8/yaml_import.py |
wiz_id = execute(conn,'create',dbname, uid, pwd, 'module.lang.import') | wiz_id = execute(conn,'create',dbname, uid, pwd, 'base.language.import') | def import_translate(uri, user, pwd, dbname, translate_in): uid = login(uri, dbname, user, pwd) if uid: conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/wizard') wiz_id = execute(conn,'create',dbname, uid, pwd, 'module.lang.import') for trans_in in translate_in: lang,ext = os.path.splitext(trans_in.split('/')[-1]) state = 'init' datas = {'form':{}} while state!='end': res = execute(conn,'execute',dbname, uid, pwd, wiz_id, datas, state, {}) if 'datas' in res: datas['form'].update( res['datas'].get('form',{}) ) if res['type']=='form': for field in res['fields'].keys(): datas['form'][field] = res['fields'][field].get('value', False) state = res['state'][-1][0] trans_obj = open(trans_in) datas['form'].update({ 'name': lang, 'code': lang, 'data' : base64.encodestring(trans_obj.read()) }) trans_obj.close() elif res['type']=='action': state = res['state'] | acfeaf908f0878500cfecf498c987f60e3aa1933 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/acfeaf908f0878500cfecf498c987f60e3aa1933/base_quality_interrogation.py |
'user_type' : 'existing' | 'user_type' : 'existing', 'domain': '[]', 'access_mode': 'readonly' | def generate_random_pass(): pass_chars = RANDOM_PASS_CHARACTERS[:] random.shuffle(pass_chars) return ''.join(pass_chars[0:10]) | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
'new_user': this.new_user | 'new_user': this.new_user, 'domain': this.domain, 'access_mode': this.access_mode, 'action_id': this.action_id and this.action_id.id or False | def do_step_2(self, cr, uid, ids, context=None): """ This action to excute step 2 """ if not context: context = {} | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
share_group_name = '%s:[%d]%s' %(_('Sharing'), active_id, active_model) group_id = group_obj.create(cr, uid, {'name': share_group_name, 'share_group': True}) | share_group_name = '%s: %s: %d' %('Sharing', active_model, active_id) group_ids = group_obj.search(cr, uid, [('name','=',share_group_name)]) group_id = group_ids and group_ids[0] or False if not group_id: group_id = group_obj.create(cr, uid, {'name': share_group_name, 'share_group': True}) else: group = group_obj.browse(cr, uid, group_id, context=context) if not group.share_group: raise osv.except_osv(_('Error'), _("Share Group is exits without sharing !")) | def do_step_3(self, cr, uid, ids, context=None): """ This action to excute step 3 """ if not context: context = {} group_obj = self.pool.get('res.groups') user_obj = self.pool.get('res.users') fields_obj = self.pool.get('ir.model.fields') model_access_obj = self.pool.get('ir.model.access') model_obj = self.pool.get('ir.model') rule_obj = self.pool.get('ir.rule') | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
'password': _generate_random_number(), | 'password': password, | def do_step_3(self, cr, uid, ids, context=None): """ This action to excute step 3 """ if not context: context = {} group_obj = self.pool.get('res.groups') user_obj = self.pool.get('res.users') fields_obj = self.pool.get('ir.model.fields') model_access_obj = self.pool.get('ir.model.access') model_obj = self.pool.get('ir.model') rule_obj = self.pool.get('ir.rule') | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
user_ids.append(user_id) | user_ids.append(user_id) | def do_step_3(self, cr, uid, ids, context=None): """ This action to excute step 3 """ if not context: context = {} group_obj = self.pool.get('res.groups') user_obj = self.pool.get('res.users') fields_obj = self.pool.get('ir.model.fields') model_access_obj = self.pool.get('ir.model.access') model_obj = self.pool.get('ir.model') rule_obj = self.pool.get('ir.rule') | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
obj0 = model_obj.browse(cr, uid, active_model_id, context=context) def _get_relation(model, ttypes): obj = [] field_ids = fields_obj.search(cr, uid, [('model','=',model),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): for ttype in ttypes: if ttype in ('one2many', 'many2many'): obj += _get_relation(field.relation, [ttype]) if field.model_id.model != active_model and field.model_id.id not in obj: obj.append((field.relation_field, field.model_id)) | def _get_relation(model_id, ttypes, new_obj=[]): obj = [] models = map(lambda x:x[1].model, new_obj) field_ids = fields_obj.search(cr, uid, [('model_id','=',model_id),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): if field.relation not in models: relation_model_ids = model_obj.search(cr, uid, [('model','=',field.relation)]) relation_model_id = relation_model_ids and relation_model_ids[0] or False relation_model = model_obj.browse(cr, uid, relation_model_id, context=context) obj.append((field.relation_field, relation_model)) if relation_model_id != model_id and field.ttype in ['one2many', 'many2many']: obj += _get_relation(relation_model_id, [field.ttype], obj) | def do_step_3(self, cr, uid, ids, context=None): """ This action to excute step 3 """ if not context: context = {} group_obj = self.pool.get('res.groups') user_obj = self.pool.get('res.users') fields_obj = self.pool.get('ir.model.fields') model_access_obj = self.pool.get('ir.model.access') model_obj = self.pool.get('ir.model') rule_obj = self.pool.get('ir.rule') | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
obj1 = _get_relation(active_model, ['one2many']) obj2 = _get_relation(active_model, ['one2many', 'many2many']) obj3 = _get_relation(active_model, ['many2one']) | obj0 = model_obj.browse(cr, uid, active_model_id, context=context) obj1 = _get_relation(active_model_id, ['one2many']) obj2 = _get_relation(active_model_id, ['one2many', 'many2many']) obj3 = _get_relation(active_model_id, ['many2one']) | def _get_relation(model, ttypes): obj = [] field_ids = fields_obj.search(cr, uid, [('model','=',model),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): for ttype in ttypes: if ttype in ('one2many', 'many2many'): obj += _get_relation(field.relation, [ttype]) if field.model_id.model != active_model and field.model_id.id not in obj: obj.append((field.relation_field, field.model_id)) return obj | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
obj3 += _get_relation(model.model, ['many2one']) | obj3 += _get_relation(model.id, ['many2one']) | def _get_relation(model, ttypes): obj = [] field_ids = fields_obj.search(cr, uid, [('model','=',model),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): for ttype in ttypes: if ttype in ('one2many', 'many2many'): obj += _get_relation(field.relation, [ttype]) if field.model_id.model != active_model and field.model_id.id not in obj: obj.append((field.relation_field, field.model_id)) return obj | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
'name': '%s-%s'%(group_name, obj0.model), | 'name': '%s-%s'%(share_group_name, obj0.model), | def _get_relation(model, ttypes): obj = [] field_ids = fields_obj.search(cr, uid, [('model','=',model),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): for ttype in ttypes: if ttype in ('one2many', 'many2many'): obj += _get_relation(field.relation, [ttype]) if field.model_id.model != active_model and field.model_id.id not in obj: obj.append((field.relation_field, field.model_id)) return obj | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
'name': '%s-%s'%(group_name, model.model), | 'name': '%s-%s'%(share_group_name, model.model), | def _get_relation(model, ttypes): obj = [] field_ids = fields_obj.search(cr, uid, [('model','=',model),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): for ttype in ttypes: if ttype in ('one2many', 'many2many'): obj += _get_relation(field.relation, [ttype]) if field.model_id.model != active_model and field.model_id.id not in obj: obj.append((field.relation_field, field.model_id)) return obj | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
'group_ids': [(6,0,[group_id])] | 'groups': [(6,0,[group_id])] | def _get_relation(model, ttypes): obj = [] field_ids = fields_obj.search(cr, uid, [('model','=',model),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): for ttype in ttypes: if ttype in ('one2many', 'many2many'): obj += _get_relation(field.relation, [ttype]) if field.model_id.model != active_model and field.model_id.id not in obj: obj.append((field.relation_field, field.model_id)) return obj | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
context['share_model'] = active_model context['share_rec_id'] = active_id | def _get_relation(model, ttypes): obj = [] field_ids = fields_obj.search(cr, uid, [('model','=',model),('ttype','in', ttypes)]) for field in fields_obj.browse(cr, uid, field_ids, context=context): for ttype in ttypes: if ttype in ('one2many', 'many2many'): obj += _get_relation(field.relation, [ttype]) if field.model_id.model != active_model and field.model_id.id not in obj: obj.append((field.relation_field, field.model_id)) return obj | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
|
new_user_ids = context.get('new_user_ids', []) | new_user_ids = context.get('new_user_ids', []) share_model = context.get('share_model', False) share_rec_id = context.get('share_rec_id', False) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(share_result, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) user_obj = self.pool.get('res.users') data_obj = self.pool.get('ir.model.data') existing_user_ids = context.get('existing_user_ids', []) new_user_ids = context.get('new_user_ids', []) _arch_lst = """<form string="Share Users"> <separator colspan="4" string="Step 4: Share User Details"/> """ _fields = result['fields'] send_email_act = data_obj._get_id(cr, uid, 'base', 'share_email_act') send_email_act_id = data_obj.browse(cr, uid, send_email_act, context=context).res_id | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
_fields = result['fields'] send_email_act = data_obj._get_id(cr, uid, 'base', 'share_email_act') send_email_act_id = data_obj.browse(cr, uid, send_email_act, context=context).res_id | _fields = result['fields'] | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(share_result, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) user_obj = self.pool.get('res.users') data_obj = self.pool.get('ir.model.data') existing_user_ids = context.get('existing_user_ids', []) new_user_ids = context.get('new_user_ids', []) _arch_lst = """<form string="Share Users"> <separator colspan="4" string="Step 4: Share User Details"/> """ _fields = result['fields'] send_email_act = data_obj._get_id(cr, uid, 'base', 'share_email_act') send_email_act_id = data_obj.browse(cr, uid, send_email_act, context=context).res_id | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
<group colspan="4" col="10"> | <group colspan="4" col="7"> | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(share_result, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) user_obj = self.pool.get('res.users') data_obj = self.pool.get('ir.model.data') existing_user_ids = context.get('existing_user_ids', []) new_user_ids = context.get('new_user_ids', []) _arch_lst = """<form string="Share Users"> <separator colspan="4" string="Step 4: Share User Details"/> """ _fields = result['fields'] send_email_act = data_obj._get_id(cr, uid, 'base', 'share_email_act') send_email_act_id = data_obj.browse(cr, uid, send_email_act, context=context).res_id | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
<button name="%s" string="send_email" type="action" icon="gtk-apply" context="{'user_id':%s, 'user_type':'new', 'share_url': user%s_url}"/> """%(user.id, user.id, user.id, send_email_act_id, user.id, user.id) | <button name="do_send_email" string="Send Email" type="object" icon="gtk-apply" context="{'user_id':%s, 'user_type':'new', 'share_url': user%s_url}"/> """%(user.id, user.id, user.id, user.id, user.id) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(share_result, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) user_obj = self.pool.get('res.users') data_obj = self.pool.get('ir.model.data') existing_user_ids = context.get('existing_user_ids', []) new_user_ids = context.get('new_user_ids', []) _arch_lst = """<form string="Share Users"> <separator colspan="4" string="Step 4: Share User Details"/> """ _fields = result['fields'] send_email_act = data_obj._get_id(cr, uid, 'base', 'share_email_act') send_email_act_id = data_obj.browse(cr, uid, send_email_act, context=context).res_id | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
<group colspan="4" col="10"> | <group colspan="4" col="5"> | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(share_result, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) user_obj = self.pool.get('res.users') data_obj = self.pool.get('ir.model.data') existing_user_ids = context.get('existing_user_ids', []) new_user_ids = context.get('new_user_ids', []) _arch_lst = """<form string="Share Users"> <separator colspan="4" string="Step 4: Share User Details"/> """ _fields = result['fields'] send_email_act = data_obj._get_id(cr, uid, 'base', 'share_email_act') send_email_act_id = data_obj.browse(cr, uid, send_email_act, context=context).res_id | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
<button name="%s" string="send_email" type="action" icon="gtk-apply" context="{'user_id':%s, 'user_type':'existing', 'share_url': user%s_url}"/> """%(user.id, user.id, user.id, send_email_act_id, user.id, user.id) | <button name="do_send_email" string="Send Email" type="object" icon="gtk-apply" context="{'user_id':%s, 'user_type':'existing', 'share_url': user%s_url, 'share_model': %s, 'share_rec_id': %s }"/> """%(user.id, user.id, user.id, user.id, share_model, share_rec_id) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(share_result, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) user_obj = self.pool.get('res.users') data_obj = self.pool.get('ir.model.data') existing_user_ids = context.get('existing_user_ids', []) new_user_ids = context.get('new_user_ids', []) _arch_lst = """<form string="Share Users"> <separator colspan="4" string="Step 4: Share User Details"/> """ _fields = result['fields'] send_email_act = data_obj._get_id(cr, uid, 'base', 'share_email_act') send_email_act_id = data_obj.browse(cr, uid, send_email_act, context=context).res_id | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
res['user%s_url'%(user.id)] = tools.config('share_root_url', False) | res['user%s_url'%(user.id)] = tools.config.get('share_root_url', False) | def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @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. """ | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
res['user%s_url'%(user.id)] = tools.config('share_root_url', False) | res['user%s_url'%(user.id)] = tools.config.get('share_root_url', False) | def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @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. """ | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
class share_email(osv.osv_memory): _name = 'share.email' _description = 'share email' _columns = { 'email_to': fields.char('To', size=64, readonly=True), 'subject': fields.char('Subject', size=64, required=True), 'body': fields.text('Body', required=True), } def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @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. """ res = super(share_email, self).default_get(cr, uid, fields, context=context) user_obj = self.pool.get('res.users') if not context: context={} user_id = context.get('user_id', False) user_type = context.get('user_type', False) share_url = context.get('share_url', False) user = user_obj.browse(cr, uid, user_id) if 'email_to' in fields: res['email_to'] = user.user_email if 'subject' in fields: res['subject'] = '%s wants to share private data with you' %(user.name) if 'body' in fields: res['body'] = """ Dear, %s wants to share private data from OpenERP with you! To view it, you can access the following URL: %s """%(user.name, share_url) if user_type == 'new': res['body'] += """ You may use the following login and password to get access to this protected area: login: %s password: %s """%(user.login, user.password) elif user_type == 'existing': res['body'] += """ You may use your existing login and password to get access to this additional data. As a reminder, your login is %s. """%(user.name) return res def do_send_email(cr, uid, ids, context=None): user = user_obj.browse(cr, uid, uid) for this in self.browse(cr, uid, ids, context=context): flag = tools.email_send( user.user_email, this.email_to, this.subject, this.body ) share_email() | def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @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. """ | ed4f2f3f1ea49ce5193367036970bb0e0c3381f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed4f2f3f1ea49ce5193367036970bb0e0c3381f5/wizard_share.py |
|
'reference': fields.char('Ref | 'reference': fields.char('Ref | def _get_partner(self, cr, uid, context={}): return context.get('partner_id', False) | 31bfb558931550b124d26a5d94eaebdb6c55daed /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/31bfb558931550b124d26a5d94eaebdb6c55daed/voucher.py |
'context' : context | 'context' : context, 'nodestroy':True, | def action_print_survey(self, cr, uid, ids, context=None): """ If response is available then print this response otherwise print survey form(print template of the survey). @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 Survey IDs @param context: A standard dictionary for contextual values @return : Dictionary value for print survey form. """ if not context: context = {} datas = {} if 'response_id' in context: response_id = context.get('response_id', 0) datas['ids'] = [context.get('survey_id', 0)] else: response_id = self.pool.get('survey.response').search(cr, uid, [('survey_id','=', ids)], context=context) datas['ids'] = ids page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1} report = {} if response_id and response_id[0]: context.update({'survey_id': datas['ids']}) datas['form'] = page_setting datas['model'] = 'survey.print.answer' report = { 'type': 'ir.actions.report.xml', 'report_name': 'survey.browse.response', 'datas': datas, 'context' : context } else: | 9efa15363196a60d2b14e53fa7edc931a815d6d0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9efa15363196a60d2b14e53fa7edc931a815d6d0/survey.py |
'context' : context | 'context' : context, 'nodestroy':True, | def action_print_survey(self, cr, uid, ids, context=None): """ If response is available then print this response otherwise print survey form(print template of the survey). @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 Survey IDs @param context: A standard dictionary for contextual values @return : Dictionary value for print survey form. """ if not context: context = {} datas = {} if 'response_id' in context: response_id = context.get('response_id', 0) datas['ids'] = [context.get('survey_id', 0)] else: response_id = self.pool.get('survey.response').search(cr, uid, [('survey_id','=', ids)], context=context) datas['ids'] = ids page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1} report = {} if response_id and response_id[0]: context.update({'survey_id': datas['ids']}) datas['form'] = page_setting datas['model'] = 'survey.print.answer' report = { 'type': 'ir.actions.report.xml', 'report_name': 'survey.browse.response', 'datas': datas, 'context' : context } else: | 9efa15363196a60d2b14e53fa7edc931a815d6d0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9efa15363196a60d2b14e53fa7edc931a815d6d0/survey.py |
dt=DateTime.strptime(order.date_order, '%Y-%m-%d') + DateTime.RelativeDateTime(days=line.delay or 0.0) | dt = datetime.strptime(order.date_order, '%Y-%m-%d') + relativedelta(days=line.delay or 0.0) | def _get_commitment_date(self, cr, uid, ids, name, arg, context={}): res = {} dates_list = [] for order in self.browse(cr, uid, ids): dates_list = [] for line in order.order_line: dt=DateTime.strptime(order.date_order, '%Y-%m-%d') + DateTime.RelativeDateTime(days=line.delay or 0.0) dt_s = dt.strftime('%Y-%m-%d') dates_list.append(dt_s) if dates_list: res[order.id] = min(dates_list) return res | 248682874623c36a5b83302d6c13f363ecafaa77 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/248682874623c36a5b83302d6c13f363ecafaa77/sale_order_dates.py |
gw= obj_payment_order.get_wizard(t) | gw = obj_payment_order.get_wizard(t) | def launch_wizard(self, cr, uid, ids, context=None): """ Search for a wizard to launch according to the type. If type is manual. just confirm the order. """ obj_payment_order = self.pool.get('payment.order') obj_model = self.pool.get('ir.model.data') obj_act = self.pool.get('ir.actions.act_window') order= obj_payment_order.browse(cr, uid, context['active_id'], context) t = order.mode and order.mode.type.code or 'manual' if t == 'manual' : obj_payment_order.set_done(cr,uid,context['active_id'],context) return {} | 7a830f90045fe231d8b77a88d7d1d93e64cf9bbb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7a830f90045fe231d8b77a88d7d1d93e64cf9bbb/account_payment_pay.py |
result = mod_obj._get_id(cr, uid, module, wizard) id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] return act_obj.read(cr, uid, [id])[0] | result = obj_model._get_id(cr, uid, module, wizard) id = obj_model.read(cr, uid, [result], ['res_id'])[0]['res_id'] return obj_act.read(cr, uid, [id])[0] | def launch_wizard(self, cr, uid, ids, context=None): """ Search for a wizard to launch according to the type. If type is manual. just confirm the order. """ obj_payment_order = self.pool.get('payment.order') obj_model = self.pool.get('ir.model.data') obj_act = self.pool.get('ir.actions.act_window') order= obj_payment_order.browse(cr, uid, context['active_id'], context) t = order.mode and order.mode.type.code or 'manual' if t == 'manual' : obj_payment_order.set_done(cr,uid,context['active_id'],context) return {} | 7a830f90045fe231d8b77a88d7d1d93e64cf9bbb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7a830f90045fe231d8b77a88d7d1d93e64cf9bbb/account_payment_pay.py |
message = _('Voucher ') + " '" + inv.name + "' "+ _("is confirm") | message = _('Voucher ') + " '" + inv.name + "' "+ _("is confirmed") | def action_move_line_create(self, cr, uid, ids, *args): | 63e7e054f1d6dee20ca8b78eb071996c85ae373f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/63e7e054f1d6dee20ca8b78eb071996c85ae373f/voucher.py |
context.update({'uom': uom}) | context.update(uom=uom, compute_child=False) | def fill_inventory(self, cr, uid, ids, context): """ To fill stock inventory according to products available in the selected locations. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') for fill_inventory in self.browse(cr, uid, ids): res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res | ee198c29abe9a56dd9876afe53ca52b2a0e1a063 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ee198c29abe9a56dd9876afe53ca52b2a0e1a063/stock_fill_inventory.py |
if result['product_uom_id'] and (not result['product_uom_id'] == default_uom): | if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom): | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') project_obj = self.pool.get('project.project') uom_obj = self.pool.get('product.uom') if isinstance(ids, (long, int)): ids = [ids,] | 31b73b77e3de5527f8ffe841c2e1b8a4945b8349 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/31b73b77e3de5527f8ffe841c2e1b8a4945b8349/project_timesheet.py |
result['product_uom_qty'] = qty | result['product_uom_qty'] = pack.qty | def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): if not partner_id: raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sale form !\nPlease set one customer before choosing a product.')) warning = {} product_uom_obj = self.pool.get('product.uom') partner_obj = self.pool.get('res.partner') product_obj = self.pool.get('product.product') if partner_id: lang = partner_obj.browse(cr, uid, partner_id).lang context = {'lang': lang, 'partner_id': partner_id} | a5fe9dbd977d76b0fe58cba2d9ce0a77d52e3b34 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a5fe9dbd977d76b0fe58cba2d9ce0a77d52e3b34/sale.py |
self.abortResponse(1, _('Constraint Error'), 'warning', _(self._sql_error[key])) | self.abortResponse(1, _('Constraint Error'), 'warning', tr(self._sql_error[key], 'sql_constraint')) | def wrapper(self, dbname, *args, **kwargs): try: if not pooler.get_pool(dbname)._ready: raise except_osv('Database not ready', 'Currently, this database is not fully loaded and can not be used.') return f(self, dbname, *args, **kwargs) except orm.except_orm, inst: if inst.name == 'AccessError': self.logger.debug("AccessError", exc_info=True) self.abortResponse(1, inst.name, 'warning', inst.value) except except_osv, inst: self.abortResponse(1, inst.name, inst.exc_type, inst.value) except IntegrityError, inst: for key in self._sql_error.keys(): if key in inst[0]: self.abortResponse(1, _('Constraint Error'), 'warning', _(self._sql_error[key])) if inst.pgcode in (errorcodes.NOT_NULL_VIOLATION, errorcodes.FOREIGN_KEY_VIOLATION, errorcodes.RESTRICT_VIOLATION): msg = _('The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set') self.logger.debug("IntegrityError", exc_info=True) try: errortxt = inst.pgerror.replace('«','"').replace('»','"') if '"public".' in errortxt: context = errortxt.split('"public".')[1] model_name = table = context.split('"')[1] else: last_quote_end = errortxt.rfind('"') last_quote_begin = errortxt.rfind('"', 0, last_quote_end) model_name = table = errortxt[last_quote_begin+1:last_quote_end].strip() print "MODEL", last_quote_begin, last_quote_end, model_name model = table.replace("_",".") model_obj = self.get(model) if model_obj: model_name = model_obj._description or model_obj._name msg += _('\n\n[object with reference: %s - %s]') % (model_name, model) except Exception: pass self.abortResponse(1, _('Integrity Error'), 'warning', msg) else: self.abortResponse(1, _('Integrity Error'), 'warning', inst[0]) except Exception, e: self.logger.exception("Uncaught exception") raise | d0dee320199662492c3779deef06c412238eec73 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d0dee320199662492c3779deef06c412238eec73/osv.py |
'name': fields.char('Name', size=128), | 'name': fields.char('Name', size=128, select=1), | def _models_get2(self, cr, uid, context=None): return self._models_field_get(cr, uid, 'relation', 'relation', context) | 2dd50cdbf284fca2bfc163d172ac8a220b2fdc80 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2dd50cdbf284fca2bfc163d172ac8a220b2fdc80/ir_property.py |
help="If not set, act as default property"), 'company_id': fields.many2one('res.company', 'Company'), 'fields_id': fields.many2one('ir.model.fields', 'Fields', ondelete='cascade', required=True), | help="If not set, act as default property", select=1), 'company_id': fields.many2one('res.company', 'Company', select=1), 'fields_id': fields.many2one('ir.model.fields', 'Fields', ondelete='cascade', required=True, select=1), | def _models_get2(self, cr, uid, context=None): return self._models_field_get(cr, uid, 'relation', 'relation', context) | 2dd50cdbf284fca2bfc163d172ac8a220b2fdc80 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2dd50cdbf284fca2bfc163d172ac8a220b2fdc80/ir_property.py |
'value_float' : fields.float('Value'), 'value_integer' : fields.integer_big('Value'), 'value_text' : fields.text('Value'), 'value_binary' : fields.binary('Value'), 'value_reference': fields.reference('Value', selection=_models_get2, size=128), 'value_datetime' : fields.datetime('Value'), | 'value_float' : fields.float('Value', select=1), 'value_integer' : fields.integer_big('Value', select=1), 'value_text' : fields.text('Value', select=1), 'value_binary' : fields.binary('Value', select=1), 'value_reference': fields.reference('Value', selection=_models_get2, size=128, select=1), 'value_datetime' : fields.datetime('Value', select=1), | def _models_get2(self, cr, uid, context=None): return self._models_field_get(cr, uid, 'relation', 'relation', context) | 2dd50cdbf284fca2bfc163d172ac8a220b2fdc80 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2dd50cdbf284fca2bfc163d172ac8a220b2fdc80/ir_property.py |
next_num=eval(concat[0])+1 | next_num=int(concat[0])+1 | def copy(self, cr, uid, id, default=None, context=None): ir_values_obj = self.pool.get('ir.values') res = super(ir_ui_menu, self).copy(cr, uid, id, context=context) datas=self.read(cr,uid,[res],['name'])[0] rex=re.compile('\([0-9]+\)') concat=rex.findall(datas['name']) if concat: next_num=eval(concat[0])+1 datas['name']=rex.sub(('(%d)'%next_num),datas['name']) else: datas['name']=datas['name']+'(1)' self.write(cr,uid,[res],{'name':datas['name']}) ids = ir_values_obj.search(cr, uid, [ ('model', '=', 'ir.ui.menu'), ('res_id', '=', id), ]) for iv in ir_values_obj.browse(cr, uid, ids): ir_values_obj.copy(cr, uid, iv.id, default={'res_id': res}, context=context) return res | ab73059a9d5342a870ca924bebab842a321bd6af /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ab73059a9d5342a870ca924bebab842a321bd6af/ir_ui_menu.py |
oldctx = self.localcontext | oldctx = dict(self.localcontext) | def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): oldctx = self.localcontext for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except: continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except: yield n else: yield n self.localcontext = oldctx continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except: continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except: pass if (tagname is None) or (n.tag==tagname): yield n | 38810b8ae6ca6868a2f1537d7c6f76a0a834f67d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/38810b8ae6ca6868a2f1537d7c6f76a0a834f67d/utils.py |
if fields[f]['type'] =='integer': col.set('tree','float') | def _append_node(name, text): n = etree.SubElement(config, name) n.text = text | 2949ed38abe04bff67661e8b506ba74860979798 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2949ed38abe04bff67661e8b506ba74860979798/ps_list.py |
|
res = super(wiz_auc_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context) | res = super(auction_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context) | def default_get(self, cr, uid, fields, context): """ To get default values for the object. @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. """ res = super(wiz_auc_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context) active_id = context.get('active_id',False) active_model = context.get('active_model') if active_id and (active_model and active_model!='auction.lots'): return res lots_obj = self.pool.get('auction.lots') lots = lots_obj.browse(cr, uid, active_id) if 'bord_vnd_id' in fields and context.get('bord_vnd_id',False): res['bord_vnd_id'] = context.get('bord_vnd_id') if 'lot_num' in fields and context.get('lot_num',False): res['lot_num'] = context.get('lot_num') if 'lot_est1' in fields: res['lot_est1'] = lots.lot_est1 if 'lot_est2' in fields: res['lot_est2'] = lots.lot_est2 if 'name' in fields: res['name'] = lots.name if 'obj_desc' in fields: res['obj_desc'] = lots.obj_desc if 'obj_num' in fields: res['obj_num'] = lots.obj_num return res | 61ce0995704862e3efbaaa16153c8d416ee15094 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/61ce0995704862e3efbaaa16153c8d416ee15094/auction_lots_numerotate.py |
date_and_hours_by_cal = [(op.production_id.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops] | date_and_hours_by_cal = [(op.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops if op.date_planned] | def _get_date_end(self, cr, uid, ids, field_name, arg, context): """ Finds ending date. @return: Dictionary of values. """ ops = self.browse(cr, uid, ids, context=context) date_and_hours_by_cal = [(op.production_id.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops] intervals = self.pool.get('resource.calendar').interval_get_multi(cr, uid, date_and_hours_by_cal) | 319389a88a3da7fb2e9c09b4d11b2140f33d17e4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/319389a88a3da7fb2e9c09b4d11b2140f33d17e4/mrp_operations.py |
i = intervals[(op.date_planned, op.hour, op.workcenter_id.calendar_id.id)] | i = intervals.get((op.date_planned, op.hour, op.workcenter_id.calendar_id.id)) | def _get_date_end(self, cr, uid, ids, field_name, arg, context): """ Finds ending date. @return: Dictionary of values. """ ops = self.browse(cr, uid, ids, context=context) date_and_hours_by_cal = [(op.production_id.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops] intervals = self.pool.get('resource.calendar').interval_get_multi(cr, uid, date_and_hours_by_cal) | 319389a88a3da7fb2e9c09b4d11b2140f33d17e4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/319389a88a3da7fb2e9c09b4d11b2140f33d17e4/mrp_operations.py |
def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False): | def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False, context=None): if context is None: context = {} | def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False): account_obj = self.pool.get('account.account') journal_obj = self.pool.get('account.journal') currency_obj = self.pool.get('res.currency') if (not currency_id) or (not account_id): return {} result = {} acc = account_obj.browse(cr, uid, account_id) if (amount>0) and journal: x = journal_obj.browse(cr, uid, journal).default_credit_account_id if x: acc = x v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc) result['value'] = { 'debit': v > 0 and v or 0.0, 'credit': v < 0 and -v or 0.0 } return result | df57bcc6b6b911b65516e5e1716a6b18f4c1b334 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/df57bcc6b6b911b65516e5e1716a6b18f4c1b334/account_move_line.py |
v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc) | context.update({'date': date}) v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc, context=context) | def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False): account_obj = self.pool.get('account.account') journal_obj = self.pool.get('account.journal') currency_obj = self.pool.get('res.currency') if (not currency_id) or (not account_id): return {} result = {} acc = account_obj.browse(cr, uid, account_id) if (amount>0) and journal: x = journal_obj.browse(cr, uid, journal).default_credit_account_id if x: acc = x v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc) result['value'] = { 'debit': v > 0 and v or 0.0, 'credit': v < 0 and -v or 0.0 } return result | df57bcc6b6b911b65516e5e1716a6b18f4c1b334 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/df57bcc6b6b911b65516e5e1716a6b18f4c1b334/account_move_line.py |
Private implementation of search() method, allowing specifying the uid to use for the access right check. | Private implementation of search() method, allowing specifying the uid to use for the access right check. | def _search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None): """ Private implementation of search() method, allowing specifying the uid to use for the access right check. This is useful for example when filling in the selection list for a drop-down and avoiding access rights errors, by specifying ``access_rights_uid=1`` to bypass access rights check, but not ir.rules! :param access_rights_uid: optional user ID to use when checking access rights (not for ir.rules, this is only for ir.model.access) """ raise NotImplementedError(_('The search method is not implemented on this object !')) | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
def _search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None): """ Private implementation of search() method, allowing specifying the uid to use for the access right check. This is useful for example when filling in the selection list for a drop-down and avoiding access rights errors, by specifying ``access_rights_uid=1`` to bypass access rights check, but not ir.rules! :param access_rights_uid: optional user ID to use when checking access rights (not for ir.rules, this is only for ir.model.access) """ raise NotImplementedError(_('The search method is not implemented on this object !')) | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
||
Search for records and their display names according to a search domain. | Search for records and their display names according to a search domain. | def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100): """ Search for records and their display names according to a search domain. | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): """ Get the list of records in list view grouped by the given ``groupby`` fields | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
||
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): """ Get the list of records in list view grouped by the given ``groupby`` fields | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
||
data = [data_read[id] for id in data_ids] | data = [] for id in data_ids: for rec in data_read: if rec['id'] == id: data.append(rec) | def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): """ Get the list of records in list view grouped by the given ``groupby`` fields | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
in the form ``table.field``, to be referenced in queries. | in the form ``table.field``, to be referenced in queries. | def _inherits_join_calc(self, field, tables, where_clause): """ Adds missing table select and join clause(s) for reaching the field coming from an '_inherits' parent table (no duplicates). | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
field set to ``False`` should be applied. | field set to ``False`` should be applied. | def _where_calc(self, cr, user, args, active_test=True, context=None): """Computes the WHERE clause needed to implement an OpenERP domain. :param args: the domain to compute :type args: list :param active_test: whether the default filtering of records with ``active`` field set to ``False`` should be applied. :return: tuple with 3 elements: (where_clause, where_clause_params, tables) where ``where_clause`` contains a list of where clause elements (to be joined with 'AND'), ``where_clause_params`` is a list of parameters to be passed to the db layer for the where_clause expansion, and ``tables`` is the list of double-quoted table names that need to be included in the FROM clause. :rtype: tuple """ if not context: context = {} args = args[:] # if the object has a field named 'active', filter out all inactive # records unless they were explicitely asked for if 'active' in self._columns and (active_test and context.get('active_test', True)): if args: active_in_args = False for a in args: if a[0] == 'active': active_in_args = True if not active_in_args: args.insert(0, ('active', '=', 1)) else: args = [('active', '=', 1)] | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
table names that need to be included in the FROM clause. :rtype: tuple | table names that need to be included in the FROM clause. :rtype: tuple | def _where_calc(self, cr, user, args, active_test=True, context=None): """Computes the WHERE clause needed to implement an OpenERP domain. :param args: the domain to compute :type args: list :param active_test: whether the default filtering of records with ``active`` field set to ``False`` should be applied. :return: tuple with 3 elements: (where_clause, where_clause_params, tables) where ``where_clause`` contains a list of where clause elements (to be joined with 'AND'), ``where_clause_params`` is a list of parameters to be passed to the db layer for the where_clause expansion, and ``tables`` is the list of double-quoted table names that need to be included in the FROM clause. :rtype: tuple """ if not context: context = {} args = args[:] # if the object has a field named 'active', filter out all inactive # records unless they were explicitely asked for if 'active' in self._columns and (active_test and context.get('active_test', True)): if args: active_in_args = False for a in args: if a[0] == 'active': active_in_args = True if not active_in_args: args.insert(0, ('active', '=', 1)) else: args = [('active', '=', 1)] | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
the appropriate JOIN for linking the current model to the one referenced in model_name. | the appropriate JOIN for linking the current model to the one referenced in model_name. | def _apply_ir_rules(self, cr, uid, where_clause, where_clause_params, tables, mode='read', model_name=None, context=None): """Add what's missing in ``where_clause``, ``where_params``, ``tables`` to implement all appropriate ir.rules (on the current object but also from it's _inherits parents) | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
Private implementation of search() method, allowing specifying the uid to use for the access right check. | Private implementation of search() method, allowing specifying the uid to use for the access right check. | def _search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None): """ Private implementation of search() method, allowing specifying the uid to use for the access right check. This is useful for example when filling in the selection list for a drop-down and avoiding access rights errors, by specifying ``access_rights_uid=1`` to bypass access rights check, but not ir.rules! This is ok at the security level because this method is private and not callable through XML-RPC. :param access_rights_uid: optional user ID to use when checking access rights (not for ir.rules, this is only for ir.model.access) """ if context is None: context = {} self.pool.get('ir.model.access').check(cr, access_rights_uid or user, self._name, 'read', context=context) # compute the where, order by, limit and offset clauses (where_clause, where_clause_params, tables) = self._where_calc(cr, user, args, context=context) | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
def _search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None): """ Private implementation of search() method, allowing specifying the uid to use for the access right check. This is useful for example when filling in the selection list for a drop-down and avoiding access rights errors, by specifying ``access_rights_uid=1`` to bypass access rights check, but not ir.rules! This is ok at the security level because this method is private and not callable through XML-RPC. :param access_rights_uid: optional user ID to use when checking access rights (not for ir.rules, this is only for ir.model.access) """ if context is None: context = {} self.pool.get('ir.model.access').check(cr, access_rights_uid or user, self._name, 'read', context=context) # compute the where, order by, limit and offset clauses (where_clause, where_clause_params, tables) = self._where_calc(cr, user, args, context=context) | baaf9e4490dca16d8a8a66d81b525984f67c6493 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/baaf9e4490dca16d8a8a66d81b525984f67c6493/orm.py |
||
res[id]=[x for x in l if x <> line.id] | partial_ids.append(line.id) res[id] =[x for x in l if x <> line.id and x not in partial_ids] | def _get_lines(self, cr, uid, ids, name, arg, context=None): res = {} for id in ids: move_lines = self.move_line_id_payment_get(cr,uid,[id]) if not move_lines: res[id] = [] continue data_lines = self.pool.get('account.move.line').browse(cr,uid,move_lines) for line in data_lines: ids_line = [] if line.reconcile_id: ids_line = line.reconcile_id.line_id elif line.reconcile_partial_id: ids_line = line.reconcile_partial_id.line_partial_ids l = map(lambda x: x.id, ids_line) res[id]=[x for x in l if x <> line.id] return res | d8e33d1fc5cc88da36180020dc028d8017cbe35c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d8e33d1fc5cc88da36180020dc028d8017cbe35c/invoice.py |
lines += map(lambda x: x.id, m.reconcile_id.line_id) | temp_lines = map(lambda x: x.id, m.reconcile_id.line_id) | def _compute_lines(self, cr, uid, ids, name, args, context=None): result = {} for invoice in self.browse(cr, uid, ids, context): moves = self.move_line_id_payment_get(cr, uid, [invoice.id]) src = [] lines = [] for m in self.pool.get('account.move.line').browse(cr, uid, moves, context): if m.reconcile_id: lines += map(lambda x: x.id, m.reconcile_id.line_id) elif m.reconcile_partial_id: lines += map(lambda x: x.id, m.reconcile_partial_id.line_partial_ids) src.append(m.id) lines = filter(lambda x: x not in src, lines) result[invoice.id] = lines return result | d8e33d1fc5cc88da36180020dc028d8017cbe35c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d8e33d1fc5cc88da36180020dc028d8017cbe35c/invoice.py |
lines += map(lambda x: x.id, m.reconcile_partial_id.line_partial_ids) | temp_lines = map(lambda x: x.id, m.reconcile_partial_id.line_partial_ids) lines += [x for x in temp_lines if x not in lines] | def _compute_lines(self, cr, uid, ids, name, args, context=None): result = {} for invoice in self.browse(cr, uid, ids, context): moves = self.move_line_id_payment_get(cr, uid, [invoice.id]) src = [] lines = [] for m in self.pool.get('account.move.line').browse(cr, uid, moves, context): if m.reconcile_id: lines += map(lambda x: x.id, m.reconcile_id.line_id) elif m.reconcile_partial_id: lines += map(lambda x: x.id, m.reconcile_partial_id.line_partial_ids) src.append(m.id) lines = filter(lambda x: x not in src, lines) result[invoice.id] = lines return result | d8e33d1fc5cc88da36180020dc028d8017cbe35c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d8e33d1fc5cc88da36180020dc028d8017cbe35c/invoice.py |
resource_id = len(resource_ids) or resource_ids[0] | if resource_ids: resource_id = len(resource_ids) or resource_ids[0] | def _compute_day(self, cr, uid, ids, fields, args, context={}): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual values """ cal_obj = self.pool.get('resource.calendar') res_obj = self.pool.get('resource.resource') | d3dfc675e1e5acae19ad4bfebbb0f41d5fde9d1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d3dfc675e1e5acae19ad4bfebbb0f41d5fde9d1a/crm_opportunity.py |
number = self.pool.get('ir.sequence').get(cr, uid, 'account.cash.statement') | if statement.name and statement.name == '/': number = self.pool.get('ir.sequence').get(cr, uid, 'account.cash.statement') vals.update({ 'name':number }) | def button_open(self, cr, uid, ids, context=None): """ Changes statement state to Running. @return: True """ cash_pool = self.pool.get('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement') | e5ee5ce9a46a79286c52c9126274b11697befbf2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e5ee5ce9a46a79286c52c9126274b11697befbf2/account_cash_statement.py |
vals = { | vals.update({ | def button_open(self, cr, uid, ids, context=None): """ Changes statement state to Running. @return: True """ cash_pool = self.pool.get('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement') | e5ee5ce9a46a79286c52c9126274b11697befbf2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e5ee5ce9a46a79286c52c9126274b11697befbf2/account_cash_statement.py |
'name':number } | }) | def button_open(self, cr, uid, ids, context=None): """ Changes statement state to Running. @return: True """ cash_pool = self.pool.get('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement') | e5ee5ce9a46a79286c52c9126274b11697befbf2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e5ee5ce9a46a79286c52c9126274b11697befbf2/account_cash_statement.py |
except ValueError: | except: | def create(self, cr, uid, data, context=None): if context is None: context = {} user_id = super(res_users, self).create(cr, uid, data, context) data_obj = self.pool.get('ir.model.data') try: data_id = data_obj._get_id(cr, uid, 'crm', 'ir_ui_view_sc_calendar0') view_id = data_obj.browse(cr, uid, data_id, context=context).res_id self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = { 'user_id': user_id}, context=context) except ValueError: # Tolerate a missing shortcut. See product/product.py for similar code. logging.getLogger('orm').warning('Skipped Products shortcut for user "%s"', data.get('name','<new')) return user_id | e76438c44944c4ea3729652ec0e47900a6759449 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e76438c44944c4ea3729652ec0e47900a6759449/crm_meeting.py |
objid = self.pool.get('ir.model.data') | data_pool = self.pool.get('ir.model.data') | def _get_root_calendar_directory(self, cr, uid, context=None): objid = self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_cal_dir.name except Exception: logger = logging.getLogger('document') logger.warning('Cannot set root directory for Calendars:', exc_info=True) return False return False | f33fb9e7bbe1a8960c3e8bbfdfe1de86e3821010 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f33fb9e7bbe1a8960c3e8bbfdfe1de86e3821010/calendar_collection.py |
mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_cal_dir.name | calendar_dir_id = data_pool.get_object(cr, uid, 'caldav', 'document_directory_calendars0') return calendar_dir_id.name | def _get_root_calendar_directory(self, cr, uid, context=None): objid = self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_cal_dir.name except Exception: logger = logging.getLogger('document') logger.warning('Cannot set root directory for Calendars:', exc_info=True) return False return False | f33fb9e7bbe1a8960c3e8bbfdfe1de86e3821010 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f33fb9e7bbe1a8960c3e8bbfdfe1de86e3821010/calendar_collection.py |
logger = logging.getLogger('document') | logger = logging.getLogger('caldav') | def _get_root_calendar_directory(self, cr, uid, context=None): objid = self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_cal_dir.name except Exception: logger = logging.getLogger('document') logger.warning('Cannot set root directory for Calendars:', exc_info=True) return False return False | f33fb9e7bbe1a8960c3e8bbfdfe1de86e3821010 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f33fb9e7bbe1a8960c3e8bbfdfe1de86e3821010/calendar_collection.py |
cr.execute("Select id from ir_module_web_dependency where module_id=%s and web_module_id=%s and name=%s", (id, ids[0], d)) res = cr.fetchone() if not res: cr.execute('INSERT INTO ir_module_web_dependency (module_id, web_module_id, name) values (%s, %s, %s)', (id, ids[0], d)) | if len(ids) > 0: cr.execute("Select id from ir_module_web_dependency where module_id=%s and web_module_id=%s and name=%s", (id, ids[0], d)) res = cr.fetchone() if not res: cr.execute('INSERT INTO ir_module_web_dependency (module_id, web_module_id, name) values (%s, %s, %s)', (id, ids[0], d)) | def _update_web_dependencies(self, cr, uid, id, depends=[]): web_module_pool = self.pool.get('ir.module.web') for d in depends: ids = web_module_pool.search(cr, uid, [('module','=',d)]) cr.execute("Select id from ir_module_web_dependency where module_id=%s and web_module_id=%s and name=%s", (id, ids[0], d)) res = cr.fetchone() if not res: cr.execute('INSERT INTO ir_module_web_dependency (module_id, web_module_id, name) values (%s, %s, %s)', (id, ids[0], d)) | 35c4811952c25d4c4fd6d5e4dc78c8a5daba3833 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/35c4811952c25d4c4fd6d5e4dc78c8a5daba3833/module.py |
min(date), max(date) | min(date_expected), max(date_expected) | def get_min_max_date(self, cr, uid, ids, field_name, arg, context=None): """ Finds minimum and maximum dates for picking. @return: Dictionary of values """ res = {} for id in ids: res[id] = {'min_date': False, 'max_date': False} if not ids: return res cr.execute("""select picking_id, min(date), max(date) from stock_move where picking_id IN %s group by picking_id""",(tuple(ids),)) for pick, dt1, dt2 in cr.fetchall(): res[pick]['min_date'] = dt1 res[pick]['max_date'] = dt2 return res | 23846f5e82fe1e93fe186ac5f23679d839344703 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/23846f5e82fe1e93fe186ac5f23679d839344703/stock.py |
res[pick]['min_date'] = dt1 res[pick]['max_date'] = dt2 | res[pick]['min_date'] = dt1 res[pick]['max_date'] = dt2 | def get_min_max_date(self, cr, uid, ids, field_name, arg, context=None): """ Finds minimum and maximum dates for picking. @return: Dictionary of values """ res = {} for id in ids: res[id] = {'min_date': False, 'max_date': False} if not ids: return res cr.execute("""select picking_id, min(date), max(date) from stock_move where picking_id IN %s group by picking_id""",(tuple(ids),)) for pick, dt1, dt2 in cr.fetchall(): res[pick]['min_date'] = dt1 res[pick]['max_date'] = dt2 return res | 23846f5e82fe1e93fe186ac5f23679d839344703 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/23846f5e82fe1e93fe186ac5f23679d839344703/stock.py |
def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None): """ Creates invoice based on the invoice state selected for picking. @param journal_id: Id of journal @param group: Whether to create a group invoice or not @param type: Type invoice to be created @return: Ids of created invoices for the pickings """ if context is None: context = {} | 23846f5e82fe1e93fe186ac5f23679d839344703 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/23846f5e82fe1e93fe186ac5f23679d839344703/stock.py |
||
res = dict.fromkeys(ids) | res = dict.fromkeys(ids, False) | def _get_email_from(self, cr, uid, ids, context=None): if not isinstance(ids, list): ids = [ids] res = dict.fromkeys(ids) for user in self.browse(cr, uid, ids, context=context): if user.user_email: res[user.id] = "%s <%s>" % (user.name, user.user_email) return res | afa0a6dc06cc7da3dec42e43724ad03b7ca6a55a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afa0a6dc06cc7da3dec42e43724ad03b7ca6a55a/res_user.py |
phase_resource_obj = resource_pool.generate_resources(cr, uid, [phase.responsible_id.id], calendar_id, context=context) | phase_resource_obj = self.generate_resources(cr, uid, [phase.id], context=context)[phase.id] | def generate_schedule(self, cr, uid, ids, start_date=False, calendar_id=False, context=None): """ Schedule phase with the start date till all the next phases are completed. @param: start_date (datetime.datetime) : start date for the phase. It would be either Start date of phase or start date of project or system current date @param: calendar_id : working calendar of the project """ if context is None: context = {} resource_pool = self.pool.get('resource.resource') data_pool = self.pool.get('ir.model.data') resource_allocation_pool = self.pool.get('project.resource.allocation') uom_pool = self.pool.get('product.uom') data_model, day_uom_id = data_pool.get_object_reference(cr, uid, 'product', 'uom_day') for phase in self.browse(cr, uid, ids, context=context): if not phase.responsible_id: raise osv.except_osv(_('No responsible person assigned !'),_("You must assign a responsible person for phase '%s' !") % (phase.name,)) | db3ecb06499f378d9226420f5807fbb84b33128a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db3ecb06499f378d9226420f5807fbb84b33128a/project_long_term.py |
for phase in phase.next_phase_ids: if phase.state in ['draft', 'open', 'pending']: id_cal = phase.project_id.resource_calendar_id and phase.project_id.resource_calendar_id.id or False self.generate_schedule(cr, uid, [phase.id], date_start, id_cal, context=context) | for next_phase in phase.next_phase_ids: if next_phase.state in ['draft', 'open', 'pending']: id_cal = next_phase.project_id.resource_calendar_id and next_phase.project_id.resource_calendar_id.id or False self.generate_schedule(cr, uid, [next_phase.id], date_start+timedelta(days=1), id_cal, context=context) | def phase(): effort = duration | db3ecb06499f378d9226420f5807fbb84b33128a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db3ecb06499f378d9226420f5807fbb84b33128a/project_long_term.py |
'partner_id': address.partner_id and address.partner_id.id or '', | 'partner_id': address.partner_id and str(address.partner_id.id) or '', | def search_contact(self, cr, user, email): address_pool = self.pool.get('res.partner.address') address_ids = address_pool.search(cr, user, [('email','=',email)]) res = {} | 66b08730e1dcf0c325614475d1f61fb89a1abd1c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/66b08730e1dcf0c325614475d1f61fb89a1abd1c/partner.py |
if 'company_id' not in values or (values.get('company_id') in self.read(cr, uid, uid, ['company_ids'], context=context)['company_ids']): uid = 1 | if 'company_id' in values: if not (values['company_id'] in self.read(cr, uid, uid, ['company_ids'], context=context)['company_ids']): del values['company_id'] uid = 1 | def write(self, cr, uid, ids, values, context=None): if not hasattr(ids, '__iter__'): ids = [ids] if ids == [uid]: for key in values.keys(): if not (key in self.SELF_WRITEABLE_FIELDS or key.startswith('context_')): break else: # check that user is not selecting an invalid company_id if 'company_id' not in values or (values.get('company_id') in self.read(cr, uid, uid, ['company_ids'], context=context)['company_ids']): uid = 1 # safe fields only, so we write as super-user to bypass access rights | ae1653e63ccc04702058bdaf9c0ebe681e1eb108 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ae1653e63ccc04702058bdaf9c0ebe681e1eb108/res_user.py |
if abs(amount) < 0.0001: | if abs(amount) < 10 ** -(int(config['price_accuracy'])1): | def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id) | 5975104b4fe18e9a097700a5ef4cd888b1c6b17b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5975104b4fe18e9a097700a5ef4cd888b1c6b17b/account.py |
vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking') | seq_obj_name = 'stock.picking.' + vals['type'] vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) | def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking') type_list = { 'out':_('Packing List'), 'in':_('Reception'), 'internal': _('Internal picking'), 'delivery': _('Delivery order') } if not vals.get('auto_picking', False): message = type_list.get(vals.get('type',_('Picking'))) + " '" + vals['name'] + "' "+ _("created.") self.log(cr, user, id, message) return super(stock_picking, self).create(cr, user, vals, context) | f9625c9cf3ff1d24d71017c9ee6f0c1dd992e98d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f9625c9cf3ff1d24d71017c9ee6f0c1dd992e98d/stock.py |
vals_journal = { | vals_journal.update({ | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_acc_tax_template = self.pool.get('account.tax.code.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_acc_chart_template = self.pool.get('account.chart.template') obj_acc_journal_view = self.pool.get('account.journal.view') mod_obj = self.pool.get('ir.model.data') obj_sequence = self.pool.get('ir.sequence') property_obj = self.pool.get('ir.property') fields_obj = self.pool.get('ir.model.fields') obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account') | 9a49fa6ea8eeb5fffa43df689d97428725412e52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9a49fa6ea8eeb5fffa43df689d97428725412e52/installer.py |
} | }) | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_acc_tax_template = self.pool.get('account.tax.code.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_acc_chart_template = self.pool.get('account.chart.template') obj_acc_journal_view = self.pool.get('account.journal.view') mod_obj = self.pool.get('ir.model.data') obj_sequence = self.pool.get('ir.sequence') property_obj = self.pool.get('ir.property') fields_obj = self.pool.get('ir.model.fields') obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account') | 9a49fa6ea8eeb5fffa43df689d97428725412e52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9a49fa6ea8eeb5fffa43df689d97428725412e52/installer.py |
vals_journal = { | vals_journal.update({ | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_acc_tax_template = self.pool.get('account.tax.code.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_acc_chart_template = self.pool.get('account.chart.template') obj_acc_journal_view = self.pool.get('account.journal.view') mod_obj = self.pool.get('ir.model.data') obj_sequence = self.pool.get('ir.sequence') property_obj = self.pool.get('ir.property') fields_obj = self.pool.get('ir.model.fields') obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account') | 9a49fa6ea8eeb5fffa43df689d97428725412e52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9a49fa6ea8eeb5fffa43df689d97428725412e52/installer.py |
} | }) | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_acc_tax_template = self.pool.get('account.tax.code.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_acc_chart_template = self.pool.get('account.chart.template') obj_acc_journal_view = self.pool.get('account.journal.view') mod_obj = self.pool.get('ir.model.data') obj_sequence = self.pool.get('ir.sequence') property_obj = self.pool.get('ir.property') fields_obj = self.pool.get('ir.model.fields') obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account') | 9a49fa6ea8eeb5fffa43df689d97428725412e52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9a49fa6ea8eeb5fffa43df689d97428725412e52/installer.py |
self._pool.give_back(self._cnx) | keep_in_pool = self.dbname not in ('template1', 'template0', 'postgres') self._pool.give_back(self._cnx, keep_in_pool=keep_in_pool) | def close(self): if not self._obj: return | 9830fb430ff44687dd0f240931c95ec95ff289fc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9830fb430ff44687dd0f240931c95ec95ff289fc/sql_db.py |
def give_back(self, connection): | def give_back(self, connection, keep_in_pool=True): | def give_back(self, connection): self._debug('Give back connection to %s' % (connection.dsn,)) for i, (cnx, used) in enumerate(self._connections): if cnx is connection: self._connections.pop(i) self._connections.append((cnx, False)) break else: raise PoolError('This connection does not below to the pool') | 9830fb430ff44687dd0f240931c95ec95ff289fc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9830fb430ff44687dd0f240931c95ec95ff289fc/sql_db.py |
self._connections.append((cnx, False)) | if keep_in_pool: self._connections.append((cnx, False)) self._debug('Put connection to %s in pool' % (cnx.dsn,)) | def give_back(self, connection): self._debug('Give back connection to %s' % (connection.dsn,)) for i, (cnx, used) in enumerate(self._connections): if cnx is connection: self._connections.pop(i) self._connections.append((cnx, False)) break else: raise PoolError('This connection does not below to the pool') | 9830fb430ff44687dd0f240931c95ec95ff289fc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9830fb430ff44687dd0f240931c95ec95ff289fc/sql_db.py |
datas = self.read(cr, uid, event_id, context=context) | def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args): """Modifies only one event record out of virtual recurrent events and creates new event as a specific instance of a Recurring Event", @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 event_id: Id of Recurring Event @param real_date: Date of event recurrence that is being modified @param context: A standard dictionary for contextual values @param *args: Get Tupple Value """ | 5f2a464a8c47b341c102ff2536c24bca3c7f90d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5f2a464a8c47b341c102ff2536c24bca3c7f90d1/base_calendar.py |
|
'recurrent_uid': base_calendar_id2real_id(datas['id']), 'recurrent_id': defaults.get('date') or real_date, | 'recurrent_uid': base_calendar_id2real_id(event_id), 'recurrent_id': real_date, | def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args): """Modifies only one event record out of virtual recurrent events and creates new event as a specific instance of a Recurring Event", @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 event_id: Id of Recurring Event @param real_date: Date of event recurrence that is being modified @param context: A standard dictionary for contextual values @param *args: Get Tupple Value """ | 5f2a464a8c47b341c102ff2536c24bca3c7f90d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5f2a464a8c47b341c102ff2536c24bca3c7f90d1/base_calendar.py |
exdate = datas['exdate'] and datas['exdate'].split(',') or [] if real_date and defaults.get('date'): exdate.append(real_date) self.write(cr, uid, event_id, {'exdate': ','.join(exdate)}, context=context) | def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args): """Modifies only one event record out of virtual recurrent events and creates new event as a specific instance of a Recurring Event", @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 event_id: Id of Recurring Event @param real_date: Date of event recurrence that is being modified @param context: A standard dictionary for contextual values @param *args: Get Tupple Value """ | 5f2a464a8c47b341c102ff2536c24bca3c7f90d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5f2a464a8c47b341c102ff2536c24bca3c7f90d1/base_calendar.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.