rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
amount_unit=move.product_id.price_get(cr, uid, ids, pricetype.field, context) | amount_unit=move.product_id.price_get(pricetype.field, context)[move.product_id.id] | def action_done(self, cr, uid, ids, context=None): track_flag = False for move in self.browse(cr, uid, ids): if move.move_dest_id.id and (move.state != 'done'): cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id)) if move.move_dest_id.state in ('waiting', 'confirmed'): self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'}) if move.move_dest_id.picking_id: wf_service = netsvc.LocalService("workflow") wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) else: pass # self.action_done(cr, uid, [move.move_dest_id.id]) if move.move_dest_id.auto_validate: self.action_done(cr, uid, [move.move_dest_id.id], context=context) | 9388c1b1f1e60139bcbee299df0359ab36da722b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9388c1b1f1e60139bcbee299df0359ab36da722b/stock.py |
'sum_currency_amount_account': self._sum_currency_amount_account, 'get_filter': self._get_filter, | 'sum_currency_amount_account': self._sum_currency_amount_account, 'get_filter': self._get_filter, | def __init__(self, cr, uid, name, context=None): if context is None: context = {} super(journal_print, self).__init__(cr, uid, name, context=context) self.period_ids = [] self.journal_ids = [] self.localcontext.update( { 'time': time, 'lines': self.lines, 'periods': self.periods, 'sum_debit_period': self._sum_debit_period, 'sum_credit_period': self._sum_credit_period, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'get_fiscalyear': self._get_fiscalyear, 'get_account': self._get_account, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, 'get_sortby': self._get_sortby, 'sum_currency_amount_account': self._sum_currency_amount_account, 'get_filter': self._get_filter, 'get_journal': self._get_journal, 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, 'get_currency ':self.get_currency }) | 83bae2679c9e2a2e5d9ead04648b1f0162029f38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/83bae2679c9e2a2e5d9ead04648b1f0162029f38/general_journal.py |
'get_end_date':self._get_end_date, 'get_currency ':self.get_currency | 'get_end_date':self._get_end_date, 'get_currency ':self._get_currency | def __init__(self, cr, uid, name, context=None): if context is None: context = {} super(journal_print, self).__init__(cr, uid, name, context=context) self.period_ids = [] self.journal_ids = [] self.localcontext.update( { 'time': time, 'lines': self.lines, 'periods': self.periods, 'sum_debit_period': self._sum_debit_period, 'sum_credit_period': self._sum_credit_period, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'get_fiscalyear': self._get_fiscalyear, 'get_account': self._get_account, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, 'get_sortby': self._get_sortby, 'sum_currency_amount_account': self._sum_currency_amount_account, 'get_filter': self._get_filter, 'get_journal': self._get_journal, 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, 'get_currency ':self.get_currency }) | 83bae2679c9e2a2e5d9ead04648b1f0162029f38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/83bae2679c9e2a2e5d9ead04648b1f0162029f38/general_journal.py |
return currency_total | return currency_total | def _sum_currency_amount_account(self, account, form): self._set_get_account_currency_code(account.id) self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone() | 83bae2679c9e2a2e5d9ead04648b1f0162029f38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/83bae2679c9e2a2e5d9ead04648b1f0162029f38/general_journal.py |
return super(journal_print ,self)._get_account(data) | return super(journal_print ,self)._get_account(data) | def _get_account(self, data): if data['model']=='account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name return super(journal_print ,self)._get_account(data) | 83bae2679c9e2a2e5d9ead04648b1f0162029f38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/83bae2679c9e2a2e5d9ead04648b1f0162029f38/general_journal.py |
return super(journal_print ,self)._get_fiscalyear(data) | return super(journal_print ,self)._get_fiscalyear(data) | def _get_fiscalyear(self, data): if data['model']=='account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name return super(journal_print ,self)._get_fiscalyear(data) | 83bae2679c9e2a2e5d9ead04648b1f0162029f38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/83bae2679c9e2a2e5d9ead04648b1f0162029f38/general_journal.py |
return data['form']['amount_currency'] | return data['form']['amount_currency'] | def _get_currency(self, data): if data['model']=='account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).journal_id.currency or False return data['form']['amount_currency'] | 83bae2679c9e2a2e5d9ead04648b1f0162029f38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/83bae2679c9e2a2e5d9ead04648b1f0162029f38/general_journal.py |
self.list[obj.code]=str(obj.amount) | self.list[str(obj.code)]=str(obj.amount) | def find_child(obj): self.list[obj.code]=str(obj.amount) if obj.child_ids: for child in obj.child_ids: find_child(child) return True | 0560297729b16c7892c1ef80cb138315c4bfa8a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0560297729b16c7892c1ef80cb138315c4bfa8a7/account_report_print_indicators_with_pdf.py |
continue | if not isinstance(field,fields.property): continue | def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent) | 9186fb8144f7c214dbd230f677231a28bdcf353e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9186fb8144f7c214dbd230f677231a28bdcf353e/expression.py |
def _balance_search(self, cursor, user, obj, name, args): | def _balance_search(self, cursor, user, obj, name, args, domain=None, context=None): if context is None: context = {} | def _balance_search(self, cursor, user, obj, name, args): if not len(args): return [] where = ' and '.join(map(lambda x: '(abs(sum(debit-credit))'+x[1]+str(x[2])+')',args)) cursor.execute('select id, sum(debit-credit) from account_move_line \ group by id,debit,credit having '+where) res = cursor.fetchall() if not len(res): return [('id', '=', '0')] return [('id', 'in', [x[0] for x in res])] | 222ab7cd116bfbee0f4f7b0bb80bd8239a89e863 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/222ab7cd116bfbee0f4f7b0bb80bd8239a89e863/account_move_line.py |
self._handle_one_foreign(hnd,npath, vdir.auth_provider) | try: self._handle_one_foreign(hnd,npath, vdir.auth_provider) except IOError, e: if e.errno == errno.EPIPE: self.log_message("Could not complete request %s," \ "client closed connection", self.rlpath.rstrip()) else: raise | def handle_one_request(self): """Handle a single HTTP request. Dispatch to the correct handler. """ self.request.setblocking(True) self.raw_requestline = self.rfile.readline() if not self.raw_requestline: self.close_connection = 1 # self.log_message("no requestline, connection closed?") return if not self.parse_rawline(): self.log_message("Could not parse rawline.") return # self.parse_request(): # Do NOT parse here. the first line should be the only if self.path == '*' and self.command == 'OPTIONS': # special handling of path='*', must not use any vdir at all. if not self.parse_request(): return self.do_OPTIONS() return for vdir in self.server.vdirs: p = vdir.matches(self.path) if p == False: continue npath = self.path[len(p):] if not npath.startswith('/'): npath = '/' + npath | 1fed78619fa71675f3ae902abbafe65526a04f7c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1fed78619fa71675f3ae902abbafe65526a04f7c/websrv_lib.py |
if form['journal_ids'][0][2]: journal = " in (" + ','.join(map(lambda x: str(x), form['journal_ids'][0][2])) + ")" | if form['journal_ids']: journal = " in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")" | def _ref_lines(self,form): result = [] res = {} acc_id = [] final = [] acc_pool = self.pool.get('account.analytic.account') line_pool = self.pool.get('account.analytic.line') | 9e18e480f8e205f9a8c3ca1a039109ab483c438e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9e18e480f8e205f9a8c3ca1a039109ab483c438e/crossovered_analytic.py |
if form['journal_ids'][0][2]: journal=" in (" + ','.join(map(lambda x: str(x), form['journal_ids'][0][2])) + ")" | if form['journal_ids']: journal=" in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")" | def _lines(self,form,ids={}): if not ids: ids = self.ids | 9e18e480f8e205f9a8c3ca1a039109ab483c438e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9e18e480f8e205f9a8c3ca1a039109ab483c438e/crossovered_analytic.py |
elif pick.state in ['confirmed','assigned']: | elif pick.state in ['confirmed','assigned', 'draft']: | def unlink(self, cr, uid, ids, context=None): for pick in self.browse(cr, uid, ids, context=context): if pick.state in ['done','cancel']: raise osv.except_osv(_('Error'), _('You cannot remove the picking which is in %s state !')%(pick.state,)) elif pick.state in ['confirmed','assigned']: ids2 = [move.id for move in pick.move_lines] context.update({'call_unlink':True}) self.pool.get('stock.move').action_cancel(cr, uid, ids2, context) else: continue return super(stock_picking, self).unlink(cr, uid, ids, context=context) | 9f31cb419c4813367d2423edb42cd29e36c49cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f31cb419c4813367d2423edb42cd29e36c49cbc/stock.py |
context.update({'call_unlink':True}) self.pool.get('stock.move').action_cancel(cr, uid, ids2, context) else: continue | ctx = context.copy() ctx.update({'call_unlink':True}) if pick.state != 'draft': move_obj.action_cancel(cr, uid, ids2, ctx) move_obj.unlink(cr, uid, ids2, ctx) | def unlink(self, cr, uid, ids, context=None): for pick in self.browse(cr, uid, ids, context=context): if pick.state in ['done','cancel']: raise osv.except_osv(_('Error'), _('You cannot remove the picking which is in %s state !')%(pick.state,)) elif pick.state in ['confirmed','assigned']: ids2 = [move.id for move in pick.move_lines] context.update({'call_unlink':True}) self.pool.get('stock.move').action_cancel(cr, uid, ids2, context) else: continue return super(stock_picking, self).unlink(cr, uid, ids, context=context) | 9f31cb419c4813367d2423edb42cd29e36c49cbc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f31cb419c4813367d2423edb42cd29e36c49cbc/stock.py |
data_of_file = '<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-14.xml">' | data_of_file = '<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-16.xml">' | def create_xml(self, cr, uid, ids, context=None): obj_fyear = self.pool.get('account.fiscalyear') obj_tax_code = self.pool.get('account.tax.code') obj_acc_period = self.pool.get('account.period') obj_user = self.pool.get('res.users') mod_obj = self.pool.get('ir.model.data') | 8394924cc02566fb6a9e25d08332a11c750d5e22 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8394924cc02566fb6a9e25d08332a11c750d5e22/l10n_be_account_vat_declaration.py |
def create_xml(self, cr, uid, ids, context=None): obj_fyear = self.pool.get('account.fiscalyear') obj_tax_code = self.pool.get('account.tax.code') obj_acc_period = self.pool.get('account.period') obj_user = self.pool.get('res.users') mod_obj = self.pool.get('ir.model.data') | 8394924cc02566fb6a9e25d08332a11c750d5e22 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8394924cc02566fb6a9e25d08332a11c750d5e22/l10n_be_account_vat_declaration.py |
||
'dir_id': fields.many2one('document.directory', 'Directory', required=True), | 'dir_id': fields.many2one('document.directory', 'Directory', required=True, ondelete="cascade"), | # TODO def unlink(... | 0bdc45e068d584220d2a1b399d5f0389fcd6e092 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0bdc45e068d584220d2a1b399d5f0389fcd6e092/document_directory.py |
task_obj.write(cr, uid, data['id'], { | task_obj.write(cr, uid, [data['id']], { | def _do_assign(self, cr, uid, data, context): task_obj = pooler.get_pool(cr.dbname).get('project.task') task = task_obj.browse(cr, uid, data['id'], context) newname = data['form']['prefix'] or '' task_obj.copy(cr, uid, data['id'], { 'name': data['form']['name'], 'user_id': data['form']['user_id'], 'planned_hours': data['form']['planned_hours'], 'remaining_hours': data['form']['planned_hours'], 'parent_id': data['id'], 'state': 'open', 'description': data['form']['new_task_description'] or '', 'child_ids': [], 'work_ids': [] }) task_obj.write(cr, uid, data['id'], { 'remaining_hours': data['form']['planned_hours_me'], 'name': newname }) if data['form']['state']=='pending': task_obj.do_pending(cr, uid, [data['id']]) else: task_obj.do_close(cr, uid, [data['id']]) return {} | 294632110d8ae9fabb3ad2abcf15968f0cb68a4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/294632110d8ae9fabb3ad2abcf15968f0cb68a4b/task_delegate.py |
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date | start_date = event_date | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param base_start_date: Get Start Date @param base_until_date: Get End Date @param limit: The Number of Results to Return """ | b82c556ee9032c493f2cbb0194a68a904410153a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b82c556ee9032c493f2cbb0194a68a904410153a/base_calendar.py |
cr.execute("""select p.id, p.name from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \ | cr.execute("""select p.id from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \ | def compute_refund(self, cr, uid, ids, mode='refund', context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs | bcb30ec9c070cb47a98de3493a655ad105df8328 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bcb30ec9c070cb47a98de3493a655ad105df8328/account_invoice_refund.py |
active_id=str("active_id") | active_id = str("active_id") | # def ref() added because , if context has ref('id') eval wil use this ref | 0a0103521c3329e5c6429634a9c0dfd976a9fde3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0a0103521c3329e5c6429634a9c0dfd976a9fde3/convert.py |
context=eval(context) domain=eval(domain) | context = eval(context) | def ref(str_id): return self.id_get(cr, None, str_id) | 0a0103521c3329e5c6429634a9c0dfd976a9fde3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0a0103521c3329e5c6429634a9c0dfd976a9fde3/convert.py |
def list_web(self, cr, uid, context=False): | def list_web(self, cr, uid, context=None): | def list_web(self, cr, uid, context=False): """ list_web(cr, uid, context) -> [module_name] Lists all the currently installed modules with a web component. | 60f6882c37c9473de9e0bfc1588fa203e700b7e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60f6882c37c9473de9e0bfc1588fa203e700b7e2/module.py |
def get_web(self, cr, uid, names, context=False): | def _web_dependencies(self, cr, uid, module, context=None): for dependency in module.dependencies_id: (parent,) = self.browse(cr, uid, self.search(cr, uid, [('name', '=', dependency.name)], context=context), context=context) if parent.web: yield parent.name else: self._web_dependencies( cr, uid, parent, context=context) def get_web(self, cr, uid, names, context=None): | def get_web(self, cr, uid, names, context=False): """ get_web(cr, uid, [module_name], context) -> [{name, depends, content}] | 60f6882c37c9473de9e0bfc1588fa203e700b7e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60f6882c37c9473de9e0bfc1588fa203e700b7e2/module.py |
'depends': [dep.name for dep in module.dependencies_id if self.search(cr, uid, [ ('name', '=', dep.name), ('web', '=', True) ], context=context)], | 'depends': list(self._web_dependencies( cr, uid, module, context=context)), | def get_web(self, cr, uid, names, context=False): """ get_web(cr, uid, [module_name], context) -> [{name, depends, content}] | 60f6882c37c9473de9e0bfc1588fa203e700b7e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60f6882c37c9473de9e0bfc1588fa203e700b7e2/module.py |
print 'login' | def login(db, login, password): print 'login' pool = pooler.get_pool(db) user_obj = pool.get('res.users') res = user_obj.login(db, login, password) print 'login end' return res | 56e1e6cd2a8f82c2b78c7a99f10eabe6305e75ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/56e1e6cd2a8f82c2b78c7a99f10eabe6305e75ec/security.py |
|
res = user_obj.login(db, login, password) print 'login end' return res | return user_obj.login(db, login, password) | def login(db, login, password): print 'login' pool = pooler.get_pool(db) user_obj = pool.get('res.users') res = user_obj.login(db, login, password) print 'login end' return res | 56e1e6cd2a8f82c2b78c7a99f10eabe6305e75ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/56e1e6cd2a8f82c2b78c7a99f10eabe6305e75ec/security.py |
'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)') | 'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)'), 'category_holiday_id': fields.many2one('hr.holidays', 'Holiday', help='For allocation By Employee Category (Link between Employee Category holiday and related holidays for employees of that category)') | def _employee_get(obj, cr, uid, context=None): if context is None: context = {} ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) if ids: return ids[0] return False | 8319012fca94b6f066e6d1f4e857737563eee7cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8319012fca94b6f066e6d1f4e857737563eee7cb/hr_holidays.py |
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)]) | ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) | def holidays_validate2(self, cr, uid, ids, *args): vals = {'state':'validate1'} self.check_holidays(cr, uid, ids) ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)]) if ids2: vals['manager_id'] = ids2[0] else: raise osv.except_osv(_('Warning !'),_('No user related to the selected employee.')) return self.write(cr, uid, ids, vals) | 8319012fca94b6f066e6d1f4e857737563eee7cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8319012fca94b6f066e6d1f4e857737563eee7cb/hr_holidays.py |
self._create_resource_leave(cr, uid, vals) | for leave_id in self.search(cr, uid, [('category_holiday_id', '=', record.id)]): wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'validate', cr) | def holidays_validate(self, cr, uid, ids, *args): obj_emp = self.pool.get('hr.employee') data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) vals = {'state':'validate'} ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) if ids2: if data_holiday[0].state == 'validate1': vals['manager_id2'] = ids2[0] else: vals['manager_id'] = ids2[0] else: raise osv.except_osv(_('Warning !'), _('No user related to the selected employee.')) self.write(cr, uid, ids, vals) for record in data_holiday: if record.holiday_type == 'employee' and record.type == 'remove': vals = { 'name': record.name, 'date_from': record.date_from, 'date_to': record.date_to, 'calendar_id': record.employee_id.calendar_id.id, 'company_id': record.employee_id.company_id.id, 'resource_id': record.employee_id.resource_id.id, 'holiday_id': record.id } self._create_resource_leave(cr, uid, vals) elif record.holiday_type == 'category' and record.type == 'remove': emp_ids = obj_emp.search(cr, uid, [('category_ids', '=', record.category_id.id)]) for emp in obj_emp.browse(cr, uid, emp_ids): vals = { 'name': record.name, 'date_from': record.date_from, 'date_to': record.date_to, 'calendar_id': emp.calendar_id.id, 'company_id': emp.company_id.id, 'resource_id': emp.resource_id.id, 'holiday_id':record.id } self._create_resource_leave(cr, uid, vals) return True | 8319012fca94b6f066e6d1f4e857737563eee7cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8319012fca94b6f066e6d1f4e857737563eee7cb/hr_holidays.py |
self.write(cr, uid, [record.id], {'state':'confirm', 'number_of_days': nb, 'user_id': user_id }) | self.write(cr, uid, [record.id], {'state':'confirm', 'number_of_days': nb, 'user_id': user_id}) | def holidays_confirm(self, cr, uid, ids, *args): obj_hr_holiday_status = self.pool.get('hr.holidays.status') for record in self.browse(cr, uid, ids): user_id = False leave_asked = record.number_of_days_temp if record.holiday_type == 'employee' and record.type == 'remove': if record.employee_id and not record.holiday_status_id.limit: leaves_rest = obj_hr_holiday_status.get_days( cr, uid, [record.holiday_status_id.id], record.employee_id.id, False)[record.holiday_status_id.id]['remaining_leaves'] if leaves_rest < leave_asked: raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for employee %s while there are too few remaining leave days.') % (record.employee_id.name)) nb = -(record.number_of_days_temp) elif record.holiday_type == 'category' and record.type == 'remove': if record.category_id and not record.holiday_status_id.limit: leaves_rest = obj_hr_holiday_status.get_days_cat( cr, uid, [record.holiday_status_id.id], record.category_id.id, False)[record.holiday_status_id.id]['remaining_leaves'] if leaves_rest < leave_asked: raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for category %s while there are too few remaining leave days.') % (record.category_id.name)) nb = -(record.number_of_days_temp) else: nb = record.number_of_days_temp | 8319012fca94b6f066e6d1f4e857737563eee7cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8319012fca94b6f066e6d1f4e857737563eee7cb/hr_holidays.py |
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) | ids2 = obj_emp.search(cr, uid, [('user_id','=', uid)]) | def holidays_refuse(self, cr, uid, ids, *args): vals = {'state': 'refuse'} ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids2: vals['manager_id'] = ids2[0] self.write(cr, uid, ids, vals) return True | 8319012fca94b6f066e6d1f4e857737563eee7cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8319012fca94b6f066e6d1f4e857737563eee7cb/hr_holidays.py |
self._remove_resouce_leave(cr, uid, ids) | leave_ids = self._get_category_leave_ids(cr, uid, ids) if leave_ids: self.unlink(cr, uid, leave_ids) | def holidays_cancel(self, cr, uid, ids, *args): self._update_user_holidays(cr, uid, ids) self.write(cr, uid, ids, {'state': 'cancel'}) self._remove_resouce_leave(cr, uid, ids) return True | 8319012fca94b6f066e6d1f4e857737563eee7cb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8319012fca94b6f066e6d1f4e857737563eee7cb/hr_holidays.py |
res.update({'subject': str(context.get('subject', case.name) or '')}) | res.update({'subject': ustr(context.get('subject', case.name) or '')}) | def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ if not context: context = {} | 3e195a7ceebfff3a4c72b23f842f60522549e126 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3e195a7ceebfff3a4c72b23f842f60522549e126/crm_send_email.py |
if res and res[0][0] < 0: | if res and res[0][0] and res[0][0] < 0: | def _check_date(self, cr, uid, ids): if ids: cr.execute('select number_of_days_temp from hr_holidays where id in ('+','.join(map(str, ids))+')') res = cr.fetchall() if res and res[0][0] < 0: return False return True | 418ac79d942f403b3b59edfe46559f9a225fe259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/418ac79d942f403b3b59edfe46559f9a225fe259/hr_holidays.py |
def _check_has_start(self, cr, uid, ids, context=None): for campaign in self.browse(cr, uid, ids, context=context): if not any(a.start for a in campaign.activity_ids): return False return True | def __str__(self): return self._str | 9f6839faa1900a1dc012884b012b4d0d255c1acc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f6839faa1900a1dc012884b012b4d0d255c1acc/marketing_campaign.py |
|
_constraints = [(_check_has_start, 'Please mark at least one activity as a start activity', ['Activities'])] | def _check_has_start(self, cr, uid, ids, context=None): for campaign in self.browse(cr, uid, ids, context=context): if not any(a.start for a in campaign.activity_ids): return False return True | 9f6839faa1900a1dc012884b012b4d0d255c1acc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f6839faa1900a1dc012884b012b4d0d255c1acc/marketing_campaign.py |
|
if not campaign.activity_ids : raise osv.except_osv("Error", "There is no activitity in the campaign") activity_ids = [ act_id.id for act_id in campaign.activity_ids] if not activity_ids: raise osv.except_osv(_("Error"), _("The campaign cannot be started : there are no activities in it")) act_obj = self.pool.get('marketing.campaign.activity') act_ids = act_obj.search(cr, uid, [('id', 'in', activity_ids), ('type', '=', 'email')]) for activity in act_obj.browse(cr, uid, act_ids): if not activity.email_template_id.enforce_from_account : | if not campaign.activity_ids: raise osv.except_osv(_("Error"), _("The campaign cannot be started: there are no activities in it")) has_start = False has_signal_without_from = False for activity in campaign.activity_ids: if activity.start: has_start = True if activity.signal and len(activity.from_ids) == 0: has_signal_without_from = True if activity.type != 'email': continue if not activity.email_template_id.enforce_from_account: | def state_running_set(self, cr, uid, ids, *args): # TODO check that all subcampaigns are running campaign = self.browse(cr, uid, ids[0]) if not campaign.activity_ids : raise osv.except_osv("Error", "There is no activitity in the campaign") activity_ids = [ act_id.id for act_id in campaign.activity_ids] if not activity_ids: raise osv.except_osv(_("Error"), _("The campaign cannot be started : there are no activities in it")) act_obj = self.pool.get('marketing.campaign.activity') act_ids = act_obj.search(cr, uid, [('id', 'in', activity_ids), ('type', '=', 'email')]) for activity in act_obj.browse(cr, uid, act_ids): if not activity.email_template_id.enforce_from_account : raise osv.except_osv(_("Error"), _("The campaign cannot be started: an email account is missing in the email activity '%s'")%activity.name) if activity.email_template_id.enforce_from_account.state != 'approved' : raise osv.except_osv(_("Error"), _("The campaign cannot be started: the email account is not approved in the email activity '%s'")%activity.name) self.write(cr, uid, ids, {'state': 'running'}) return True | 9f6839faa1900a1dc012884b012b4d0d255c1acc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f6839faa1900a1dc012884b012b4d0d255c1acc/marketing_campaign.py |
if activity.email_template_id.enforce_from_account.state != 'approved' : | if activity.email_template_id.enforce_from_account.state != 'approved': | def state_running_set(self, cr, uid, ids, *args): # TODO check that all subcampaigns are running campaign = self.browse(cr, uid, ids[0]) if not campaign.activity_ids : raise osv.except_osv("Error", "There is no activitity in the campaign") activity_ids = [ act_id.id for act_id in campaign.activity_ids] if not activity_ids: raise osv.except_osv(_("Error"), _("The campaign cannot be started : there are no activities in it")) act_obj = self.pool.get('marketing.campaign.activity') act_ids = act_obj.search(cr, uid, [('id', 'in', activity_ids), ('type', '=', 'email')]) for activity in act_obj.browse(cr, uid, act_ids): if not activity.email_template_id.enforce_from_account : raise osv.except_osv(_("Error"), _("The campaign cannot be started: an email account is missing in the email activity '%s'")%activity.name) if activity.email_template_id.enforce_from_account.state != 'approved' : raise osv.except_osv(_("Error"), _("The campaign cannot be started: the email account is not approved in the email activity '%s'")%activity.name) self.write(cr, uid, ids, {'state': 'running'}) return True | 9f6839faa1900a1dc012884b012b4d0d255c1acc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f6839faa1900a1dc012884b012b4d0d255c1acc/marketing_campaign.py |
self.write(cr, uid, ids, {'state': 'running'}) return True | if not has_start and not has_signal_without_from: raise osv.except_osv(_("Error"), _("The campaign hasn't any starting activity nor any activity with a signal and no previous activity.")) return self.write(cr, uid, ids, {'state': 'running'}) | def state_running_set(self, cr, uid, ids, *args): # TODO check that all subcampaigns are running campaign = self.browse(cr, uid, ids[0]) if not campaign.activity_ids : raise osv.except_osv("Error", "There is no activitity in the campaign") activity_ids = [ act_id.id for act_id in campaign.activity_ids] if not activity_ids: raise osv.except_osv(_("Error"), _("The campaign cannot be started : there are no activities in it")) act_obj = self.pool.get('marketing.campaign.activity') act_ids = act_obj.search(cr, uid, [('id', 'in', activity_ids), ('type', '=', 'email')]) for activity in act_obj.browse(cr, uid, act_ids): if not activity.email_template_id.enforce_from_account : raise osv.except_osv(_("Error"), _("The campaign cannot be started: an email account is missing in the email activity '%s'")%activity.name) if activity.email_template_id.enforce_from_account.state != 'approved' : raise osv.except_osv(_("Error"), _("The campaign cannot be started: the email account is not approved in the email activity '%s'")%activity.name) self.write(cr, uid, ids, {'state': 'running'}) return True | 9f6839faa1900a1dc012884b012b4d0d255c1acc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f6839faa1900a1dc012884b012b4d0d255c1acc/marketing_campaign.py |
inv_amount_company_currency = invoice.move_id.amount | inv_amount_company_currency = 0 for aml in invoice.move_id.line_id: if aml.account_id.id == invoice.account_id.id or aml.account_id.type in ('receivable', 'payable'): inv_amount_company_currency += aml.debit inv_amount_company_currency -= aml.credit inv_amount_company_currency = abs(inv_amount_company_currency) | def _wo_check(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) invoice = pool.get('account.invoice').browse(cr, uid, data['id'], context) journal = pool.get('account.journal').browse(cr, uid, data['form']['journal_id'], context) cur_obj = pool.get('res.currency') # Here we need that: # The invoice total amount in company's currency <> paid amount in company currency # (according to the correct day rate, invoicing rate and payment rate are may be different) # => Ask to a write-off of the difference. This could happen even if both amount are equal, # because if the currency rate # Get the amount in company currency for the invoice (according to move lines) inv_amount_company_currency = invoice.move_id.amount | e5be0142c4e4a8caaf79687a87089a10e781f98c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e5be0142c4e4a8caaf79687a87089a10e781f98c/wizard_pay_invoice.py |
select min(pt.id) as id, a.name as project, sum(pt.remaining_hours) as remaining_hours, a.state, pu.uid from project_task as pt, project_project as p, account_analytic_account as a, project_user_rel as pu where pt.project_id=p.id and p.category_id = a.id and pu.project_id=p.id group by a.name,a.state,pu.uid | select min(pt.id) as id, aaa.name as project, CASE WHEN pu.uid is null THEN aaa.user_id ELSE pu.uid END as uid, sum(pt.remaining_hours) as remaining_hours, aaa.state from project_task pt left join project_project as pp ON (pt.project_id=pp.id) left join account_analytic_account as aaa ON (pp.category_id=aaa.id) left join project_user_rel as pu ON (pu.project_id=pp.id) where pt.create_uid=aaa.user_id group by aaa.name,aaa.state,pu.uid,aaa.user_id | def init(self, cr): tools.sql.drop_view_if_exists(cr, 'project_vs_remaining_hours') cr.execute(""" create or replace view project_vs_remaining_hours as ( select min(pt.id) as id, a.name as project, sum(pt.remaining_hours) as remaining_hours, a.state, pu.uid from project_task as pt, project_project as p, account_analytic_account as a, project_user_rel as pu where pt.project_id=p.id and p.category_id = a.id and pu.project_id=p.id group by a.name,a.state,pu.uid ) """) | d4a4ee06d7e670eb0600ea3d44507dd639bad859 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d4a4ee06d7e670eb0600ea3d44507dd639bad859/project_report.py |
result[id] = obj.datas[id][name] | result[id] = obj.datas[id].get(name, False) | def get_memory(self, cr, obj, ids, name, user=None, context=None, values=None): result = {} for id in ids: result[id] = obj.datas[id][name] return result | 71e504345d769fb2448585267d67fbe7f66e209d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/71e504345d769fb2448585267d67fbe7f66e209d/fields.py |
def set_context(self, objects, data, ids, report_type = None): | def set_context(self, objects, data, ids, report_type=None): | def set_context(self, objects, data, ids, report_type = None): new_ids = ids if (data['model'] == 'ir.ui.menu'): new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or [] objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids) self.query_get_clause = data['form']['query_line'] or '' super(journal_print, self).set_context(objects, data, new_ids, report_type) | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids) self.query_get_clause = data['form']['query_line'] or '' super(journal_print, self).set_context(objects, data, new_ids, report_type) | self.query_get_clause = 'AND ' self.query_get_clause += data['form']['query_line'] or '' self.sort_selection = data['form']['sort_selection'] objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids) self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),)) res = self.cr.fetchall() self.period_ids, self.journal_ids = zip(*res) return super(journal_print, self).set_context(objects, data, ids, report_type) | def set_context(self, objects, data, ids, report_type = None): new_ids = ids if (data['model'] == 'ir.ui.menu'): new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or [] objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids) self.query_get_clause = data['form']['query_line'] or '' super(journal_print, self).set_context(objects, data, new_ids, report_type) | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
def __init__(self, cr, uid, name, context={}): | def __init__(self, cr, uid, name, context=None): if context is None: context = {} | def __init__(self, cr, uid, name, context={}): super(journal_print, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines': self.lines, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, 'get_account': self.get_account }) | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
def lines(self, period_id, journal_id, sort_selection='date', *args): | def lines(self, period_id, journal_id=[]): | def lines(self, period_id, journal_id, sort_selection='date', *args): obj_jperiod = self.pool.get('account.journal.period') obj_mline = self.pool.get('account.move.line') self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal_id,period_id,'draft')) self.cr.commit() self.cr.execute('SELECT id FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s ORDER BY %s', (period_id, journal_id, sort_selection)) ids = map(lambda x: x[0], self.cr.fetchall()) return obj_mline.browse(self.cr, self.uid, ids) | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal_id,period_id,'draft')) | self.cr.execute('update account_journal_period set state=%s where journal_id IN %s and period_id=%s and state=%s', ('printed', self.journal_ids, period_id, 'draft')) | def lines(self, period_id, journal_id, sort_selection='date', *args): obj_jperiod = self.pool.get('account.journal.period') obj_mline = self.pool.get('account.move.line') self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal_id,period_id,'draft')) self.cr.commit() self.cr.execute('SELECT id FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s ORDER BY %s', (period_id, journal_id, sort_selection)) ids = map(lambda x: x[0], self.cr.fetchall()) return obj_mline.browse(self.cr, self.uid, ids) | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
self.cr.execute('SELECT id FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s ORDER BY %s', (period_id, journal_id, sort_selection)) | self.cr.execute('SELECT id FROM account_move_line l WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ' ORDER BY '+ self.sort_selection + '' ,(period_id, self.journal_ids )) | def lines(self, period_id, journal_id, sort_selection='date', *args): obj_jperiod = self.pool.get('account.journal.period') obj_mline = self.pool.get('account.move.line') self.cr.execute('update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s', ('printed',journal_id,period_id,'draft')) self.cr.commit() self.cr.execute('SELECT id FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s ORDER BY %s', (period_id, journal_id, sort_selection)) ids = map(lambda x: x[0], self.cr.fetchall()) return obj_mline.browse(self.cr, self.uid, ids) | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
def _sum_debit(self, period_id, journal_id): self.cr.execute('SELECT SUM(debit) FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s', (period_id, journal_id)) | def _sum_debit(self, period_id, journal_id=[]): self.cr.execute('SELECT SUM(debit) FROM account_move_line l WHERE period_id=%s AND journal_id IN %s '+ self.query_get_clause +'', (period_id, self.journal_ids)) | def _sum_debit(self, period_id, journal_id): self.cr.execute('SELECT SUM(debit) FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
def _sum_credit(self, period_id, journal_id): self.cr.execute('SELECT SUM(credit) FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s', (period_id, journal_id)) | def _sum_credit(self, period_id, journal_id=[]): self.cr.execute('SELECT SUM(credit) FROM account_move_line l WHERE period_id=%s AND journal_id IN %s '+ self.query_get_clause +'', (period_id, self.journal_ids)) | def _sum_credit(self, period_id, journal_id): self.cr.execute('SELECT SUM(credit) FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
def _sum_credit(self, period_id, journal_id): self.cr.execute('SELECT SUM(credit) FROM account_move_line l WHERE '+self.query_get_clause+' AND period_id=%s AND journal_id=%s', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
||
return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_from']).name | if 'period_from' in form and form['period_from']: return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_from']).name return '' | def get_start_period(self, form): return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_from']).name | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_to']).name | if 'period_to' in form and form['period_to']: return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_to']).name return '' | def get_end_period(self, form): return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_to']).name | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr,self.uid,form['chart_account_id']).name | if 'chart_account_id' in form and form['chart_account_id']: return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr,self.uid,form['chart_account_id']).name return '' | def get_account(self, form): return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr,self.uid,form['chart_account_id']).name | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
def get_account(self, form): return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr,self.uid,form['chart_account_id']).name | af7c1f1bbe12cb2d916d673dd7c4ab1da7072471 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/af7c1f1bbe12cb2d916d673dd7c4ab1da7072471/account_journal.py |
||
_description = "NOte Type" | _description = "Note Type" | def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None,\ toolbar=False, submenu=False): """ Overrides orm field_view_get. @return: Dictionary of Fields, arch and toolbar. """ | 6aa18c41c77d3c041436ca6877fe31a88e2c753a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6aa18c41c77d3c041436ca6877fe31a88e2c753a/board.py |
'share_root_url': lambda self, cr, uid, context, *a: context.get('share_root_url', _('Please specify "share_root_url" in server configuration or in context')), | 'share_root_url': lambda self, cr, uid, context, *a: context.get('share_root_url') or _('Please specify "share_root_url" in context'), | def generate_random_pass(): pass_chars = RANDOM_PASS_CHARACTERS[:] random.shuffle(pass_chars) return ''.join(pass_chars[0:10]) | 9566084f4588118ec566b80948d30dffa7f68415 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9566084f4588118ec566b80948d30dffa7f68415/share_wizard.py |
'audit':fields.boolean('Audit Complete ?', required=False), | 'audit': fields.related('move_id','to_check', type='boolean', relation='account.move', string='Audit Complete ?'), | def _get_currency(self, cr, uid, context): user = self.pool.get('res.users').browse(cr, uid, uid) if user.company_id: return user.company_id.currency_id.id else: return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0] | aede150c10fa6c95b52865953c6a910e20e68047 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aede150c10fa6c95b52865953c6a910e20e68047/voucher.py |
'amount':total, 'state':'proforma' | 'amount':total | def open_voucher(self, dbcr, uid, ids, context={}): cr = 0.0 dr = 0.0 total = 0.0 new_line = [] position_pool = self.pool.get('account.fiscal.position') voucher_pool = self.pool.get('account.voucher') voucher_line_pool = self.pool.get('account.voucher.line') partner_pool = self.pool.get('res.partner') tax_pool = self.pool.get('account.tax') | aede150c10fa6c95b52865953c6a910e20e68047 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aede150c10fa6c95b52865953c6a910e20e68047/voucher.py |
res[r[self._fields_id]].append(r['id']) | if r[self._fields_id] in res: res[r[self._fields_id]].append(r['id']) | def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} if self._context: context = context.copy() context.update(self._context) if not values: values = {} | 2d426ad6cef57dcf62cccf333d6ff8e1f66f1f67 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2d426ad6cef57dcf62cccf333d6ff8e1f66f1f67/fields.py |
description = email_last | description = case.email_last | def add_reply(self, cursor, user, ids, context=None): for case in self.browse(cursor, user, ids, context=context): if case.email_last: description = email_last self.write(cursor, user, case.id, { 'description': '> ' + description.replace('\n','\n> '), }, context=context) return True | 16f184db93c7ee55f73681177f5f4cb230f8c95b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/16f184db93c7ee55f73681177f5f4cb230f8c95b/crm.py |
""" Note /may/ be called with ndir_node = None, to rename the document root. """ | """ Move directory. This operation is simple, since the present node is only used for static, simple directories. Note /may/ be called with ndir_node = None, to rename the document root. """ | def move_to(self, cr, ndir_node, new_name=False, fil_obj=None, ndir_obj=None, in_write=False): | 3580708a49a60def7d61747274f7515047f344d3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3580708a49a60def7d61747274f7515047f344d3/nodes.py |
def move_to(self, cr, ndir_node, new_name=False, fil_obj=None, ndir_obj=None, in_write=False): | 3580708a49a60def7d61747274f7515047f344d3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3580708a49a60def7d61747274f7515047f344d3/nodes.py |
||
val = self.pool.get("ir.property").browse(cr, uid, prop_ids[0]).value | val = self.pool.get("ir.property").browse(cr, uid, prop_ids[0]).value_reference | def create_picking(self, cr, uid, ids, context={}): """Create a picking for each order and validate it.""" picking_obj = self.pool.get('stock.picking') | 5c1695e248ceeebf30dca9326b5795053141124d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5c1695e248ceeebf30dca9326b5795053141124d/pos.py |
stock_dest_id = int(val.split(',')[1]) | stock_dest_id = val.id | def create_picking(self, cr, uid, ids, context={}): """Create a picking for each order and validate it.""" picking_obj = self.pool.get('stock.picking') | 5c1695e248ceeebf30dca9326b5795053141124d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5c1695e248ceeebf30dca9326b5795053141124d/pos.py |
args['account_id'] = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id | args['account_id'] = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def.id or curr_c.account_receivable.id | args['account_id'] = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id | 5c1695e248ceeebf30dca9326b5795053141124d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5c1695e248ceeebf30dca9326b5795053141124d/pos.py |
order_account = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id | order_account = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def.id or curr_c.account_receivable.id | order_account = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id | 5c1695e248ceeebf30dca9326b5795053141124d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5c1695e248ceeebf30dca9326b5795053141124d/pos.py |
def price_get_multi_old(self, cr, uid, product_map, context=None): """multi products 'price_get' @param context: { 'date': Date of the pricelist (%Y-%m-%d), @return: a dict with product_id as key and the product price as value } """ def _create_parent_category_list(id, lst): if not id: return [] parent = product_category_tree.get(id) if parent: lst.append(parent) return _create_parent_category_list(parent, lst) else: return lst context = context or {} date = time.strftime('%Y-%m-%d') if 'date' in context: date = context['date'] currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') product_category_obj = self.pool.get('product.category') product_uom_obj = self.pool.get('product.uom') supplierinfo_obj = self.pool.get('product.supplierinfo') price_type_obj = self.pool.get('product.price.type') product_pricelist_version_obj = self.pool.get('product.pricelist.version') pricelist_version_ids = list(set([k[1] for k in product_map.keys()])) plversions_search_args = [ ('pricelist_id', 'in', pricelist_version_ids), '|', ('date_start', '=', False), ('date_start', '<=', date), '|', ('date_end', '=', False), ('date_end', '>=', date), ] plversion_ids = product_pricelist_version_obj.search(cr, uid, plversions_search_args) if len(pricelist_version_ids) != len(plversion_ids): msg = "At least one pricelist has no active version !\nPlease create or activate one." raise osv.except_osv(_('Warning !'), _(msg)) product_ids = list(set([k[0] for k in product_map.keys()])) products = dict([(item['id'], item) for item in product_obj.read(cr, uid, product_ids, ['categ_id', 'product_tmpl_id', 'uos_id', 'uom_id'])]) product_category_ids = product_category_obj.search(cr, uid, []) product_categories = product_category_obj.read(cr, uid, product_category_ids, ['parent_id']) product_category_tree = dict([(item['id'], item['parent_id'][0]) for item in product_categories if item['parent_id']]) results = {} for (product_id, pricelist_id), line in product_map.items(): price = False partner = line['partner_id'] qty = line['qty'] tmpl_id = products[product_id]['product_tmpl_id'] and products[product_id]['product_tmpl_id'][0] or False categ_id = products[product_id]['categ_id'] and products[product_id]['categ_id'][0] or False categ_ids = _create_parent_category_list(categ_id, [categ_id]) if categ_ids: categ_where = '(categ_id IN (' + ','.join(map(str, categ_ids)) + '))' else: categ_where = '(categ_id IS NULL)' cr.execute( 'SELECT i.*, pl.currency_id ' 'FROM product_pricelist_item AS i, ' 'product_pricelist_version AS v, product_pricelist AS pl ' 'WHERE (product_tmpl_id IS NULL OR product_tmpl_id = %s) ' 'AND (product_id IS NULL OR product_id = %s) ' 'AND (' + categ_where + ' OR (categ_id IS NULL)) ' 'AND price_version_id = %s ' 'AND (min_quantity IS NULL OR min_quantity <= %s) ' 'AND i.price_version_id = v.id AND v.pricelist_id = pl.id ' 'ORDER BY sequence', (tmpl_id, product_id, pricelist_id, qty)) res1 = cr.dictfetchall() for res in res1: if res: if res['base'] == -1: if not res['base_pricelist_id']: price = 0.0 else: price_tmp = self.price_get(cr, uid, [res['base_pricelist_id']], product_id, qty)[res['base_pricelist_id']] ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False) break elif res['base'] == -2: where = [] if partner: where = [('name', '=', partner) ] sinfo = supplierinfo_obj.search(cr, uid, [('product_id', '=', tmpl_id)] + where) price = 0.0 if sinfo: cr.execute('SELECT * ' \ 'FROM pricelist_partnerinfo ' \ 'WHERE suppinfo_id IN %s' \ 'AND min_quantity <= %s ' \ 'ORDER BY min_quantity DESC LIMIT 1', (tuple(sinfo),qty,)) res2 = cr.dictfetchone() if res2: price = res2['price'] break else: price_type = price_type_obj.browse(cr, uid, int(res['base'])) price = currency_obj.compute(cr, uid, price_type.currency_id.id, res['currency_id'], product_obj.price_get(cr, uid, [product_id], price_type.field)[product_id], round=False, context=context) if price: price_limit = price price = price * (1.0+(res['price_discount'] or 0.0)) price = rounding(price, res['price_round']) price += (res['price_surcharge'] or 0.0) if res['price_min_margin']: price = max(price, price_limit+res['price_min_margin']) if res['price_max_margin']: price = min(price, price_limit+res['price_max_margin']) break else: price = False if price: p_uom_id = products[product_id]['uos_id'] and products[product_id]['uos_id'][0] or products[product_id]['uom_id'] and products[product_id]['uom_id'][0] or False if p_uom_id: price = product_uom_obj._compute_price(cr, uid, p_uom_id, price, context.get('uom', False)) if results.get(product_id): results[product_id][pricelist_id] = price else: results[product_id] = {pricelist_id: price} return results | def price_get_multi_old(self, cr, uid, product_map, context=None): """multi products 'price_get' @param context: { 'date': Date of the pricelist (%Y-%m-%d), @return: a dict with product_id as key and the product price as value } """ | 1d78ae166ba2ab9323049a83a16e403e5cd4f91c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d78ae166ba2ab9323049a83a16e403e5cd4f91c/pricelist.py |
|
break | def _create_parent_category_list(id, lst): if not id: return [] parent = product_category_tree.get(id) if parent: lst.append(parent) return _create_parent_category_list(parent, lst) else: return lst | 1d78ae166ba2ab9323049a83a16e403e5cd4f91c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d78ae166ba2ab9323049a83a16e403e5cd4f91c/pricelist.py |
|
break | def _create_parent_category_list(id, lst): if not id: return [] parent = product_category_tree.get(id) if parent: lst.append(parent) return _create_parent_category_list(parent, lst) else: return lst | 1d78ae166ba2ab9323049a83a16e403e5cd4f91c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1d78ae166ba2ab9323049a83a16e403e5cd4f91c/pricelist.py |
|
def create_entries(self, cr, uid, ids, context=None): account_model_obj = self.pool.get('account.model') account_period_obj = self.pool.get('account.period') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') mod_obj = self.pool.get('ir.model.data') if context is None: context = {} | d0ff4985386b3b20c754b8446aa15a4f25a03c70 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d0ff4985386b3b20c754b8446aa15a4f25a03c70/account_use_model.py |
||
context2=context.copy() | context2 = context.copy() | def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') analytic_account_obj = self.pool.get('account.analytic.account') res_partner_obj = self.pool.get('res.partner') account_payment_term_obj = self.pool.get('account.payment.term') invoices = [] | f46f7a770b2d814434573b77e25d0d05332000c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f46f7a770b2d814434573b77e25d0d05332000c7/hr_timesheet_invoice_create.py |
cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id IN %s AND product_id=%s and to_invoice=%s", (account.id, tuple(data['ids']), product_id, factor_id)) | cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id IN %s AND product_id=%s and to_invoice=%s ORDER BY account_analytic_line.date", (account.id, tuple(data['ids']), product_id, factor_id)) | def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') analytic_account_obj = self.pool.get('account.analytic.account') res_partner_obj = self.pool.get('res.partner') account_payment_term_obj = self.pool.get('account.payment.term') invoices = [] | f46f7a770b2d814434573b77e25d0d05332000c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f46f7a770b2d814434573b77e25d0d05332000c7/hr_timesheet_invoice_create.py |
details.append("%s %s" % (line['unit_amount'], self.pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name)) | details.append("%s %s" % (line['unit_amount'], self.pool.get('product.uom').browse(cr, uid, [line['product_uom_id']],context2)[0].name)) | def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') analytic_account_obj = self.pool.get('account.analytic.account') res_partner_obj = self.pool.get('res.partner') account_payment_term_obj = self.pool.get('account.payment.term') invoices = [] | f46f7a770b2d814434573b77e25d0d05332000c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f46f7a770b2d814434573b77e25d0d05332000c7/hr_timesheet_invoice_create.py |
urls.append(dict(url=url, tag=str(link), title=title)) html = soup.__str__() | urls.append(dict(url=ustr(url), tag=ustr(link), title=ustr(title))) html = ustr(soup.__str__()) | def html2plaintext(html, body_id=None, encoding='utf-8'): ## (c) Fry-IT, www.fry-it.com, 2007 ## <[email protected]> ## download here: http://www.peterbe.com/plog/html2plaintext """ from an HTML text, convert the HTML to plain text. If @body_id is provided then this is the tag where the body (not necessarily <body>) starts. """ try: from BeautifulSoup import BeautifulSoup, SoupStrainer, Comment except: return html urls = [] if body_id is not None: strainer = SoupStrainer(id=body_id) else: strainer = SoupStrainer('body') soup = BeautifulSoup(html, parseOnlyThese=strainer, fromEncoding=encoding) for link in soup.findAll('a'): title = link.renderContents() for url in [x[1] for x in link.attrs if x[0]=='href']: urls.append(dict(url=url, tag=str(link), title=title)) html = soup.__str__() url_index = [] i = 0 for d in urls: if d['title'] == d['url'] or 'http://'+d['title'] == d['url']: html = html.replace(d['tag'], d['url']) else: i += 1 html = html.replace(d['tag'], '%s [%s]' % (d['title'], i)) url_index.append(d['url']) html = html.replace('<strong>','*').replace('</strong>','*') html = html.replace('<b>','*').replace('</b>','*') html = html.replace('<h3>','*').replace('</h3>','*') html = html.replace('<h2>','**').replace('</h2>','**') html = html.replace('<h1>','**').replace('</h1>','**') html = html.replace('<em>','/').replace('</em>','/') # the only line breaks we respect is those of ending tags and # breaks html = html.replace('\n',' ') html = html.replace('<br>', '\n') html = html.replace('<tr>', '\n') html = html.replace('</p>', '\n\n') html = re.sub('<br\s*/>', '\n', html) html = html.replace(' ' * 2, ' ') # for all other tags we failed to clean up, just remove then and # complain about them on the stderr def desperate_fixer(g): #print >>sys.stderr, "failed to clean up %s" % str(g.group()) return ' ' html = re.sub('<.*?>', desperate_fixer, html) # lstrip all lines html = '\n'.join([x.lstrip() for x in html.splitlines()]) for i, url in enumerate(url_index): if i == 0: html += '\n\n' html += '[%s] %s\n' % (i+1, url) return html | acd4c9b04d186a5f448a9c4de0b1f77c730dad18 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/acd4c9b04d186a5f448a9c4de0b1f77c730dad18/misc.py |
html += '[%s] %s\n' % (i+1, url) | html += ustr('[%s] %s\n') % (i+1, url) | def desperate_fixer(g): #print >>sys.stderr, "failed to clean up %s" % str(g.group()) return ' ' | acd4c9b04d186a5f448a9c4de0b1f77c730dad18 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/acd4c9b04d186a5f448a9c4de0b1f77c730dad18/misc.py |
html = body_mako_tpl.render( helper=helper, css=css, _=self.translate_call, **self.parser_instance.localcontext ) | try : html = body_mako_tpl.render( helper=helper, css=css, _=self.translate_call, **self.parser_instance.localcontext ) except : raise Exception(exceptions.html_error_template().render()) | def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" if context is None: context={} if report_xml.report_type != 'webkit': return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context) | cdaef22f14104878cf21aba391c444cfe83e1abb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cdaef22f14104878cf21aba391c444cfe83e1abb/webkit_report.py |
head = head_mako_tpl.render( company=company, time=time, helper=helper, css=css, formatLang=self.formatLang, setLang=self.setLang, _=self.translate_call, _debug=False ) | try : head = head_mako_tpl.render( company=company, time=time, helper=helper, css=css, formatLang=self.formatLang, setLang=self.setLang, _=self.translate_call, _debug=False ) except : raise Exception(exceptions.html_error_template().render()) | def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" if context is None: context={} if report_xml.report_type != 'webkit': return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context) | cdaef22f14104878cf21aba391c444cfe83e1abb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cdaef22f14104878cf21aba391c444cfe83e1abb/webkit_report.py |
foot = foot_mako_tpl.render( company=company, time=time, helper=helper, css=css, formatLang=self.formatLang, setLang=self.setLang, _=self.translate_call, ) | try : foot = foot_mako_tpl.render( company=company, time=time, helper=helper, css=css, formatLang=self.formatLang, setLang=self.setLang, _=self.translate_call, ) except: raise Exception(exceptions.html_error_template().render()) | def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" if context is None: context={} if report_xml.report_type != 'webkit': return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context) | cdaef22f14104878cf21aba391c444cfe83e1abb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cdaef22f14104878cf21aba391c444cfe83e1abb/webkit_report.py |
deb = head_mako_tpl.render( company=company, time=time, helper=helper, css=css, _debug=html, formatLang=self.formatLang, setLang=self.setLang, _=self.translate_call, ) | try : deb = head_mako_tpl.render( company=company, time=time, helper=helper, css=css, _debug=html, formatLang=self.formatLang, setLang=self.setLang, _=self.translate_call, ) except : raise Exception(exceptions.html_error_template().render()) | def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" if context is None: context={} if report_xml.report_type != 'webkit': return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context) | cdaef22f14104878cf21aba391c444cfe83e1abb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cdaef22f14104878cf21aba391c444cfe83e1abb/webkit_report.py |
'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', string='Salesman'), | 'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', store=True, string='Salesman'), | def _number_packages(self, cr, uid, ids, field_name, arg, context=None): if context is None: context = {} res = {} for line in self.browse(cr, uid, ids, context=context): try: res[line.id] = int((line.product_uom_qty+line.product_packaging.qty-0.0001) / line.product_packaging.qty) except: res[line.id] = 1 return res | ce1481d3d80c62bfb244a22a617e3a573439c917 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ce1481d3d80c62bfb244a22a617e3a573439c917/sale.py |
for file in self.browse(cr, uid, ids): | for file in self.browse(cr, uid, ids): | def _check_duplication(self, cr, uid, vals, ids=[], op='create'): name = vals.get('name', False) parent_id = vals.get('parent_id', False) res_model = vals.get('res_model', False) res_id = vals.get('res_id', 0) if op == 'write': for file in self.browse(cr, uid, ids): if not name: name = file.name if not parent_id: parent_id = file.parent_id and file.parent_id.id or False if not res_model: res_model = file.res_model and file.res_model or False if not res_id: res_id = file.res_id and file.res_id or 0 res = self.search(cr, uid, [('id', '<>', file.id), ('name', '=', name), ('parent_id', '=', parent_id), ('res_model', '=', res_model), ('res_id', '=', res_id)]) if len(res): return False if op == 'create': res = self.search(cr, uid, [('name', '=', name), ('parent_id', '=', parent_id), ('res_id', '=', res_id), ('res_model', '=', res_model)]) if len(res): return False return True | 530932640babacde4973fd47f2a9632c1d70bd3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/530932640babacde4973fd47f2a9632c1d70bd3d/document.py |
if fbro.parent_id != vals['parent_id']: | if fbro.parent_id.id != vals['parent_id']: | def write(self, cr, uid, ids, vals, context=None): if not isinstance(ids, list): ids = [ids] res = self.search(cr, uid, [('id', 'in', ids)]) if not len(res): return False if not self._check_duplication(cr, uid, vals, ids, 'write'): raise osv.except_osv(_('ValidateError'), _('File name must be unique!')) if 'parent_id' in vals: # perhaps this file is changing directory nctx = nodes.get_node_context(cr,uid,context) dirobj = self.pool.get('document.directory') dbro = dirobj.browse(cr, uid, vals['parent_id'], context=context) ids2 = [] result = False for fbro in self.browse(cr, uid, ids, context=context): if fbro.parent_id != vals['parent_id']: fnode = nodes.node_file(None,None,nctx,fbro) res = fnode.move_to(cr, fbro, dbro, True) if isinstance(res, dict): vals2 = vals.copy() vals2.update(res) wid = res.get('id', fbro.id) result = super(document_file,self).write(cr,uid,wid,vals2,context=context) # TODO: how to handle/merge several results? elif res == True: ids2.append(fbro.id) elif res == False: pass ids = ids2 if len(ids): result = super(document_file,self).write(cr, uid, ids, vals, context=context) cr.commit() return result | 530932640babacde4973fd47f2a9632c1d70bd3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/530932640babacde4973fd47f2a9632c1d70bd3d/document.py |
t.type, | t.type_id, | def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task_user') cr.execute(""" CREATE view report_project_task_user as SELECT (select 1 ) AS nbr, t.id as id, to_char(date_start, 'YYYY') as year, to_char(date_start, 'MM') as month, to_char(date_start, 'YYYY-MM-DD') as day, date_trunc('day',t.date_start) as date_start, date_trunc('day',t.date_end) as date_end, to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_deadline, | 233223b2a5102d950d6803b118283109f97dbb94 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/233223b2a5102d950d6803b118283109f97dbb94/project_report.py |
t.type | t.type_id | def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task_user') cr.execute(""" CREATE view report_project_task_user as SELECT (select 1 ) AS nbr, t.id as id, to_char(date_start, 'YYYY') as year, to_char(date_start, 'MM') as month, to_char(date_start, 'YYYY-MM-DD') as day, date_trunc('day',t.date_start) as date_start, date_trunc('day',t.date_end) as date_end, to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_deadline, | 233223b2a5102d950d6803b118283109f97dbb94 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/233223b2a5102d950d6803b118283109f97dbb94/project_report.py |
def onchange_type(self, cr, uid, ids, type, currency): | def onchange_type(self, cr, uid, ids, type, currency, context=None): | def onchange_type(self, cr, uid, ids, type, currency): obj_data = self.pool.get('ir.model.data') user_pool = self.pool.get('res.users') | 333f5b21c26f5547ebf8e53e16de2ce8c145bbf8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/333f5b21c26f5547ebf8e53e16de2ce8c145bbf8/account.py |
def onchange_type(self, cr, uid, ids, type, currency): obj_data = self.pool.get('ir.model.data') user_pool = self.pool.get('res.users') | 333f5b21c26f5547ebf8e53e16de2ce8c145bbf8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/333f5b21c26f5547ebf8e53e16de2ce8c145bbf8/account.py |
||
new_ids = ids | new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or [] | def set_context(self, objects, data, ids, report_type = None): ## self.borne_date = self.get_min_date(data['form']) ## new_ids = [] if (data['model'] == 'account.account'): new_ids = ids else: new_ids.append(data['form']['Account_list']) | 84830accf59d5cada276919684fe767f46a1eb70 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/84830accf59d5cada276919684fe767f46a1eb70/general_ledger.py |
cr.sql_log=1 | def __init__(self, cr, uid, name, context): super(general_ledger, self).__init__(cr, uid, name, context=context) cr.sql_log=1 self.date_borne = {} self.query = "" self.child_ids = "" self.tot_currency = 0.0 self.period_sql = "" self.sold_accounts = {} self.localcontext.update( { 'time': time, 'lines': self.lines, 'sum_debit_account': self._sum_debit_account, 'sum_credit_account': self._sum_credit_account, 'sum_solde_account': self._sum_solde_account, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'sum_solde': self._sum_solde, 'get_children_accounts': self.get_children_accounts, 'sum_currency_amount_account': self._sum_currency_amount_account }) self.context = context | 84830accf59d5cada276919684fe767f46a1eb70 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/84830accf59d5cada276919684fe767f46a1eb70/general_ledger.py |
|
total_fixed = (total_fixed * 100) / inv.amount_total | total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0) | def action_move_create(self, cr, uid, ids, *args): """Creates invoice related analytics and financial move lines""" ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') context = {} for inv in self.browse(cr, uid, ids): if not inv.journal_id.sequence_id: raise osv.except_osv(_('Error !'), _('Please define sequence on invoice journal')) if not inv.invoice_line: raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.')) if inv.move_id: continue | 396c02cf429f49e16fb7ce87aa3b3f70f5ba824b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/396c02cf429f49e16fb7ce87aa3b3f70f5ba824b/invoice.py |
if res: return res[0] else: return False | return res and res[0] or False | def _get_def_cparent(self, cr, uid, context): acc_obj=self.pool.get('account.account') tmpl_obj=self.pool.get('account.account.template') #print "Searching for ",context tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']],['parent_id']) if not tids or not tids[0]['parent_id']: return False ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]],['code']) if not ptids or not ptids[0]['code']: raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!')) res = acc_obj.search(cr,uid,[('code','=',ptids[0]['code'])]) if res: return res[0] else: return False | d497f5c6e979971f6221480b3578714f0b07ee72 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d497f5c6e979971f6221480b3578714f0b07ee72/account.py |
getattr(socket, 'SHUT_RDWR', 2) | getattr(socket, 'SHUT_RDWR', 2)) | def stop(self): self.running = False if os.name != 'nt': try: self.server.socket.shutdown( getattr(socket, 'SHUT_RDWR', 2) except socket.error, e: if e.errno != 57: raise # OSX, socket shutdowns both sides if any side closes it # causing an error 57 'Socket is not connected' on shutdown # of the other side (or something), see # http://bugs.python.org/issue4397 netsvc.Logger().notifyChannel( 'server', netsvc.LOG_DEBUG, '"%s" when shutting down server socket, ' 'this is normal under OS X'%e) self.server.socket.close() | 0f27fbeb51d4d0a9200696604634f0363708b394 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0f27fbeb51d4d0a9200696604634f0363708b394/http_server.py |
fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout return _to_unicode(fp.read()) | pop = Popen(['antiword', fname], shell=False, stdout=PIPE) (data, _) = pop.communicate() return _to_unicode(data) | def _doIndexFile(self,fname): fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout return _to_unicode(fp.read()) | f551479a9bd379204197947dbcbaac04972eb7ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f551479a9bd379204197947dbcbaac04972eb7ba/std_index.py |
fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout return _to_unicode( fp.read()) | pop = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE) (data, _) = pop.communicate() return _to_unicode(data) | def _doIndexFile(self,fname): fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout return _to_unicode( fp.read()) | f551479a9bd379204197947dbcbaac04972eb7ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f551479a9bd379204197947dbcbaac04972eb7ba/std_index.py |
if curr_id: | if curr_id and company_id: | def onchange_currency_id(self, cr, uid, ids, curr_id, company_id): if curr_id: currency = self.pool.get('res.currency').browse(cr, uid, curr_id) if currency.company_id.id != company_id: raise osv.except_osv(_('Configration Error !'), _('Can not select currency that is not related to current company.\nPlease select accordingly !.')) return {} | 5d62f3debfa1ad3f816f9ef2a562589d2cd59b52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5d62f3debfa1ad3f816f9ef2a562589d2cd59b52/invoice.py |
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line): | def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): | def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line): val={} dom={} 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: rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) pay_pro_id = self.pool.get('ir.property').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 = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)]) if not pay_pro_id: pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = self.pool.get('ir.property').read(cr,uid,rec_pro_id,['name','value','res_id']) pay_line_data = self.pool.get('ir.property').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 rec_res_id: raise osv.except_osv(_('Configration 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} 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 = self.pool.get('account.account').search(cr,uid,[('name','=',line.account_id.name),('company_id','=',company_id)]) if not result_id: raise osv.except_osv(_('Configration 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 = self.pool.get('account.account').browse(cr,uid,inv_line[2]['account_id']) if obj_l.company_id.id != company_id: raise osv.except_osv(_('Configration Error !'), _('invoice line account company is not match with invoice company.')) else: continue if company_id: val['journal_id']=False journal_ids=self.pool.get('account.journal').search(cr,uid,[('company_id','=',company_id)]) dom={'journal_id': [('id','in',journal_ids)]} else: journal_ids=self.pool.get('account.journal').search(cr,uid,[]) dom={'journal_id': [('id','in',journal_ids)]} return {'value' : val, 'domain': dom } | 5d62f3debfa1ad3f816f9ef2a562589d2cd59b52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5d62f3debfa1ad3f816f9ef2a562589d2cd59b52/invoice.py |
period_obj = self.pool.get('account.period') | def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]): | 308981d14e239ae74e0d59514fc7117ce3457267 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/308981d14e239ae74e0d59514fc7117ce3457267/account_move_line.py |
|
data_res_id = _get_id(model_name, line[i], current_module, 'id') | try: data_res_id = _get_id(model_name, line[i], current_module, 'id') except ValueError, e: pass xml_id = line[i] | def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0, skip=0): line = datas[position] row = {} warning = [] data_res_id = False nbrmax = position+1 | 21b9caa46b03594f484dc2233bc0a5c93c706cf5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/21b9caa46b03594f484dc2233bc0a5c93c706cf5/orm.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.