rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
'res_id': res_id, | 'domain' : "[('id','=',%d)]"%(res_id), | def open_document(self, cr, uid, ids, context): """ To Open Document @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID of messages @param context: A standard dictionary """ action_data = False if ids: message_id = ids[0] mailgate_data = self.... |
tax_ids = self.pool.get('account.tax').search(cr, uid, [('company_id', '=', company_id)]) | def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep... | |
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes) | def_sale_taxes = map(lambda x: x.id, res.taxes_id) sale_tax_list = [tax for tax in tax_ids if tax in def_sale_taxes] sale_tax_id = self.pool.get('account.tax').browse(cr, uid, sale_tax_list) sale_taxes = sale_tax_id and sale_tax_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) tax_id =... | def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep... |
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes) | def_pur_taxes = map(lambda x: x.id, res.supplier_taxes_id) pur_tax_list = [tax for tax in tax_ids if tax in def_pur_taxes] pur_tax_id = self.pool.get('account.tax').browse(cr, uid, pur_tax_list) pur_taxes = pur_tax_id and pur_tax_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) tax_id ... | def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep... |
'padding': 3 | 'padding': 3, 'company_id': company_id.id | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_ac... |
'analytic_journal_id': analitical_journal_sale | 'analytic_journal_id': analitical_journal_sale, 'company_id': company_id.id | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_ac... |
'analytic_journal_id': analitical_journal_purchase | 'analytic_journal_id': analitical_journal_purchase, 'company_id': company_id.id | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_ac... |
acc = l.product_id.product_tmpl_id.property_account_expense.id | acc = l.product_id.product_tmpl_id.property_account_expense | def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense.id if not acc: acc = l.product_id.categ_id.property_a... |
acc = l.product_id.categ_id.property_account_expense_categ.id | acc = l.product_id.categ_id.property_account_expense_categ | def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense.id if not acc: acc = l.product_id.categ_id.property_a... |
freq='' if freq == 'None': | freq=datas.get('rrule_type') if freq == 'none': | def compute_rule_string(self, cr, uid, datas, context=None, *args): """ Compute rule string according to value type RECUR of iCalendar from the values given. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param datas: diction... |
if datas.get('rrule_type')=='daily_working': freq ='weekly' else: freq=datas.get('rrule_type') | def compute_rule_string(self, cr, uid, datas, context=None, *args): """ Compute rule string according to value type RECUR of iCalendar from the values given. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param datas: diction... | |
['date', 'rdates', 'rrule', 'exdate']): | ['date', 'rrule', 'exdate']): | def unlink(self, cr, uid, ids, context=None): for id in ids: if len(str(id).split('-')) > 1: date_new = time.strftime("%Y-%m-%d %H:%M:%S", \ time.strptime(str(str(id).split('-')[1]), "%Y%m%d%H%M%S")) for record in self.read(cr, uid, [common.caldevIDs2readIDs(id)], \ ['date', 'rdates', 'rrule', 'exdate']): if record['rr... |
if partner.membership_state != 'canceled': res[partner.id] = False else: | res[partner.id] = False if partner.membership_state == 'canceled': | def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner in self.browse(cr, uid, ids, context=context): if partner.membership_state != 'canceled': res[partner.id] = False else: line... |
else: res[partner.id] = False | def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner in self.browse(cr, uid, ids, context=context): if partner.membership_state != 'canceled': res[partner.id] = False else: line... | |
'account.invoice':(_get_invoice_partner,['state'], 10), | 'account.invoice':(_get_invoice_partner,['state'], 11), | def _get_partners(self, cr, uid, ids, context={}): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) ids+=ids2 return ids |
'sale':[('type','in',['sale','purchase_refund'])], 'purchase':[('type','in',['purchase','sale_refund'])], | 'sale':[('type','in',['sale','sale_refund'])], 'purchase':[('type','in',['purchase','purchase_refund'])], | 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 view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of ... |
'sale_refund':[('type','in',['sale','purchase_refund'])], 'purchase_refund':[('type','in',['purchase','sale_refund'])] | 'sale_refund':[('type','in',['sale','sale_refund'])], 'purchase_refund':[('type','in',['purchase','purchase_refund'])] | 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 view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of ... |
where = [('collection_id','=',self.dir_id)] | where = [('collection_id','=',self.dir_id)] ext = False if name: res = name.split('.ics') if len(res) > 1: name = res[0] ext = '.ics' | def _child_get(self, cr, name=False, parent_id=False, domain=None): dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) where = [('collection_id','=',self.dir_id)] if name: where.append(('name','=',name)) if not domain: domain = [] where = where + domain fil_obj ... |
res.append(node_calendar(calender.name, self, self.context, calender)) | if not ext: res.append(node_calendar(calender.name, self, self.context, calender)) else: res.append(res_node_calendar(name, self, self.context, calender)) | def _child_get(self, cr, name=False, parent_id=False, domain=None): dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) where = [('collection_id','=',self.dir_id)] if name: where.append(('name','=',name)) if not domain: domain = [] where = where + domain fil_obj ... |
def __init__(self,path, parent, context, res_obj, res_model, res_id=None): super(res_node_calendar,self).__init__(path, parent, context) self.calendar_id = parent.calendar_id | def __init__(self,path, parent, context, res_obj, res_model=None, res_id=None): super(res_node_calendar,self).__init__(path, parent, context) | def __init__(self,path, parent, context, res_obj, res_model, res_id=None): super(res_node_calendar,self).__init__(path, parent, context) self.calendar_id = parent.calendar_id self.mimetype = 'text/calendar' self.create_date = parent.create_date self.write_date = parent.write_date or parent.create_date if res_obj: self.... |
return '%s_%d' % (self.model, self.res_id) | res = False if self.model and self.res_id: res = '%s_%d' % (self.model, self.res_id) elif self.calendar_id: res = '%d' % (self.calendar_id) return res | def _get_ttag(self,cr): return '%s_%d' % (self.model, self.res_id) |
if not real_event_id in new_ids: | if real_event_id and not real_event_id in new_ids: | def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ Overrides orm write method. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of crm meeting's ids @param vals: Dictionary of ... |
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) | if new_ids: res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) | def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ Overrides orm write method. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of crm meeting's ids @param vals: Dictionary of ... |
avg(100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor))::decimal(16,2) as negociation, | avg(100.0 * (l.price_unit*l.product_qty*u.factor) / NULLIF(t.standard_price*l.product_qty*u.factor, 0.0))::decimal(16,2) as negociation, | def init(self, cr): tools.sql.drop_view_if_exists(cr, 'purchase_report') cr.execute(""" create or replace view purchase_report as ( select min(l.id) as id, s.date_order as date, to_char(s.date_order, 'YYYY') as name, to_char(s.date_order, 'MM') as month, to_char(s.date_order, 'YYYY-MM-DD') as day, s.state, s.date_appro... |
(sum(l.product_qty*l.price_unit)/sum(l.product_qty*u.factor))::decimal(16,2) as price_average | (sum(l.product_qty*l.price_unit)/NULLIF(sum(l.product_qty*u.factor),0.0))::decimal(16,2) as price_average | def init(self, cr): tools.sql.drop_view_if_exists(cr, 'purchase_report') cr.execute(""" create or replace view purchase_report as ( select min(l.id) as id, s.date_order as date, to_char(s.date_order, 'YYYY') as name, to_char(s.date_order, 'MM') as month, to_char(s.date_order, 'YYYY-MM-DD') as day, s.state, s.date_appro... |
return result and result[0] or False return result | return ids and ids[0] or False return ids | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if isinstance(select, (str, int, long)): ids = [select] else: ids = select result = [] if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting... |
elif type == 'out_refund': | elif inv.type == 'out_refund': | 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 |
self.email_send(cr, uid, obj, emails, action.act_mail_body, emailfrom=email_from) | def to_email(text): return re.findall(r'([^ ,<@]+@[^> ,]+)', text or '') emails = to_email(','.join(filter(None, emails))) email_froms = to_email(email_from) if email_froms: self.email_send(cr, uid, obj, emails, action.act_mail_body, emailfrom=email_froms[0]) | def do_action(self, cr, uid, action, model_obj, obj, context=None): """ Do Action @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 action: pass action @param model_obj: pass Model object @param context: A standard diction... |
def get_real_price(res_dict, product_id, pricelist): | def get_real_price(res_dict, product_id, qty, uom, pricelist): | def get_real_price(res_dict, product_id, pricelist): item_obj = self.pool.get('product.pricelist.item') price_type_obj = self.pool.get('product.price.type') product_obj = self.pool.get('product.product') template_obj = self.pool.get('product.template') field_name = 'list_price' |
product_tmpl_id = product_obj.browse(cr, uid, product_id, context).product_tmpl_id.id | product = product_obj.browse(cr, uid, product_id, context) product_tmpl_id = product.product_tmpl_id.id | def get_real_price(res_dict, product_id, pricelist): item_obj = self.pool.get('product.pricelist.item') price_type_obj = self.pool.get('product.price.type') product_obj = self.pool.get('product.product') template_obj = self.pool.get('product.template') field_name = 'list_price' |
return product_read[field_name] | factor = 1.0 if uom and uom != product.uom_id.id: product_uom_obj = self.pool.get('product.uom') uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id) factor = uom_data.factor return product_read[field_name] * factor | def get_real_price(res_dict, product_id, pricelist): item_obj = self.pool.get('product.pricelist.item') price_type_obj = self.pool.get('product.price.type') product_obj = self.pool.get('product.product') template_obj = self.pool.get('product.template') field_name = 'list_price' |
new_list_price = get_real_price(list_price, product.id, pricelist) | new_list_price = get_real_price(list_price, product.id, qty, uom, pricelist) | def get_real_price(res_dict, product_id, pricelist): item_obj = self.pool.get('product.pricelist.item') price_type_obj = self.pool.get('product.price.type') product_obj = self.pool.get('product.product') template_obj = self.pool.get('product.template') field_name = 'list_price' |
real_price = get_real_price(price_unit_res, product.id, pricelist) | real_price = get_real_price(price_unit_res, product.id, qty, uom, pricelist) | def get_real_price(res_dict, product_id, pricelist): item_obj = self.pool.get('product.pricelist.item') price_type_obj = self.pool.get('product.price.type') product_obj = self.pool.get('product.product') template_obj = self.pool.get('product.template') field_name = 'list_price' |
p_obj = self.pool.get('product.product').browse(cr,uid,product_id).list_price | p_obj = self.pool.get('product.product').browse(cr,uid,[product_id])[0] uom_id=p_obj.uom_po_id.id | def price_by_product(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False): if not product_id: return 0.0 if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist in the sale form !\n' \ 'Please set one before choosing a product.')) p_obj = self.pool.get('product.produ... |
[pricelist], product_id, qty or 1.0, partner_id)[pricelist] return price or p_obj | [pricelist], product_id, qty or 1.0, partner_id,{'uom': uom_id})[pricelist] if price is False: raise osv.except_osv(_('No valid pricelist line found !'), _("Couldn't find a pricelist line matching this product" \ " and quantity.\nYou have to change either the product," \ " the quantity or the pricelist.")) return pric... | def price_by_product(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False): if not product_id: return 0.0 if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist in the sale form !\n' \ 'Please set one before choosing a product.')) p_obj = self.pool.get('product.produ... |
lang=self.pool.get('res.partner').read(cr, uid, partner_id)['lang'] | lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] | 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 !\... |
'write_date': fields.datetime('Modifided Date', readonly=True), 'description': fields.text("description"), | 'write_date': fields.datetime('Write Date', readonly=True), 'description': fields.text("Description"), | def import_cal(self, cr, uid, content, data_id=None, context=None): """ Import Calendar @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param data_id: Get Data’s ID or False @param context: A standard dictionary for contextual... |
'fn': lambda *a: 'field', | 'fn': 'field', | def create(self, cr, uid, vals, context=None): """ create calendar's line @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 vals: Get the Values @param context: A standard dictionary for contextual values """ |
seconds = child.value.seconds days = child.value.days diff = (days * 86400) + seconds interval = 'days' related = 'before' | if isinstance(child.value, timedelta): seconds = child.value.seconds days = child.value.days diff = (days * 86400) + seconds interval = 'days' related = 'before' elif isinstance(child.value, datetime): raise NotImplementedError("we cannot parse absolute triggers") | def import_cal(self, cr, uid, ical_data, context=None): """ Import Calendar @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ical_data: Get calendar's Data @param context: A standard dictionary for contextual values """ |
fields['field'+str(i)] = models[f.field_id.model][f.field_id.name] i+=1 | if f.field_id.model: fields['field'+str(i)] = models[f.field_id.model][f.field_id.name] i+=1 else: fields['column_count'] = {'readonly': True, 'type': 'integer', 'string': 'Count', 'size': 64, 'name': 'column_count'} | def fields_get(self, cr, user, fields=None, context=None): if (not context) or 'report_id' not in context: return super(report_creator, self).fields_get(cr, user, fields, context) report = self.browse(cr, user, context['report_id']) models = {} for model in report.model_ids: models[model.model] = self.pool.get(model.mo... |
fields['field'+str(i)] = models[f.field_id.model][f.field_id.name] i+=1 | if f.field_id.model: fields['field'+str(i)] = models[f.field_id.model][f.field_id.name] i+=1 else: fields['column_count'] = {'readonly': True, 'type': 'integer', 'string': 'Count', 'size': 64, 'name': 'column_count'} | def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False): if (not context) or 'report_id' not in context: return super(report_creator, self).fields_view_get(cr, user, view_id, view_type, context, toolbar) report = self.browse(cr, user, context['report_id']) models = {} for model ... |
arch += '<field name="%s" select="1"/>' % ('field'+str(i),) i+=1 | if f.field_id.model: arch += '<field name="%s" select="1"/>' % ('field'+str(i),) i+=1 else: arch += '<field name="%s" select="1"/>' % ('column_count',) | def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False): if (not context) or 'report_id' not in context: return super(report_creator, self).fields_view_get(cr, user, view_id, view_type, context, toolbar) report = self.browse(cr, user, context['report_id']) models = {} for model ... |
set_dict[f.calendar_mode] = 'field'+str(i) i+=1 | if f.field_id.model: field_cal = 'field'+str(i) i+=1 else: field_cal = 'column_count' set_dict[f.calendar_mode] = field_cal | def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False): if (not context) or 'report_id' not in context: return super(report_creator, self).fields_view_get(cr, user, view_id, view_type, context, toolbar) report = self.browse(cr, user, context['report_id']) models = {} for model ... |
temp_list.append('''<field name="%(name)s" select="1"/>''' % {'name':'field'+str(i)}) i+=1 | if f.field_id.model: temp_list.append('''<field name="%(name)s" select="1"/>''' % {'name':'field'+str(i)}) i+=1 else: temp_list.append('''<field name="%(name)s" select="1"/>''' % {'name':'column_count'}) | def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False): if (not context) or 'report_id' not in context: return super(report_creator, self).fields_view_get(cr, user, view_id, view_type, context, toolbar) report = self.browse(cr, user, context['report_id']) models = {} for model ... |
fields['field'+str(i)] = (f.field_id.model, f.field_id.name) i+=1 | if f.field_id.model: fields['field'+str(i)] = (f.field_id.model, f.field_id.name) i+=1 else: fields['column_count'] = (False, 'Count') | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if (not context) or 'report_id' not in context: return super(report_creator, self).search(cr, user, args, offset, limit, order, context, count) report = self.browse(cr, user, context['report_id']) i = 0 fields = {} for f in r... |
res = self.pool.get(fields[a[0]][0])._where_calc(cr, user, [[fields[a[0]][1],a[1],a[2]]], active_test=False, context=context) newargs+=res[0] newargs2+=res[1] | if fields[a[0]][0]: res = self.pool.get(fields[a[0]][0])._where_calc(cr, user, [[fields[a[0]][1],a[1],a[2]]], active_test=False, context=context) newargs+=res[0] newargs2+=res[1] else: newargs += [("count(*) " + a[1] +" " + str(a[2]))] | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if (not context) or 'report_id' not in context: return super(report_creator, self).search(cr, user, args, offset, limit, order, context, count) report = self.browse(cr, user, context['report_id']) i = 0 fields = {} for f in r... |
groupby.append(t+'.'+f.field_id.name) | def _sql_query_get(self, cr, uid, ids, prop, unknow_none, context, where_plus=[], limit=None, offset=None): result = {} for obj in self.browse(cr, uid, ids): fields = [] groupby = [] i = 0 for f in obj.field_ids: t = self.pool.get(f.field_id.model_id.model)._table if f.group_method == 'group': fields.append('\t'+t+'.'+... | |
week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + (dt - ldt).hours | week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + ((dt - ldt).seconds/3600) | def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') first_monday = start_date - relativedelta(days=start_date.date().we... |
date_and_hours_by_cal = [(op.production_id.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops] | date_and_hours_by_cal = [] for op in ops: date_planned = op.production_id.date_planned and op.date_planned if date_planned: date_and_hours_by_cal.append((date_planned, op.hour, op.workcenter_id.calendar_id.id)) | def _get_date_end(self, cr, uid, ids, field_name, arg, context): """ Finds ending date. @return: Dictionary of values. """ ops = self.browse(cr, uid, ids, context=context) date_and_hours_by_cal = [(op.production_id.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops] intervals = self.pool.get('resourc... |
if op.date_planned: i = intervals[(op.date_planned, op.hour, op.workcenter_id.calendar_id.id)] | date_planned = op.production_id.date_planned and op.date_planned if date_planned: i = intervals[(date_planned, op.hour, op.workcenter_id.calendar_id.id)] | def _get_date_end(self, cr, uid, ids, field_name, arg, context): """ Finds ending date. @return: Dictionary of values. """ ops = self.browse(cr, uid, ids, context=context) date_and_hours_by_cal = [(op.production_id.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops] intervals = self.pool.get('resourc... |
_timers = {} | __tasks = [] __tasks_by_db = {} | def shutdown(self): logging.shutdown() |
__logger = logging.getLogger('timer') def setAlarm(self, fn, dt, db_name, *args, **kwargs): wait = dt - time.time() if wait > 0: self.__logger.debug("Job scheduled in %.3g seconds for %s.%s" % (wait, fn.im_class.__name__, fn.func_name)) timer = threading.Timer(wait, fn, args, kwargs) timer.start() self._timers.setdefa... | @classmethod def setAlarm(cls, function, timestamp, db_name, *args, **kwargs): task = [timestamp, db_name, function, args, kwargs] heapq.heappush(cls.__tasks, task) cls.__tasks_by_db.setdefault(db_name, []).append(task) | def shutdown(self): logging.shutdown() |
for db in cls._timers: if db_name is None or db == db_name: for timer in cls._timers[db]: timer.cancel() | if db_name is None: cls.__tasks, cls.__tasks_by_db = [], {} else: if db_name in cls.__tasks_by_db: for task in cls.__tasks_by_db[db_name]: task[0] = 0 | def cancel(cls, db_name): """Cancel all timers for a given database. If None passed, all timers are cancelled""" for db in cls._timers: if db_name is None or db == db_name: for timer in cls._timers[db]: timer.cancel() |
partner_id, date_order=False, fiscal_position=False): | partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): | def product_id_change(self,cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False): warning = {} if not product: return {'value': {'price_unit': 0.0, 'name':'','notes':'', 'product_uom' : False}, 'domain':{'product_uom':[]}} product_obj = self.pool.get('product.product') product... |
l.company_id company_id | l.company_id as company_id | def init(self, cr): tools.drop_view_if_exists(cr, 'account_followup_stat_by_partner') cr.execute(""" create or replace view account_followup_stat_by_partner as ( SELECT l.partner_id AS id, l.partner_id AS partner_id, min(l.date) AS date_move, max(l.date) AS date_move_last, max(l.followup_date) AS date_followup, max(l.f... |
res = super(product_product,self).get_product_accounts(cr, uid, product_id, context) | def get_product_accounts(self, cr, uid, product_id, context={}): """ To get the stock input account, stock output account and stock journal related to product. @param product_id: product id @return: dictionary which contains information regarding stock input account, stock output account and stock journal """ product_o... | |
res = {} | def get_product_accounts(self, cr, uid, product_id, context={}): """ To get the stock input account, stock output account and stock journal related to product. @param product_id: product id @return: dictionary which contains information regarding stock input account, stock output account and stock journal """ product_o... | |
self.result_sum_dr += self.res_bl['balance'] | self.result_sum_dr += self.res_bl['balance']*-1 | def sum_dr(self): if self.res_bl['type'] == 'Net Profit': self.result_sum_dr += self.res_bl['balance'] return self.result_sum_dr |
self.result_sum_dr += abs(account.debit - account.credit) | self.result_sum_dr += account.balance | def get_data(self,data): cr, uid = self.cr, self.uid db_pool = pooler.get_pool(self.cr.dbname) |
self.result_sum_cr += abs(account.debit - account.credit) | self.result_sum_cr += account.balance | def get_data(self,data): cr, uid = self.cr, self.uid db_pool = pooler.get_pool(self.cr.dbname) |
tools.debug(ret) | def login(self, db, login, password): ret = super(users,self).login(db, login, password) tools.debug(ret) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password... | |
tools.debug(res_company_ldap) | logger.debug(res_company_ldap) | def login(self, db, login, password): ret = super(users,self).login(db, login, password) tools.debug(ret) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password... |
tools.debug(dn) | logger.debug(dn) | def login(self, db, login, password): ret = super(users,self).login(db, login, password) tools.debug(ret) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password... |
tools.debug(res) | logger.debug(res) | def login(self, db, login, password): ret = super(users,self).login(db, login, password) tools.debug(ret) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password... |
tools.debug(e) | logger.warning("Cannot auth", exc_info=True) | def login(self, db, login, password): ret = super(users,self).login(db, login, password) tools.debug(ret) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password... |
except: | except ExceptionNoTb: | def check(self, db, uid, passwd): try: return super(users,self).check(db, uid, passwd) except: # AccessDenied pass cr = pooler.get_db(db).cursor() user = self.browse(cr, 1, uid) if user and user.company_id.ldaps: for res_company_ldap in user.company_id.ldaps: try: l = ldap.open(res_company_ldap.ldap_server, res_company... |
tools.debug(e) | logger.warning('cannot check', exc_info=True) | def check(self, db, uid, passwd): try: return super(users,self).check(db, uid, passwd) except: # AccessDenied pass cr = pooler.get_db(db).cursor() user = self.browse(cr, 1, uid) if user and user.company_id.ldaps: for res_company_ldap in user.company_id.ldaps: try: l = ldap.open(res_company_ldap.ldap_server, res_company... |
help="Number of iterations this workcenter has to do in the specified operation of the routing."), 'hour_nbr': fields.float('Number of Hours', required=True, help="Time in hours for this workcenter to achieve the operation of the specified routing."), | help="Number of iterations this work Center has to do in the specified operation of the routing."), 'hour_nbr': fields.float('Number of Hours', required=True, help="Time in hours for this work Center to achieve the operation of the specified routing."), | def on_change_product_cost(self, cr, uid, ids, product_id, context=None): if context is None: context = {} value = {} |
if guarantee_limit and date.today() > datetime.strptime(guarantee_limit, '%Y-%m-%d'): | if guarantee_limit and datetime.strptime(date.today().strftime('%Y-%m-%d'), '%Y-%m-%d') > datetime.strptime(guarantee_limit, '%Y-%m-%d'): | def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit): """ On change of operation type it sets source location, destination location and to invoice field. @param product: Changed operation type. @param guarantee_limit: Guarantee limit of current record. @return: Dictionary of values. """ if not type: r... |
msg_txt += '\n\t'.join(message.description.split('\n')[:3]) + '...' | msg_txt += self.truncate_data(cr, uid, message.description, context=context) | def _get_display_text(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} tz = context.get('tz') result = {} for message in self.browse(cr, uid, ids, context=context): msg_txt = '' if message.history: msg_txt += (message.email_from or '/') + _(' wrote on ') + format_date_tz(message.date, tz) ... |
def _hours_get(self, cr, uid, ids, field_names, args, context): | def _hours_get(self, cr, uid, ids, field_names, args, context=None): res = {} | def _hours_get(self, cr, uid, ids, field_names, args, context): cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id =ANY(%s) GROUP BY task_id",(ids,)) hours = dict(cr.fetchall()) res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = {} res[task.id]['effectiv... |
res = {} | def _hours_get(self, cr, uid, ids, field_names, args, context): cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id =ANY(%s) GROUP BY task_id",(ids,)) hours = dict(cr.fetchall()) res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = {} res[task.id]['effectiv... | |
res[task.id] = {} res[task.id]['effective_hours'] = hours.get(task.id, 0.0) res[task.id]['total_hours'] = task.remaining_hours + hours.get(task.id, 0.0) | res[task.id] = {'effective_hours': hours.get(task.id, 0.0), 'total_hours': task.remaining_hours + hours.get(task.id, 0.0)} | def _hours_get(self, cr, uid, ids, field_names, args, context): cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id =ANY(%s) GROUP BY task_id",(ids,)) hours = dict(cr.fetchall()) res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = {} res[task.id]['effectiv... |
res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 100),2) | if hours.get(task.id, 0.0) > res[task.id]['total_hours']: res[task.id]['progress'] = round(100 - (max(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 100)) % 100, 2) else: res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 100),2) | def _hours_get(self, cr, uid, ids, field_names, args, context): cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id =ANY(%s) GROUP BY task_id",(ids,)) hours = dict(cr.fetchall()) res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = {} res[task.id]['effectiv... |
if (not src_acct.currency_id) or src_acct.currency_id.id == reference_currency_id: | if (not dest_acct.currency_id) or dest_acct.currency_id.id == reference_currency_id: | def _create_account_move_line(self, cr, uid, move, src_account_id, dest_account_id, reference_amount, reference_currency_id, context=None): """ Generate the account.move.line values to post to track the stock valuation difference due to the processing of the given stock move. """ # prepare default values considering th... |
partner = picking.address_id.partner_id | partner = picking.purchase_id.partner_id | def _get_address_invoice(self, cr, uid, picking): """ Gets invoice address of a partner @return {'contact': address, 'invoice': address} for invoice """ partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id |
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] reads = self.browse(cr, uid, ids, context) res = [] for record in reads: name = record.plan_id.name res.append((record['id'], name)) return res | def create(self, cr, uid, vals, context={}): id = super(hr_employee, self).create(cr, uid, vals, context=context) if vals.get('evaluation_plan_id', False): self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=context) return id | |
self.write(cr, uid, ids, { 'state' : 'done'}) | def survey_req_done(self, cr, uid, ids, context=None): if context is None: context = {} self.write(cr, uid, ids, { 'state' : 'done'}) hr_eval_obj = self.pool.get('hr_evaluation.evaluation') for id in self.browse(cr, uid, ids, context=context): flag = False wating_id = 0 tot_done_req = 0 records = hr_eval_obj.browse(cr,... | |
res += [(user_email, case.email_from, case.email_cc, getattr(case,'priority') and case.priority or False)] | res += [(user_email, case.email_from, case.email_cc or False, getattr(case,'priority') and case.priority or False)] | def emails_get(self, cr, uid, ids, context={}): |
if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)]) if msg_ids and len(msg_ids): return 0 | def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = ... | |
self.write(cr, uid, ids, {'state': 'done', 'date': time.strftime('%Y-%m-%d %H:%M:%S')}) wf_service = netsvc.LocalService("workflow") for id in ids: wf_service.trg_trigger(uid, 'stock.move', id, cr) | if move_ids: self.write(cr, uid, move_ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')}) wf_service = netsvc.LocalService("workflow") for id in move_ids: wf_service.trg_trigger(uid, 'stock.move', id, cr) | def action_done(self, cr, uid, ids, context=None): """ Makes the move done and if all moves are done, it will finish the picking. @return: """ partial_datas='' picking_ids = [] partial_obj=self.pool.get('stock.partial.picking') partial_id=partial_obj.search(cr,uid,[]) if partial_id: partial_datas=partial_obj.read(cr,ui... |
'date' : lambda *a: (parser.parse(datetime.date.today().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'), | 'date' : lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'), | def create(self, cr, uid, vals, context=None): if context is None: context = {} id = super(hr_employee, self).create(cr, uid, vals, context=context) if vals.get('evaluation_plan_id', False): self.pool.get('hr_evaluation.evaluation').create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=co... |
'date_deadline': (parser.parse(datetime.date.today().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'), | 'date_deadline': (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'), | def button_plan_in_progress(self, cr, uid, ids, context=None): hr_eval_inter_obj = self.pool.get('hr.evaluation.interview') if context is None: context = {} apprai_id = [] for evaluation in self.browse(cr, uid, ids, context=context): wait = False for phase in evaluation.plan_id.phase_ids: childs = [] if phase.action ==... |
planning.id::varchar(32) || '-' || COALESCE(users.id,0)::varchar(32) AS id, | (1000*(planning.id) + users.id)::integer AS id, | def init(self, cr): cr.execute(""" CREATE OR REPLACE VIEW report_account_analytic_planning_user AS ( SELECT planning.id AS planning_id, planning.id::varchar(32) || '-' || COALESCE(users.id,0)::varchar(32) AS id, planning.business_days, users.id AS user_id, (SELECT sum(line1.amount_in_base_uom) FROM report_account_analy... |
planning.id::varchar(32) || '-' || '0' AS id, | (1000*(planning.id) - 1)::integer AS id, | def init(self, cr): cr.execute(""" CREATE OR REPLACE VIEW report_account_analytic_planning_user AS ( SELECT planning.id AS planning_id, planning.id::varchar(32) || '-' || COALESCE(users.id,0)::varchar(32) AS id, planning.business_days, users.id AS user_id, (SELECT sum(line1.amount_in_base_uom) FROM report_account_analy... |
'work_phone': fields.related('address_id', 'phone', type='char', string='Work Phone', readonly=True), | 'work_phone': fields.related('address_id', 'phone', type='char', size=32, string='Work Phone', readonly=True), | def job_open(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'open'}) return True |
return {} | if not journal_id: return False journal_pool = self.pool.get('account.journal') journal = journal_pool.browse(cr, uid, journal_id) account_id = journal.default_credit_account_id or journal.default_debit_account_id tax_id = False if account_id and account_id.tax_ids: tax_id = account_id.tax_ids[0].id return {'value':{'... | def onchange_journal(self, cr, uid, ids, journal_id): return {} |
</form>""" % (str(journal), str(period)) | </form>""" % (tools.ustr(journal), tools.ustr(period)) | 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 require... |
self.cr.execute("select name from account_invoice as ac where id = %d" %(inv_id)) res = self.cr.fetchone() if res: | if inv_id: self.cr.execute("select name from account_invoice as ac where id = %d" %(inv_id)) res = self.cr.fetchone() | def _get_invoice(self,inv_id,user): res={} self.cr.execute("select name from account_invoice as ac where id = %d" %(inv_id)) res = self.cr.fetchone() if res: return res[0] else: return '' |
partner_id, date_order=False): | partner_id, date_order=False,fiscal_position=False): | def product_uom_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False): res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=date_order) if 'product_uom' in res['value']: del res['value']['product_uom'] if not uom: res['value']['price_unit'] = 0... |
partner_id, date_order=date_order) | partner_id, date_order=date_order,fiscal_position=fiscal_position) | def product_uom_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False): res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=date_order) if 'product_uom' in res['value']: del res['value']['product_uom'] if not uom: res['value']['price_unit'] = 0... |
return rset1._iter() | return list(rset1._iter()) | def todate(date): val = parser.parse(''.join((re.compile('\d')).findall(date))) return val |
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}), | 'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}), | 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 |
result = s.exp_list() | result = s.exp_list(document=True) | def db_list(self): #return pooler.pool_dic.keys() s = netsvc.ExportService.getService('db') result = s.exp_list() self.db_name_list = [] for db_name in result: db, cr = None, None try: try: db = pooler.get_db_only(db_name) cr = db.cursor() cr.execute("SELECT 1 FROM pg_class WHERE relkind = 'r' AND relname = 'ir_module_... |
cr.execute("UPDATE %s set freq='',interval=0,count=0,end_date=Null,\ | cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\ | def _set_rrulestring(self, cr, uid, id, name, value, arg, context): """ Set rule string. @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @param context: A standard dictionary for contextual values @return: dictionary of rrule value. """ cr.... |
day=0,select1=False,month_list=0 ,byday=False where id=%s" % (self._table, id)) | day=0,select1='date',month_list=Null ,byday=Null where id=%s" % (self._table, id)) | def _set_rrulestring(self, cr, uid, id, name, value, arg, context): """ Set rule string. @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @param context: A standard dictionary for contextual values @return: dictionary of rrule value. """ cr.... |
if int(val.get('interval')) > 1: | if not val.get('interval'): rrule_type = 'custom' elif int(val.get('interval')) > 1: | def _set_rrulestring(self, cr, uid, id, name, value, arg, context): """ Set rule string. @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @param context: A standard dictionary for contextual values @return: dictionary of rrule value. """ cr.... |
new_val['byday'] = d[:1] new_val['week_list'] = d[1:].upper() | if '-' in d: new_val['byday'] = d[:2] new_val['week_list'] = d[2:4].upper() else: new_val['byday'] = d[:1] new_val['week_list'] = d[1:3].upper() | def _set_rrulestring(self, cr, uid, id, name, value, arg, context): """ Set rule string. @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @param context: A standard dictionary for contextual values @return: dictionary of rrule value. """ cr.... |
if datas.get('interval') < 1: raise osv.except_osv(_('Error!'), ("Please select proper Interval")) | interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or '' | def compute_rule_string(self, cr, uid, datas, context=None, *args): """ Compute rule string. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param datas: dictionary of freq and interval value. @return: string value which compu... |
rrule_string = 'FREQ=' + freq.upper() + weekstring + ';INTERVAL=' + \ str(datas.get('interval')) + enddate + monthstring + yearstring | rrule_string = 'FREQ=' + freq.upper() + weekstring + interval_srting \ + enddate + monthstring + yearstring | def compute_rule_string(self, cr, uid, datas, context=None, *args): """ Compute rule string. @param self: the object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param datas: dictionary of freq and interval value. @return: string value which compu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.