rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if inv.type in ('sale'): | if inv.type in ('sale', 'receipt'): | def action_move_line_create(self, cr, uid, ids, *args): journal_pool = self.pool.get('account.journal') sequence_pool = self.pool.get('ir.sequence') move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') analytic_pool = self.pool.get('account.analytic.line') currency_pool = self.pool.get('res.currency') invoice_pool = self.pool.get('account.invoice') for inv in self.browse(cr, uid, ids): if inv.move_id: continue | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' } | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
||
'date_original': fields.date('Date', readonly="1"), 'date_due': fields.date('Due Date', readonly="1"), | 'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly="1"), 'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly="1"), | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' } | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
'amount_unreconciled': fields.float('Open Balance', readonly="1"), | 'amount_unreconciled': fields.related('move_line_id','balance', type='float', relation='account.move.line', string='Open Balance', readonly="1"), | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' } | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
'type': lambda *a: 'cr' | 'type': lambda *a: 'cr', 'name': lambda *a: 'Payment' | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' } | 5e56a23f983ef8307bea7ad99f730bb7aee1eb09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5e56a23f983ef8307bea7ad99f730bb7aee1eb09/voucher.py |
pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial) | result, rows, warning_msg, dummy = pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial) if result < 0: raise except_orm(_('Module loading failed'), _('Loading %s/%s failed:\n %s') % (module, fname, warning_msg)) | def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', noupdate=False): '''Import csv file : quote: " delimiter: , encoding: utf-8''' if not idref: idref={} logger = logging.getLogger('init') model = ('.'.join(fname.split('.')[:-1]).split('-'))[0] #remove folder path from model head, model = os.path.split(model) pool = pooler.get_pool(cr.dbname) input = cStringIO.StringIO(csvcontent) #FIXME reader = csv.reader(input, quotechar='"', delimiter=',') fields = reader.next() fname_partial = "" if config.get('import_partial'): fname_partial = module + '/'+ fname if not os.path.isfile(config.get('import_partial')): pickle.dump({}, file(config.get('import_partial'),'w+')) else: data = pickle.load(file(config.get('import_partial'))) if fname_partial in data: if not data[fname_partial]: return else: for i in range(data[fname_partial]): reader.next() if not (mode == 'init' or 'id' in fields): logger.error("Import specification does not contain 'id' and we are in init mode, Cannot continue.") return uid = 1 datas = [] for line in reader: if (not line) or not reduce(lambda x,y: x or y, line) : continue try: datas.append(map(lambda x: misc.ustr(x), line)) except: logger.error("Cannot import the line: %s", line) pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial) if config.get('import_partial'): data = pickle.load(file(config.get('import_partial'))) data[fname_partial] = 0 pickle.dump(data, file(config.get('import_partial'),'wb')) cr.commit() | 12ba501178e56235ae7b2016378a47fdf2c0c2ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/12ba501178e56235ae7b2016378a47fdf2c0c2ac/convert.py |
'name': case.partner_name or case.name, | 'name': case.partner_contact or case.name, | def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data['form']['action'] == 'create': partner_id = partner_obj.create(cr, uid, { 'name': case.partner_name or case.name, 'user_id': case.user_id.id, 'comment': case.description, }) contact_id = contact_obj.create(cr, uid, { 'partner_id': partner_id, 'name': case.name, 'phone': case.phone, 'mobile': case.mobile, 'email': case.email_from }) | 4b8f2856ef4f7fb58a202ae0a11c9b97d61ccb40 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4b8f2856ef4f7fb58a202ae0a11c9b97d61ccb40/crm_phonecall_wizard.py |
'phone': case.phone, 'mobile': case.mobile, | 'phone': case.partner_phone, 'mobile': case.partner_mobile, | def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data['form']['action'] == 'create': partner_id = partner_obj.create(cr, uid, { 'name': case.partner_name or case.name, 'user_id': case.user_id.id, 'comment': case.description, }) contact_id = contact_obj.create(cr, uid, { 'partner_id': partner_id, 'name': case.name, 'phone': case.phone, 'mobile': case.mobile, 'email': case.email_from }) | 4b8f2856ef4f7fb58a202ae0a11c9b97d61ccb40 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4b8f2856ef4f7fb58a202ae0a11c9b97d61ccb40/crm_phonecall_wizard.py |
inv_line['account_id'] = acc | def action_invoice(self, cr, uid, ids, context=None): """Create a invoice of order """ inv_ref = self.pool.get('account.invoice') inv_line_ref = self.pool.get('account.invoice.line') product_obj = self.pool.get('product.product') inv_ids = [] | 53b327827b9dd02d3762ae3b9bf1deb8bf9ac543 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/53b327827b9dd02d3762ae3b9bf1deb8bf9ac543/point_of_sale.py |
|
right = map(lambda x: x[0], res_ids) self.__exp[i] = (left, 'in', right) | if not res_ids: self.__exp[i] = ('id','=',0) else: right = map(lambda x: x[0], res_ids) self.__exp[i] = (left, 'in', right) | def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type) | 220517082345862716e388ed9e7557c33e105db0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/220517082345862716e388ed9e7557c33e105db0/expression.py |
res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] + funct )) | res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] + funct)) | def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] res = [] for r in self.browse(cr, uid, ids): funct = r.function_id and (", " + r.function_id.name) or "" res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] + funct )) return res | b1643c7af602f7724e87867569ca047669d45d20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b1643c7af602f7724e87867569ca047669d45d20/base_contact.py |
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): job_ids = [] | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count) | b1643c7af602f7724e87867569ca047669d45d20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b1643c7af602f7724e87867569ca047669d45d20/base_contact.py |
if arg[0]=='address_id': | if arg[0] == 'address_id': | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count) | b1643c7af602f7724e87867569ca047669d45d20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b1643c7af602f7724e87867569ca047669d45d20/base_contact.py |
if arg[0]=='contact_id': | elif arg[0] == 'contact_id': | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count) | b1643c7af602f7724e87867569ca047669d45d20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b1643c7af602f7724e87867569ca047669d45d20/base_contact.py |
return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count) | elif arg[0] == 'name': contact_obj = self.pool.get('res.partner.contact') search_arg = ['|', ('first_name', 'ilike', arg[2]), ('name', 'ilike', arg[2])] contact_ids = contact_obj.search(cr, user, search_arg, offset=offset, limit=limit, order=order, context=context, count=count) contacts = contact_obj.browse(cr, user, contact_ids, context=context) for contact in contacts: job_ids.extend([item.id for item in contact.job_ids]) res = super(res_partner_job,self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) if job_ids: res = list(set(res + job_ids)) return res | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count) | b1643c7af602f7724e87867569ca047669d45d20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b1643c7af602f7724e87867569ca047669d45d20/base_contact.py |
class many2many_domain(fields.many2many): def set(self, cr, obj, id, name, values, user=None, context=None): return super(many2many_domain, self).set(cr, obj, id, name, values, user=user, context=context) def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} move_obj = obj.pool.get('stock.move') res = {} for i in ids: res[i] = [] valid_move_ids = move_obj.search(cr, user, self._domain) if valid_move_ids: cr.execute("SELECT production_id, move_id from mrp_production_move_ids where production_id in %s and move_id in %s", [tuple(ids), tuple(valid_move_ids)]) related_move_map = cr.fetchall() related_move_dict = dict((k, list(set([v[1] for v in itr]))) for k, itr in groupby(related_move_map, itemgetter(0))) res.update(related_move_dict) return res class one2many_domain(fields.one2many): def set(self, cr, obj, id, field, values, user=None, context=None): return super(one2many_domain, self).set(cr, obj, id, field, values, user=user, context=context) def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} move_obj = obj.pool.get('stock.move') res = {} for i in ids: res[i] = [] move_ids = move_obj.search(cr, user, self._domain+[('production_id', 'in', tuple(ids))], context=context) related_move_dict = dict([(o.production_id.id, [o.id]) for o in move_obj.browse(cr, user, move_ids, context=context)]) res.update(related_move_dict) return res | def rounding(f, r): if not r: return f return round(f / r) * r | 9475077629755339394a61202454fc340cc48478 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9475077629755339394a61202454fc340cc48478/mrp.py |
|
'move_lines': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), 'move_lines2': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed Products', domain=[('state','in', ('done', 'cancel'))]), 'move_created_ids': one2many_domain('stock.move', 'production_id', 'Moves Created', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), 'move_created_ids2': one2many_domain('stock.move', 'production_id', 'Moves Created', domain=[('state','in', ('done', 'cancel'))]), | 'move_lines': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), 'move_lines2': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed Products', domain=[('state','in', ('done', 'cancel'))]), 'move_created_ids': fields.one2many('stock.move', 'production_id', 'Moves Created', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), 'move_created_ids2': fields.one2many('stock.move', 'production_id', 'Moves Created', domain=[('state','in', ('done', 'cancel'))]), | def _production_date(self, cr, uid, ids, prop, unknow_none, context={}): """ Finds production planned date. @param prop: Name of field. @param unknow_none: @return: Dictionary of values. """ result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = prod.date_planned[:10] return result | 9475077629755339394a61202454fc340cc48478 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9475077629755339394a61202454fc340cc48478/mrp.py |
def _check_dates(self, cr, uid, ids, context=None): task = self.read(cr, uid, ids[0], ['date_start', 'date_end']) if task['date_start'] and task['date_end']: if task['date_start'] > task['date_end']: return False return True | 6ba2fbc74afcd6a987e27508c61d2a566a8b85b5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6ba2fbc74afcd6a987e27508c61d2a566a8b85b5/project.py |
||
(_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']) | (_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']), (_check_recursion, _('Error ! You cannot create recursive tasks.'), ['parent_ids']) | def _is_template(self, cr, uid, ids, field_name, arg, context=None): res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = True if task.project_id: if task.project_id.active == False or task.project_id.state == 'template': res[task.id] = False return res | 6ba2fbc74afcd6a987e27508c61d2a566a8b85b5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6ba2fbc74afcd6a987e27508c61d2a566a8b85b5/project.py |
except Exception: | except Exception, e: | def get_childs(self, uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get childs: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True) | 732ca8b5cf9b0108d13de83a5d9267d77f62f275 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/732ca8b5cf9b0108d13de83a5d9267d77f62f275/dav_fs.py |
tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) | tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = self.pool.get('ir.model.access') if (res['type'] == 'search') and access_pool.check_groups(cr, uid, "project_gtd.group_project_getting"): tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) search_extended ='''<newline/><group col="%d" expand="%d" string="%s">''' % (len(tt)+7,1,_('Getting Things Done')) search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),) search_extended += '''<filter context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Getting things done" string="%s"/>''' % (_('GTD'),) search_extended += '''<separator orientation="vertical"/>''' for time in tt: if time.icon: icon = time.icon else : icon="" search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'gtd_visible':True, 'user_invisible': True}"/>''' search_extended += ''' <separator orientation="vertical"/> <field name="context_id" select="1" widget="selection"/> </group> </search> ''' if search_extended: res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended) attrs_sel = self.pool.get('project.gtd.context').name_search(cr, uid, '', [], context=context) context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id']) context_id_info['context_id']['selection'] = attrs_sel res['fields'].update(context_id_info) return res | 52e91e76204d4fbbf8d07dda160212bf5f2eb648 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/52e91e76204d4fbbf8d07dda160212bf5f2eb648/project_gtd.py |
context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id']) | context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id'], context=context) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = self.pool.get('ir.model.access') if (res['type'] == 'search') and access_pool.check_groups(cr, uid, "project_gtd.group_project_getting"): tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) search_extended ='''<newline/><group col="%d" expand="%d" string="%s">''' % (len(tt)+7,1,_('Getting Things Done')) search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),) search_extended += '''<filter context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Getting things done" string="%s"/>''' % (_('GTD'),) search_extended += '''<separator orientation="vertical"/>''' for time in tt: if time.icon: icon = time.icon else : icon="" search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'gtd_visible':True, 'user_invisible': True}"/>''' search_extended += ''' <separator orientation="vertical"/> <field name="context_id" select="1" widget="selection"/> </group> </search> ''' if search_extended: res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended) attrs_sel = self.pool.get('project.gtd.context').name_search(cr, uid, '', [], context=context) context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id']) context_id_info['context_id']['selection'] = attrs_sel res['fields'].update(context_id_info) return res | 52e91e76204d4fbbf8d07dda160212bf5f2eb648 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/52e91e76204d4fbbf8d07dda160212bf5f2eb648/project_gtd.py |
report_sxw.report_sxw('report.account.journal.period.print.wiz', 'account.journal.period', 'addons/account/report/wizard_account_journal.rml', parser=journal_print, header=False) | def _sum_credit(self, period_id, journal_id): self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 | 84087f97b91ff4e3c9bd0d44d13cb800f85d5cf9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/84087f97b91ff4e3c9bd0d44d13cb800f85d5cf9/account_journal.py |
|
value = { | value = { | def open_wiki_page(self, cr, uid, ids, context): | f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a/wiki.py |
def copy_data(self, cr, uid, id, default=None, context=None): | f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a/wiki.py |
||
def create_history(self, cr, uid, ids, vals, context=None): history_id = False history = self.pool.get('wiki.wiki.history') if vals.get('text_area'): res = { 'minor_edit': vals.get('minor_edit', True), 'text_area': vals.get('text_area', ''), 'write_uid': uid, 'wiki_id': ids[0], 'summary':vals.get('summary', '') } history_id = history.create(cr, uid, res) return history_id | f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a/wiki.py |
||
id = super(Wiki, self).create(cr, uid, vals, context) | id = super(wiki_wiki2, self).create(cr, uid, vals, context) | def create(self, cr, uid, vals, context=None): | f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a/wiki.py |
result = super(Wiki, self).write(cr, uid, ids, vals, context) | result = super(wiki_wiki2, self).write(cr, uid, ids, vals, context) | def write(self, cr, uid, ids, vals, context=None): | f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f60ec8bc68c45657c8ab2fca93a3a6b01de0f75a/wiki.py |
self.query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) | self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) | def set_context(self, objects, data, ids, report_type=None): new_ids = ids obj_move = self.pool.get('account.move.line') self.sortby = data['form'].get('sortby', 'sort_date') self.query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) self.init_balance = data['form']['initial_balance'] self.display_account = data['form']['display_account'] self.target_move = data['form'].get('target_move', 'all') ctx = self.context.copy() ctx['fiscalyear'] = data['form']['fiscalyear_id'] if data['form']['filter'] == 'filter_period': ctx['periods'] = data['form']['periods'] elif data['form']['filter'] == 'filter_date': ctx['date_from'] = data['form']['date_from'] ctx['date_to'] = data['form']['date_to'] ctx['state'] = data['form']['target_move'] self.context.update(ctx) if (data['model'] == 'ir.ui.menu'): new_ids = [data['form']['chart_account_id']] objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) return super(general_ledger, self).set_context(objects, data, new_ids, report_type=report_type) | 5c4592ba23d4057ad0143ee7a84d0acb93ba88ad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5c4592ba23d4057ad0143ee7a84d0acb93ba88ad/account_general_ledger.py |
AND s.user_id = e.user_id) \ | AND s.user_id = r.user_id) \ | def _sheet(self, cursor, user, ids, name, args, context): sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') cursor.execute("SELECT a.id, COALESCE(MAX(s.id), 0) \ FROM hr_timesheet_sheet_sheet s \ LEFT JOIN (hr_attendance a \ LEFT JOIN hr_employee e \ ON (a.employee_id = e.id)) \ ON (s.date_to >= date_trunc('day',a.name) \ AND s.date_from <= a.name \ AND s.user_id = e.user_id) \ WHERE a.id in (" + ",".join([str(x) for x in ids]) + ") \ GROUP BY a.id") res = dict(cursor.fetchall()) sheet_names = {} for sheet_id, name in sheet_obj.name_get(cursor, user, res.values(), context=context): sheet_names[sheet_id] = name for line_id in {}.fromkeys(ids): sheet_id = res.get(line_id, False) if sheet_id: res[line_id] = (sheet_id, sheet_names[sheet_id]) else: res[line_id] = False return res | 404bf5ca1ac193cae02fe0b0397ef20d283c3a5a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/404bf5ca1ac193cae02fe0b0397ef20d283c3a5a/hr_timesheet_sheet.py |
if new[c2][2]==c[2]: | if new[c2][2]==c[2] and new[c2][0]==c[0]: | def createInstance(cls, pool, module, cr): parent_names = getattr(cls, '_inherit', None) if parent_names: if isinstance(parent_names, (str, unicode)): name = cls._name or parent_names parent_names = [parent_names] else: name = cls._name if not name: raise TypeError('_name is mandatory in case of multiple inheritance') | ee6e52fac75f277f675c12c0476127afa5439691 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ee6e52fac75f277f675c12c0476127afa5439691/osv.py |
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): | def _get_conversion_rate(self, cr, uid, from_currency, to_currency, context=None): | def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate) | 25d6d96be8cf2e66c8629bcc5e86a21afc01a0a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/25d6d96be8cf2e66c8629bcc5e86a21afc01a0a7/res_currency.py |
if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] | def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate) | 25d6d96be8cf2e66c8629bcc5e86a21afc01a0a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/25d6d96be8cf2e66c8629bcc5e86a21afc01a0a7/res_currency.py |
|
rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: | return to_currency.rate/from_currency.rate def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None): if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if to_currency_id == from_currency_id: | def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate) | 25d6d96be8cf2e66c8629bcc5e86a21afc01a0a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/25d6d96be8cf2e66c8629bcc5e86a21afc01a0a7/res_currency.py |
'sequence' : lambda * a: 1, | def _get_in_visible_answer_type(self,cr, uid, context={}): return context.get('in_visible_answer_type', False) | 62e7869832545289d5f2296b73ebdf4e0ef53157 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/62e7869832545289d5f2296b73ebdf4e0ef53157/survey.py |
|
from account_period where date('%s') | from account_period where date(%s) | def compute_refund(self, cr, uid, ids, mode, 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 | 8710567e1847970b7324e2f92429d386ac40c66a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8710567e1847970b7324e2f92429d386ac40c66a/account_invoice_refund.py |
(form['date'], self.pool.get('res.users').browse(cr, uid, uid,context=context).company_id.id,)) | (date, self.pool.get('res.users').browse(cr, uid, uid,context=context).company_id.id,)) | def compute_refund(self, cr, uid, ids, mode, 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 | 8710567e1847970b7324e2f92429d386ac40c66a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8710567e1847970b7324e2f92429d386ac40c66a/account_invoice_refund.py |
from account_period where date('%s') | from account_period where date(%s) | def compute_refund(self, cr, uid, ids, mode, 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 | 8710567e1847970b7324e2f92429d386ac40c66a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8710567e1847970b7324e2f92429d386ac40c66a/account_invoice_refund.py |
limit 1 """, (form['date'],)) | limit 1 """, (date,)) | def compute_refund(self, cr, uid, ids, mode, 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 | 8710567e1847970b7324e2f92429d386ac40c66a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8710567e1847970b7324e2f92429d386ac40c66a/account_invoice_refund.py |
def compute_refund(self, cr, uid, ids, mode, 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 | 8710567e1847970b7324e2f92429d386ac40c66a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8710567e1847970b7324e2f92429d386ac40c66a/account_invoice_refund.py |
||
'name': ((type1=='move_history_ids') and 'Upstream Traceability') or 'Downstream Traceability', | 'name': ((type1=='move_history_ids') and 'Donwstream Traceability') or 'Upstream Traceability', | def action_traceability(self, cr, uid, ids, context={}): """ It traces the information of a product @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: A dictionary of values """ | 2ce90f1ba49b2796d0649516fb578ed9a4539d43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2ce90f1ba49b2796d0649516fb578ed9a4539d43/stock_traceability.py |
if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) | def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = False for line in order.order_line: proc_id = False date_planned = datetime.now() + relativedelta(days=line.delay or 0.0) date_planned = (date_planned - timedelta(days=company.security_lead)).strftime('%Y-%m-%d %H:%M:%S') | 6269b4aabed7e43f03b64f97c0656e0617bf01c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6269b4aabed7e43f03b64f97c0656e0617bf01c6/sale.py |
|
val['shipped'] = False | def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = False for line in order.order_line: proc_id = False date_planned = datetime.now() + relativedelta(days=line.delay or 0.0) date_planned = (date_planned - timedelta(days=company.security_lead)).strftime('%Y-%m-%d %H:%M:%S') | 6269b4aabed7e43f03b64f97c0656e0617bf01c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6269b4aabed7e43f03b64f97c0656e0617bf01c6/sale.py |
|
if len(obj.message_ids) >= action.trg_max_history: | history_ids = filter(lambda x: x.history, obj.message_ids) if len(history_ids) <= action.trg_max_history: | def do_check(self, cr, uid, action, obj, context={}): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param context: A standard dictionary for contextual values""" ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context) | ac41c6912b8a41bedab97af9357a827f9776dc09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ac41c6912b8a41bedab97af9357a827f9776dc09/crm_action_rule.py |
vevent.add(field).value = str(data[map_field]) | vevent.add(field).value = str(data[map_field].encode('utf8')) | def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent | 805d377ce84582d16093f777830b9c489a9df45d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/805d377ce84582d16093f777830b9c489a9df45d/base_calendar.py |
vevent.add(field).value = data.get(map_field)[1] | vevent.add(field).value = (data.get(map_field)[1]).encode('utf8') | def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent | 805d377ce84582d16093f777830b9c489a9df45d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/805d377ce84582d16093f777830b9c489a9df45d/base_calendar.py |
vevent.add(field).value = (data[map_field]).upper() | vevent.add(field).value = (data[map_field].encode('utf8')).upper() | def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent | 805d377ce84582d16093f777830b9c489a9df45d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/805d377ce84582d16093f777830b9c489a9df45d/base_calendar.py |
def _get_objects(self, empty_acc): if self.read_data: return self.read_data self.empty_acc = empty_acc self.read_data = [] self.get_children(self.ids) | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \ | def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id] | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
self.cr.execute("SELECT sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ | def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id] | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ | def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id] | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
query_params = (tuple(ids2), date1, date2) | query_params = (tuple(ids2), date1, date2) | def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0 | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
self.cr.execute("SELECT sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ | def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0 | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \ | def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0 | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ | def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0 | 49c75feee78ae23fad12924fec92ee41d69a6e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49c75feee78ae23fad12924fec92ee41d69a6e7e/analytic_balance.py |
self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) | self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'probability' : 100.0}) | def case_close(self, cr, uid, ids, *args): """Closes Case @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 case Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Close')) self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) # # We use the cache of cases to keep the old case state # self._action(cr, uid, cases, 'done') return True | ff924e342cb3863293c0549afb489bf310088438 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ff924e342cb3863293c0549afb489bf310088438/crm.py |
self.write(cr, uid, ids, {'state': 'cancel', 'active': True}) | self.write(cr, uid, ids, {'state': 'cancel', 'active': True, 'probability' : 0.0}) | def case_cancel(self, cr, uid, ids, *args): """Cancels Case @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 case Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Cancel')) self.write(cr, uid, ids, {'state': 'cancel', 'active': True}) self._action(cr, uid, cases, 'cancel') return True | ff924e342cb3863293c0549afb489bf310088438 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ff924e342cb3863293c0549afb489bf310088438/crm.py |
'email_to': fields.char('Email TO', size=84), | 'email_to': fields.char('Email To', size=84), | def _note_get(self, cursor, user, ids, name, arg, context=None): """ Gives case History Description @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 case History’s IDs @param context: A standard dictionary for contextual values """ res = {} for hist in self.browse(cursor, user, ids, context or {}): res[hist.id] = (hist.email or '/') + ' (' + str(hist.date) + ')\n' res[hist.id] += (hist.description or '') return res | ff924e342cb3863293c0549afb489bf310088438 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ff924e342cb3863293c0549afb489bf310088438/crm.py |
ftp.login(user.get('login',''), user.get('password','')) | ftp.login(user.get('login',''), user.get('login','')) | def get_ftp_login(cr, uid, ormobj): ftp = get_plain_ftp() user = ormobj.pool.get('res.users').read(cr, uid, uid) ftp.login(user.get('login',''), user.get('password','')) ftp.cwd("/" + cr.dbname) return ftp | d98ffbe1b8b254473743421263e13847028f9378 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d98ffbe1b8b254473743421263e13847028f9378/test_easyftp.py |
def ffp(data, ndata): if len(data)+ len(ndata) > limit: raise IndexError('Data over the limit') data.append(ndata) | d98ffbe1b8b254473743421263e13847028f9378 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d98ffbe1b8b254473743421263e13847028f9378/test_easyftp.py |
||
ids = self.pool.get('res.groups').search(cr, uid, [('name','=','Employee')], context=context) return ids or False | dataobj = self.pool.get('ir.model.data') data_id = dataobj._get_id(cr, 1, 'base', 'group_user') return data_id and [data_id] or False | def _get_group(self,cr, uid, context=None): ids = self.pool.get('res.groups').search(cr, uid, [('name','=','Employee')], context=context) return ids or False | 3c1c74df2cf513a27ac56ae132785330c6dcc498 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3c1c74df2cf513a27ac56ae132785330c6dcc498/res_user.py |
'planned_hours': backlog.planned_hours, | 'planned_hours': backlog.expected_hours, | def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') task = self.pool.get('project.task') backlog_id = self.pool.get('scrum.product.backlog') ids_task = [] | c132caa77ec4558d9bcb8762672c2bd386ab2a78 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c132caa77ec4558d9bcb8762672c2bd386ab2a78/scrum_backlog_create_task.py |
def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') task = self.pool.get('project.task') backlog_id = self.pool.get('scrum.product.backlog') ids_task = [] | c132caa77ec4558d9bcb8762672c2bd386ab2a78 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c132caa77ec4558d9bcb8762672c2bd386ab2a78/scrum_backlog_create_task.py |
||
from reportlab.pdfbase import pdfmetrics | def setFont(self, node): from reportlab.pdfbase import pdfmetrics fname = node.get('name') #TODO : other fonts should be supported if fname not in pdfmetrics.standardFonts: fname = self.canvas._fontname return self.canvas.setFont(fname, utils.unit_get(node.get('size'))) | 3e3270264fb49739144e4fefd6a55182ea9900cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3e3270264fb49739144e4fefd6a55182ea9900cc/trml2pdf.py |
|
if fname not in pdfmetrics.standardFonts: fname = self.canvas._fontname | def setFont(self, node): from reportlab.pdfbase import pdfmetrics fname = node.get('name') #TODO : other fonts should be supported if fname not in pdfmetrics.standardFonts: fname = self.canvas._fontname return self.canvas.setFont(fname, utils.unit_get(node.get('size'))) | 3e3270264fb49739144e4fefd6a55182ea9900cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3e3270264fb49739144e4fefd6a55182ea9900cc/trml2pdf.py |
|
_order = "date desc" | _order = "date desc ,id desc" | def _currency(self, cursor, user, ids, name, args, context=None): res = {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') default_currency = res_users_obj.browse(cursor, user, user, context=context).company_id.currency_id for statement in self.browse(cursor, user, ids, context=context): currency = statement.journal_id.currency if not currency: currency = default_currency res[statement.id] = currency.id currency_names = {} for currency_id, currency_name in res_currency_obj.name_get(cursor, user, [x for x in res.values()], context=context): currency_names[currency_id] = currency_name for statement_id in res.keys(): currency_id = res[statement_id] res[statement_id] = (currency_id, currency_names[currency_id]) return res | fd4c44f3f48607c9b323b92b54eac86d70b48523 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fd4c44f3f48607c9b323b92b54eac86d70b48523/account_bank_statement.py |
fnode = nodes.node_file(None, None, nctx, fbro) | if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) | def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: fnode = nodes.node_file(None, None, nctx, fbro) if not bin_size: data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro) | ebd5c62dbc6ffa689ea36b85951c4202e1317dac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ebd5c62dbc6ffa689ea36b85951c4202e1317dac/document.py |
data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro) | result[fbro.id] = datas else: result[fbro.id] = size | def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: fnode = nodes.node_file(None, None, nctx, fbro) if not bin_size: data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro) | ebd5c62dbc6ffa689ea36b85951c4202e1317dac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ebd5c62dbc6ffa689ea36b85951c4202e1317dac/document.py |
work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, date_end, hours or 0.0, resource_id or False) | work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, date_end, hours or 0.0, resource_id and resource_id[0] or False) | def _check_date_start(self, cr, uid, task, date_end, context={}): """ Check And Compute date_end of task if change in date_start < older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.project_id.resource_calendar_id.id or False hours = task.planned_hours / task.occupation_rate resource_id = resource_obj.search(cr, uid, [('user_id', '=', task.user_id.id)], context=context) if resource_id: resource = resource_obj.browse(cr, uid, resource_id[0], context=context) if resource.calendar_id.id: calendar_id = resource.calendar_id and resource.calendar_id.id or False hours = task.planned_hours / (float(task.occupation_rate) * resource.time_efficiency) work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, date_end, hours or 0.0, resource_id or False) dt_start = work_times[0][0].strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [task.id], {'date_start' : dt_start,'date_end' : date_end.strftime('%Y-%m-%d %H:%M:%S')}) | 38d6ac1db2682a5f241e50820292261cd58f1030 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/38d6ac1db2682a5f241e50820292261cd58f1030/project_long_term.py |
work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, date_start, hours or 0.0, resource.id or False) | work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, date_start, hours or 0.0, resource_id and resource_id[0] or False) | def _check_date_end(self, cr, uid, task, date_start, context={}): """ Check And Compute date_end of task if change in date_end > older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.project_id.resource_calendar_id.id or False hours = task.planned_hours / task.occupation_rate resource_id = resource_obj.search(cr,uid,[('user_id', '=', task.user_id.id)], context=context) if resource_id: resource = resource_obj.browse(cr, uid, resource_id[0], context=context) if resource.calendar_id.id: calendar_id = resource.calendar_id and resource.calendar_id.id or False hours = task.planned_hours / (float(task.occupation_rate) * resource.time_efficiency) work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, date_start, hours or 0.0, resource.id or False) dt_end = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [task.id], {'date_start': date_start.strftime('%Y-%m-%d %H:%M:%S'),'date_end' : dt_end}, context=context) | 38d6ac1db2682a5f241e50820292261cd58f1030 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/38d6ac1db2682a5f241e50820292261cd58f1030/project_long_term.py |
return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} | return {'value': {'price_unit': 0.0, 'name': '', 'product_qty': 1.0, 'date_planned': False, 'notes': '', 'product_uom' : False}, 'domain':{'product_uom':[]}} | def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) if not product: return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} prod= self.pool.get('product.product').browse(cr, uid, product) lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] context={'lang':lang} context['partner_id'] = partner_id | b3f09a0263d96f8e580d4da79ef7d917c1cb63da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b3f09a0263d96f8e580d4da79ef7d917c1cb63da/purchase.py |
'product_qty': qty, | 'product_qty': qty or 1.0, | def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) if not product: return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} prod= self.pool.get('product.product').browse(cr, uid, product) lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] context={'lang':lang} context['partner_id'] = partner_id | b3f09a0263d96f8e580d4da79ef7d917c1cb63da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b3f09a0263d96f8e580d4da79ef7d917c1cb63da/purchase.py |
if isinstance(expression, Eval): | if is_eval(expression): | def process_ir_set(self, node): if not self.mode == 'init': return False _, fields = node.items()[0] res = {} for fieldname, expression in fields.items(): if isinstance(expression, Eval): value = eval(expression.expression, self.eval_context) else: value = expression res[fieldname] = value self.pool.get('ir.model.data').ir_set(self.cr, self.uid, res['key'], res['key2'], \ res['name'], res['models'], res['value'], replace=res.get('replace',True), \ isobject=res.get('isobject', False), meta=res.get('meta',None)) | 64ffd5e8b7a701876fdea722d0ecd033d9d6e87e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/64ffd5e8b7a701876fdea722d0ecd033d9d6e87e/yaml_import.py |
move_id = move_obj.create(cr, uid, {'journal_id': data.property_stock_journal.id}) | move_id = move_obj.create(cr, uid, {'journal_id': data.categ_id.property_stock_journal.id}) | def change_price(self, cr, uid, ids, context): """ @summary: Changes the Standard Price of Product. And creates an account move accordingly. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: """ rec_id = context and context.get('active_id', False) prod_obj = self.pool.get('product.template') location_obj = self.pool.get('stock.location') lot_obj = self.pool.get('stock.report.prodlots') move_obj = self.pool.get('account.move') move_line_obj = self.pool.get('account.move.line') res = self.read(cr, uid, ids[0], ['new_price']) new_price = res.get('new_price',[]) data = prod_obj.browse(cr, uid, rec_id) diff = data.standard_price - new_price prod_obj.write(cr, uid, rec_id, {'standard_price': new_price}) loc_ids = location_obj.search(cr, uid, [('account_id','<>',False),('usage','=','internal')]) lot_ids = lot_obj.search(cr, uid, [('location_id', 'in', loc_ids),('product_id','=',rec_id)]) qty = 0 debit = 0.0 credit = 0.0 stock_input_acc = data.property_stock_account_input.id or data.categ_id.property_stock_account_input_categ.id stock_output_acc = data.property_stock_account_output.id or data.categ_id.property_stock_account_output_categ.id for lots in lot_obj.browse(cr, uid, lot_ids): qty += lots.name | 49e9a1ee0de150645be482613c6401daae6f79d1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/49e9a1ee0de150645be482613c6401daae6f79d1/stock_change_standard_price.py |
os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --xmlrpc-port=%s --netrpc-port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path)) | os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --no-xmlrpcs --xmlrpc-port=%s --netrpc-port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path)) | def start_server(root_path, port, netport, addons_path): os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --xmlrpc-port=%s --netrpc-port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path)) | 72b861187e32f2799673f218ef7ca0879bb52c7f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/72b861187e32f2799673f218ef7ca0879bb52c7f/base_quality_interrogation.py |
'type_id': fields.many2one('crm.case.resource.type', 'Version', domain="[('object_id.model', '=', 'project.issue')]"), | 'type_id': fields.many2one('crm.case.resource.type', 'Version'), | def _get_data(self, cr, uid, ids, field_names, arg, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current users ID for security checks, @param ids: List of case and section Datas IDs @param context: A standard dictionary for contextual values """ | e3c4cb38d8aadc9424cc493b61f386607a0200d4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e3c4cb38d8aadc9424cc493b61f386607a0200d4/project_issue_report.py |
data[fpos] = r | data[fpos] = r or False | def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False | 80b21b75d964ab3e90c286102ad9adaea547e4e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/80b21b75d964ab3e90c286102ad9adaea547e4e2/orm.py |
if hasattr(value, '__unicode__'): | try: | def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1]) | 8f81995ec84899292709608945287d8a3faf1b6d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8f81995ec84899292709608945287d8a3faf1b6d/misc.py |
if not isinstance(value, str): value = str(value) try: return unicode(value, 'utf-8') | def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1]) | 8f81995ec84899292709608945287d8a3faf1b6d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8f81995ec84899292709608945287d8a3faf1b6d/misc.py |
|
try: return unicode(value, 'iso-8859-15') except: pass from locale import getlocale return unicode(value, getlocale()[1]) | for ln in get_encodings(): try: return unicode(value, ln) except: pass raise UnicodeError('unable de to convert %r' % (orig,)) | def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1]) | 8f81995ec84899292709608945287d8a3faf1b6d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8f81995ec84899292709608945287d8a3faf1b6d/misc.py |
cr.execute("select id from account_journal where name= '%s' and special_journal='t'"%(r[0])) | cr.execute("select id from account_journal where name= '%s' and special_journal='t'"%(r)) | def _get_v( self, cr, uid, ids,*a): """ Changed the Validation state of order @return: State """ | b8a25493df438ddb7ffac532d2c29d50e5a4d181 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b8a25493df438ddb7ffac532d2c29d50e5a4d181/pos.py |
cr.execute('select distinct product_id, location_id from stock_move where location_id in %s or location_dest_id in %s', (tuple(ids), tuple(ids))) res_products_by_location = sorted(cr.dictfetchall(), key=itemgetter('location_id')) | cr.execute('select distinct product_id, location_id from stock_move where location_id in %s', (tuple(ids), )) dict1 = cr.dictfetchall() cr.execute('select distinct product_id, location_dest_id as location_id from stock_move where location_dest_id in %s', (tuple(ids), )) dict2 = cr.dictfetchall() res_products_by_location = sorted(dict1+dict2, key=itemgetter('location_id')) | def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False) | b1f8aa98da905cef5bbb9c3ccc63cede1165e1a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b1f8aa98da905cef5bbb9c3ccc63cede1165e1a7/stock.py |
if mline.date_from <= today and mline.date_to >= today: | if mline.date_to >= today: | def _membership_state(self, cr, uid, ids, name, args, context=None): res = {} for id in ids: res[id] = 'none' today = time.strftime('%Y-%m-%d') for id in ids: partner_data = self.browse(cr,uid,id) if partner_data.membership_cancel and today > partner_data.membership_cancel: res[id] = 'canceled' continue if partner_data.membership_stop and today > partner_data.membership_stop: res[id] = 'old' continue s = 4 if partner_data.member_lines: for mline in partner_data.member_lines: if mline.date_from <= today and mline.date_to >= today: if mline.account_invoice_line and mline.account_invoice_line.invoice_id: mstate = mline.account_invoice_line.invoice_id.state if mstate == 'paid': s = 0 break elif mstate == 'open' and s!=0: s = 1 elif mstate == 'cancel' and s!=0 and s!=1: s = 2 elif (mstate == 'draft' or mstate == 'proforma') and s!=0 and s!=1: s = 3 if s==4: for mline in partner_data.member_lines: if mline.date_from < today and mline.date_to < today and mline.date_from<=mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid': s = 5 else: s = 6 if s==0: res[id] = 'paid' elif s==1: res[id] = 'invoiced' elif s==2: res[id] = 'canceled' elif s==3: res[id] = 'waiting' elif s==5: res[id] = 'old' elif s==6: res[id] = 'none' if partner_data.free_member and s!=0: res[id] = 'free' if partner_data.associate_member: res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context) res[id] = res_state[partner_data.associate_member.id] return res | caf2746c0485623a44b55ec2cdd09732c813fa9c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/caf2746c0485623a44b55ec2cdd09732c813fa9c/membership.py |
state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) pass | if context.get('active_id',False): state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) pass | def view_init(self, cr , uid , fields_list, context=None): obj_inv = self.pool.get('account.invoice') if context is None: context = {} state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) pass | f96ee5cded18e23b805880a89dd07a36c45e0579 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f96ee5cded18e23b805880a89dd07a36c45e0579/account_change_currency.py |
if self.path not in self.redirect_paths: | redir_path = self._find_redirect() if redir_path is False: | def send_head(self): """Common code for GET and HEAD commands. | 0b77e833d5d6dc6788a6781778ac7d852091e078 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0b77e833d5d6dc6788a6781778ac7d852091e078/redirect.py |
location = baseuri + self.redirect_paths[self.path] | location = baseuri + redir_path | def send_head(self): """Common code for GET and HEAD commands. | 0b77e833d5d6dc6788a6781778ac7d852091e078 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0b77e833d5d6dc6788a6781778ac7d852091e078/redirect.py |
self._logger.debug("redirecting %s to %s", self.path, self.redirect_paths[self.path]) | self._logger.debug("redirecting %s to %s", self.path, redir_path) | def send_head(self): """Common code for GET and HEAD commands. | 0b77e833d5d6dc6788a6781778ac7d852091e078 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0b77e833d5d6dc6788a6781778ac7d852091e078/redirect.py |
currency = self.pool.get('res.currency').browse(cr, uid, currency_id) currency_obj.round(cr, uid, currency, 300) | currency = currency_obj.browse(cr, uid, currency_id) | def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False) | d34cff12465f0e29d8c018c32f44a08e357cc5d4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d34cff12465f0e29d8c018c32f44a08e357cc5d4/stock.py |
def product_detail(self, cr, uid, id, field, context={}): res = {} res[id] = {} final_value = 0.0 field_to_read = 'virtual_available' if field == 'stock_real_value': field_to_read = 'qty_available' cr.execute('select distinct product_id from stock_move where (location_id=%s) or (location_dest_id=%s)', (id, id)) result = cr.dictfetchall() if result: # Choose the right filed standard_price to read # Take the user company price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) for r in result: c = (context or {}).copy() c['location'] = id product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c) # Compute the amount_unit in right currency context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id amount_unit=self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']] final_value += (product[field_to_read] * amount_unit) return final_value | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
||
def product_detail(self, cr, uid, id, field, context={}): res = {} res[id] = {} final_value = 0.0 field_to_read = 'virtual_available' if field == 'stock_real_value': field_to_read = 'qty_available' cr.execute('select distinct product_id from stock_move where (location_id=%s) or (location_dest_id=%s)', (id, id)) result = cr.dictfetchall() if result: # Choose the right filed standard_price to read # Take the user company price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) for r in result: c = (context or {}).copy() c['location'] = id product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c) # Compute the amount_unit in right currency context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id amount_unit=self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']] final_value += (product[field_to_read] * amount_unit) return final_value | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
||
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, []) | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
||
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, []) | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
||
amount_unit=product.price_get(pricetype.field, context)[product.id] | amount_unit=product.price_get(pricetype.field, context)[product.id] | def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, []) | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
def get_currency_id(self, cursor, user, picking): | def get_currency_id(self, cr, uid, picking): | def get_currency_id(self, cursor, user, picking): return False | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
def _get_payment_term(self, cursor, user, picking): | def _get_payment_term(self, cr, uid, picking): | def _get_payment_term(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id return partner.property_payment_term and partner.property_payment_term.id or False | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
def _get_address_invoice(self, cursor, user, picking): | def _get_address_invoice(self, cr, uid, picking): | def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
return partner_obj.address_get(cursor, user, [partner.id], | return partner_obj.address_get(cr, uid, [partner.id], | def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
def _get_comment_invoice(self, cursor, user, picking): | def _get_comment_invoice(self, cr, uid, picking): | def _get_comment_invoice(self, cursor, user, picking): '''Return comment string for invoice''' return picking.note or '' | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
def _get_price_unit_invoice(self, cursor, user, move_line, type): | def _get_price_unit_invoice(self, cr, uid, move_line, type, context=None): | def _get_price_unit_invoice(self, cursor, user, move_line, type): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=move_line.company_id.currency_id.id amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] return amount_unit else: return move_line.product_id.list_price | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=move_line.company_id.currency_id.id amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] | price_type_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.property_valuation_price_type.id pricetype = self.pool.get('product.price.type').browse(cr, uid, price_type_id) context['currency_id'] = move_line.company_id.currency_id.id amount_unit = move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] | def _get_price_unit_invoice(self, cursor, user, move_line, type): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=move_line.company_id.currency_id.id amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] return amount_unit else: return move_line.product_id.list_price | 18be8e52469417aa8e0ec02e033c0942d0ad805f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/18be8e52469417aa8e0ec02e033c0942d0ad805f/stock.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.