rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_cal_dir.name | calendar_dir_id = data_pool.get_object(cr, uid, 'caldav', 'document_directory_calendars0') return calendar_dir_id.name | def _get_root_calendar_directory(self, cr, uid, context=None): objid = self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_... |
logger = logging.getLogger('document') | logger = logging.getLogger('caldav') | def _get_root_calendar_directory(self, cr, uid, context=None): objid = self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_... |
min(date), max(date) | min(date_expected), max(date_expected) | def get_min_max_date(self, cr, uid, ids, field_name, arg, context=None): """ Finds minimum and maximum dates for picking. @return: Dictionary of values """ res = {} for id in ids: res[id] = {'min_date': False, 'max_date': False} if not ids: return res cr.execute("""select picking_id, min(date), max(date) from stock_mov... |
phase_resource_obj = resource_pool.generate_resources(cr, uid, [phase.responsible_id.id], calendar_id, context=context) | phase_resource_obj = self.generate_resources(cr, uid, [phase.id], context=context)[phase.id] | def generate_schedule(self, cr, uid, ids, start_date=False, calendar_id=False, context=None): """ Schedule phase with the start date till all the next phases are completed. @param: start_date (datetime.datetime) : start date for the phase. It would be either Start date of phase or start date of project or system curren... |
for phase in phase.next_phase_ids: if phase.state in ['draft', 'open', 'pending']: id_cal = phase.project_id.resource_calendar_id and phase.project_id.resource_calendar_id.id or False self.generate_schedule(cr, uid, [phase.id], date_start, id_cal, context=context) | for next_phase in phase.next_phase_ids: if next_phase.state in ['draft', 'open', 'pending']: id_cal = next_phase.project_id.resource_calendar_id and next_phase.project_id.resource_calendar_id.id or False self.generate_schedule(cr, uid, [next_phase.id], date_start+timedelta(days=1), id_cal, context=context) | def phase(): effort = duration |
'partner_id': address.partner_id and address.partner_id.id or '', | 'partner_id': address.partner_id and str(address.partner_id.id) or '', | def search_contact(self, cr, user, email): address_pool = self.pool.get('res.partner.address') address_ids = address_pool.search(cr, user, [('email','=',email)]) res = {} |
if abs(amount) < 0.0001: | if abs(amount) < 10 ** -(int(config['price_accuracy'])1): | def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').... |
vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking') | seq_obj_name = 'stock.picking.' + vals['type'] vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) | def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking') type_list = { 'out':_('Packing List'), 'in':_('Reception'), 'internal': _('Internal picking'), 'delivery': _('Delivery order') } if not vals.get(... |
vals_journal = { | vals_journal.update({ | def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_ac... |
} | }) | 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... |
datas = self.read(cr, uid, event_id, context=context) | def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args): """Modifies only one event record out of virtual recurrent events and creates new event as a specific instance of a Recurring Event", @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the ... | |
'recurrent_uid': base_calendar_id2real_id(datas['id']), 'recurrent_id': defaults.get('date') or real_date, | 'recurrent_uid': base_calendar_id2real_id(event_id), 'recurrent_id': real_date, | def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args): """Modifies only one event record out of virtual recurrent events and creates new event as a specific instance of a Recurring Event", @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the ... |
exdate = datas['exdate'] and datas['exdate'].split(',') or [] if real_date and defaults.get('date'): exdate.append(real_date) self.write(cr, uid, event_id, {'exdate': ','.join(exdate)}, context=context) | def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args): """Modifies only one event record out of virtual recurrent events and creates new event as a specific instance of a Recurring Event", @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the ... | |
params += max_amount | params += (max_amount,) | def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_w... |
exists, r_id = caldav.uid2openobjectid(cr, val['id'], context.get('model'), \ | exists, r_id = calendar.uid2openobjectid(cr, val['id'], context.get('model'), \ | def check_import(self, cr, uid, vals, 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 vals: Get Values @param context: A standard dictionary for contextual values """ ids = [] model_obj = self.pool.get(c... |
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from', False), context={}): | def email_send(self, cr, uid, obj, emails, body, emailfrom=None, context=None): | def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from', False), context={}): """ send email @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 email: pass the emails @param emailfrom: Pass ... |
self.email_send(cr, uid, obj, emails, action.act_mail_body) | email_from = eval(action.act_email_from, { 'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context), 'obj' : obj, }) self.email_send(cr, uid, obj, emails, action.act_mail_body, emailfrom=email_from) | def do_action(self, cr, uid, action, model_obj, obj, context={}): """ 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 dictionar... |
res = obj.create(cr, uid, data, context) | obj.create(cr, uid, data, context) | def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security ... |
'name':fields.char('Subject', size=128), 'model': fields.char('Object Name', size=128), 'res_id': fields.integer('Resource ID'), | 'name':fields.char('Subject', size=128), 'model': fields.char('Object Name', size=128, select=1), 'res_id': fields.integer('Resource ID', select=1), | def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security ... |
msg_id = msg_pool.create(cr, uid, msg_data, context=context) | msg_pool.create(cr, uid, msg_data, context=context) | def history(self, cr, uid, model, res_ids, msg, attach, context=None): """This function creates history for mails fetched @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 model: OpenObject Model @param res_ids: Ids of the... |
return res_id | return res_id, att_ids | def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(c... |
counter = 1 | def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(c... | |
elif part.get_content_maintype()=='application' or part.get_content_maintype()=='image' or part.get_content_maintype()=='text': | elif part.get_content_maintype() in ('application', 'image', 'text'): | def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(c... |
new_res_id = create_record(msg) | new_res_id, attachment_ids = create_record(msg) | def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(c... |
attach = msg.get('attachments', {}).items(), | attach = attachments.items(), | def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(c... |
self.history(cr, uid, model, res_ids, msg, att_ids, context=context) | self.history(cr, uid, model, res_ids, msg, attachment_ids, context=context) | def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(c... |
bom_parent = bom_obj.browse(cr, uid, context['active_id']) | bom_id = context and context.get('active_id', False) or False cr.execute('select id from mrp_bom') if all(bom_id != r[0] for r in cr.fetchall()): ids.sort() bom_id = ids[0] bom_parent = bom_obj.browse(cr, uid, bom_id) | def _child_compute(self, cr, uid, ids, name, arg, context={}): """ Gets child bom. @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param name: Name of the field @param arg: User defined argument @... |
if bom_parent.multi_level_bom or bom.id == context['active_id']: | if (bom_parent and bom_parent.multi_level_bom) or bom.id == bom_id: | def _child_compute(self, cr, uid, ids, name, arg, context={}): """ Gets child bom. @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param name: Name of the field @param arg: User defined argument @... |
where active") | WHERE active") | def pre_action(self, cr, uid, ids, model, context=None): # Searching for action rules cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \ LEFT JOIN ir_model model on (model.id = rule.model_id) \ where active") res = cr.fetchall() # Check if any rule matching with current object for obj_name, rule_id i... |
'company_id': fields.many2one('res.company', 'Company', select=True, required=True), | 'company_id': fields.many2one('res.company', 'Company', select=True, required=False), | def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context): res = self.name_get(cr, uid, ids, context) return dict(res) |
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(case when t.standard_price <= 0 then (100.0 * (l.price_unit*l.product_qty*u.factor)) else (100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor)) end) 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... |
'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases") | 'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"), 'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"), | def phase_done(self, cr, uid, ids,*args): self.write(cr, uid, ids, {'state': 'done'}) return True |
if company_currency_id==st_line.account_id.currency_id.id: amount_cur = st_line.amount else: amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, st_line.account_id.currency_id.id, amount, context=context, account=acc_cur) val['amount_currency'] = amount_cur | amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, st_line.account_id.currency_id.id, amount, context=context, account=acc_cur) val['amount_currency'] = -amount_cur | def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): res_currency_obj = self.pool.get('res.currency') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('accoun... |
data['amount'] = cur_price_unit - reduce(lambda x,y: y.get('amount',0.0)+x, res, 0.0) data['balance'] = cur_price_unit | amount = cur_price_unit - reduce(lambda x,y: y.get('amount',0.0)+x, res, 0.0) | def _unit_compute_inv(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None): taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner) |
print "RULE: %s" % (rule,) print " %s" % (rule.last_run,) | def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context) | |
print " OBJ: %s" % (obj_id,) | def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context) | |
print " D: %s" % (d,) | def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context) | |
print " RUNNING" | def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context) | |
date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') | date_formatted = time.strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') | def _get_and_change_date_format_for_swiss (self,date_to_format): date_formatted='' print date_to_format if date_to_format: date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted |
if not partner.ean13: continue if len(partner.ean13) not in [13,14,8]: return False try: int(partner.ean13) except: return False oddsum=0 evensum=0 total=0 eanvalue=partner.ean13 reversevalue = eanvalue[::-1] finalean=reversevalue[1:] for i in range(len(finalean)): if is_pair(i): oddsum += int(finalean[i]) else: evens... | res = check_ean(partner.ean13) return res | def _check_ean_key(self, cr, uid, ids): for partner in self.browse(cr, uid, ids): if not partner.ean13: continue if len(partner.ean13) not in [13,14,8]: return False try: int(partner.ean13) except: return False oddsum=0 evensum=0 total=0 eanvalue=partner.ean13 reversevalue = eanvalue[::-1] finalean=reversevalue[1:] |
emp_ids = obj_emp.search(cr, uid, [('category_id', '=', record.category_id.id)]) | emp_ids = obj_emp.search(cr, uid, [('category_ids', '=', record.category_id.id)]) | def holidays_validate(self, cr, uid, ids, *args): obj_emp = self.pool.get('hr.employee') data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) vals = {'state':'validate'} ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) if ids2: if data_holiday[0].state == 'validate1': vals['manager_id2'] = ... |
'resource_id': fields.many2one('resource.resource', 'Resource', required=True), | 'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade', required=True), | def set_done(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'done'}) return True |
'target': 'new', | 'target': 'current', | def invoice_pay_customer(self, cr, uid, ids, context={}): if not ids: return [] inv = self.browse(cr, uid, ids[0], context=context) return { 'name':_("Pay Invoice"), 'view_mode': 'form', 'view_id': False, 'view_type': 'form', 'res_model': 'account.voucher', 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': ... |
db = pooler.get_db_only(cr.dbname) interface.register_all(db) | pool.get('ir.actions.report.xml').register_all(cr) | def upload_report(self, cr, uid, report_id, file_sxw, file_type, context): ''' Untested function ''' pool = pooler.get_pool(cr.dbname) sxwval = StringIO(base64.decodestring(file_sxw)) if file_type=='sxw': fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb') if fi... |
if not company_currency_id: company_currency_id = line.company_id.id | def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False | |
res[line.id] = res_currency_obj.compute(cursor, user, company_currency_id, line.statement_id.currency.id, line.voucher_id.amount, context=context) | res[line.id] = line.voucher_id.amount | def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False |
domain = [('object_id.name', '=', model), | domain = [('object_id.model', '=', model), | def signal(self, cr, uid, model, res_id, signal, context=None): if not signal: raise ValueError('signal cannot be False') |
result = Activities.process(activity.id, workitem.id, | result = Activities.process(cr, uid, activity.id, workitem.id, | def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': return |
except Exception, e: workitem.write({'state': 'exception', 'error_msg': str(e)}, | except Exception: tb = "".join(format_exception(*exc_info())) workitem.write({'state': 'exception', 'error_msg': tb}, | def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': return |
if ctx.get('action_id', False): return ctx['action_id'] | if ctx.get('active_id', False): return ctx['active_id'] | def _get_picking(self, cr, uid, ctx=None): if ctx is None: ctx = {} if ctx.get('action_id', False): return ctx['action_id'] return False |
if context.get('action_id', False): picking = picking_obj.browse(cr, uid, [context['action_id']])[0] | if context.get('active_id', False): picking = picking_obj.browse(cr, uid, [context['active_id']])[0] | def _get_picking_address(self, cr, uid, context=None): picking_obj = self.pool.get('stock.picking') if context is None: context = {} if context.get('action_id', False): picking = picking_obj.browse(cr, uid, [context['action_id']])[0] return picking.address_id and picking.address_id.id or False return False |
st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context) | st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id.id, context) | def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_anal... |
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(relat... | 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)... | def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} |
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): | def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): | def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") ... |
if ids and (start_date or until_date): | if ids and (base_start_date or base_until_date): | def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") ... |
count = 0 start_date = start_date and datetime.datetime.strptime(start_date, "%Y-%m-%d") or False until_date = until_date and datetime.datetime.strptime(until_date, "%Y-%m-%d") or False for data in cr.dictfetchall(): | count = 0 for data in cr.dictfetchall(): start_date = base_start_date and datetime.datetime.strptime(base_start_date, "%Y-%m-%d") or False until_date = base_until_date and datetime.datetime.strptime(base_until_date, "%Y-%m-%d") or False | def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") ... |
sum(ail.quantity*ail.price_unit)/sum(ail.quantity*u.factor)*count(ail.product_id)::decimal(16,2) as price_average, | (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, | def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as da... |
if int(vat[0:2]) == 0 and len(vat) == 10: | if int(vat[0:2]) in (0, 10, 20) and len(vat) == 10: | def check_vat_sk(self, vat): ''' Check Slovakia VAT number. ''' try: int(vat) except: return False if len(vat) not in(9, 10): return False |
help="Number of operations this workcenter can do."), 'hour_nbr': fields.float('Number of Hours', required=True, help="Time in hours for doing one cycle."), | 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."), | def on_change_product_cost(self, cr, uid, ids, product_id, context=None): if context is None: context = {} value = {} |
'unit_amount': wc.costs_hour * wc.time_cycle, | 'unit_amount': wc_line.hour, | def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_... |
'unit_amount': wc.costs_hour * wc.time_cycle, | 'unit_amount': wc_line.cycle, | def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_... |
def _get_company(self, cr, uid, ids, context={}): | def _get_company(self, cr, uid, context={}): | def _get_company(self, cr, uid, ids, context={}): user_obj = self.pool.get('res.users') company_obj = self.pool.get('res.company') user = user_obj.browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id else: return company_obj.search(cr, uid, [('parent_id', '=', False)])[0] |
return {'value': {'work_email':mail}} | return {'value': {'work_email':mail.user_email}} | def onchange_user(self, cr, uid, ids, user_id, context=None): mail = self.pool.get('res.users').browse(cr,uid,user_id) return {'value': {'work_email':mail}} |
if inv.type == 'out_invoice': xml_id = 'action_invoice_tree1' elif inv.type == 'in_invoice': xml_id = 'action_invoice_tree2' elif inv.type == 'out_refund': | if inv.type in ('out_invoice', 'out_refund'): | def compute_refund(self, cr, uid, ids, mode='refund', context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs |
'create_date': fields.datetime('Latest Date of Inventory'), } | 'date': fields.datetime('Latest Inventory Date'), } | def unlink(self, cr, uid, ids, context={}): raise osv.except_osv(_('Error !'), _('You cannot delete any record!')) |
l.id as id, | min(l.id) as id, | def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""") |
max(l.create_date) as create_date | max(s.date) as date | def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""") |
group by p.id,l.id | and s.state = 'done' group by p.id | def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""") |
amount = currency_obj.compute(cr, user, line.currency_id.id, | amount = currency_obj.compute(cr, uid, line.currency_id.id, | def populate_statement(self, cr, uid, ids, context=None): |
amount = currency_obj.compute(cr, user, line.invoice.currency_id.id, | amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id, | def populate_statement(self, cr, uid, ids, context=None): |
group_id = model_data_obj._get_id(cr, uid, 'survey', 'base.group_tool_user') | group_id = model_data_obj._get_id(cr, uid, 'base', 'group_tool_user') | def action_send(self, cr, uid, ids, context=None): record = self.read(cr, uid, ids, []) survey_ids = context.get('active_ids', []) record = record and record[0] partner_ids = record['partner_ids'] user_ref= self.pool.get('res.users') survey_ref= self.pool.get('survey') |
super(account_cash_statement, self).write(cr, uid, rs, res.get(rs)) | super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs)) | def write(self, cr, uid, ids, vals, context=None): """ Update redord(s) comes in {ids}, with new value comes as {vals} return True on success, False otherwise |
string="Return with Echange" type="object"/> | string="Return with Exchange" type="object"/> | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): |
select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty | select stock.create_date as date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty | def init(self, cr): tools.drop_view_if_exists(cr, 'report_products_to_received_planned') cr.execute(""" create or replace view report_products_to_received_planned as ( select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on... |
select stock.date, min(stock.id) as id, 0 as actual_qty, sum(stock.product_qty) as planned_qty | select stock.date as date , min(stock.id) as id, 0 as actual_qty, sum(stock.product_qty) as planned_qty | def init(self, cr): tools.drop_view_if_exists(cr, 'report_products_to_received_planned') cr.execute(""" create or replace view report_products_to_received_planned as ( select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on... |
value = {} | value = {'product_uom_id': ''} | def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}): |
if product_uom_id != prod.uom_id.id: value = {'product_uom_id': prod.uom_id.id} | def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}): | |
for employee_id in ids: emp = obj_emp.read(cr, uid, [employee_id], ['name'])[0] stop, days_xml = False, [] user_repr = ''' <user> <name>%s</name> %%s </user> ''' % (toxml(emp['name'])) today, tomor = month, month + one_day while today.month == month.month: sql = ''' select action, att.name from hr_employee as emp inne... | if emp_ids: for emp in obj_emp.read(cr, uid, emp_ids, ['name']): stop, days_xml = False, [] user_repr = ''' <user> <name>%s</name> %%s </user> ''' % (toxml(emp['name'])) today, tomor = month, month + one_day while today.month == month.month: sql = ''' select action, att.name from hr_employee as emp inner join hr_atten... | def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') if context is None: context = {} month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1) user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year] for emp... |
res += char.lower() | res += char.upper() | def _format_iban(string): ''' This function removes all characters from given 'string' that isn't a alpha numeric and converts it to lower case. ''' res = "" for char in string: if char.isalnum(): res += char.lower() return res |
iban = _format_iban(bank_acc.iban) | iban = _format_iban(bank_acc.iban).lower() | def check_iban(self, cr, uid, ids): ''' Check the IBAN number ''' for bank_acc in self.browse(cr, uid, ids): if not bank_acc.iban: continue iban = _format_iban(bank_acc.iban) if iban[:2] in _iban_len and len(iban) != _iban_len[iban[:2]]: return False #the four first digits have to be shifted to the end iban = iban[4:] ... |
address_ids = address_pool.search(cr, uid, [('email', '=', from_email)]) | address_ids = address_pool.search(cr, uid, [('email', 'like', from_email)]) | def get_partner(self, cr, uid, from_email, context=None): """This function returns partner Id based on email passed @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 from_email: email address based on that function will sea... |
nmonth = str(int(next_date.strftime("%m"))% 12+2) | nmonth = str(int(next_date.strftime("%m"))% 12+1) | def compute(self, cr, uid, id, value, date_ref=False, context={}): if not date_ref: date_ref = datetime.now().strftime('%Y-%m-%d') pt = self.browse(cr, uid, id, context) amount = value result = [] for line in pt.line_ids: prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') if line.value == 'fixe... |
"Function: %s" % (pa.function and pa.function.name_get()[0][1] or ''), | "Function: %s" % (pa.function or ''), | def get_lead_details(self, cr, uid, lead_id, context=None): body = [] lead_proxy = self.pool.get('crm.lead') lead = lead_proxy.browse(cr, uid, lead_id, context=context) if not lead.type or lead.type == 'lead': field_names = [ 'partner_name', 'title', 'function', 'street', 'street2', 'zip', 'city', 'country_id', 'state_... |
clause += 'AND inv.state <> \'paid\'' | clause += 'AND inv.state != \'cancel\' AND sale.state != \'cancel\' AND inv.state <> \'paid\' AND rel.order_id = sale.id ' sale_clause = ', sale_order AS sale ' | def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True |
'FROM sale_order_invoice_rel AS rel, account_invoice AS inv ' \ | 'FROM sale_order_invoice_rel AS rel, account_invoice AS inv '+ sale_clause + \ | def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True |
'FROM sale_order_invoice_rel AS rel) ') | 'FROM sale_order_invoice_rel AS rel) and sale.state != \'cancel\'') | def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True |
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False | def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None, lock=False): """ Attempt to find a quantity ``product_qty`` (in the product's default uom or the uom passed in ``context``) of product ``product_id`` in locations with id ``ids`` and their child locations. If ``lock`` is True, the stock.mov... | def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):... |
cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id, id, product_id)) | if lock: try: cr.execute("SAVEPOINT stock_location_product_reserve") cr.execute("""SELECT id FROM stock_move WHERE product_id=%s AND ( (location_dest_id=%s AND location_id<>%s AND state='done') OR (location_id=%s AND location_dest_id<>%s AND state in ('done', 'assigned')) ) FOR UPDATE of stock_move NOWAIT""", (prod... | def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):... |
cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id, id, product_id)) | cr.execute("""SELECT product_uom,-sum(product_qty) AS product_qty FROM stock_move WHERE location_id=%s AND location_dest_id<>%s AND product_id=%s AND state in ('done', 'assigned') GROUP BY product_uom """, (id, id, product_id)) | def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):... |
res = self.pool.get('stock.location')._product_reserve(cr, uid, [move.location_id.id], move.product_id.id, move.product_qty, {'uom': move.product_uom.id}) | res = self.pool.get('stock.location')._product_reserve(cr, uid, [move.location_id.id], move.product_id.id, move.product_qty, {'uom': move.product_uom.id}, lock=True) | def check_assign(self, cr, uid, ids, context=None): """ Checks the product type and accordingly writes the state. @return: No. of moves done """ done = [] count = 0 pickings = {} if context is None: context = {} for move in self.browse(cr, uid, ids, context=context): if move.product_id.type == 'consu': if move.state in... |
values['description']=this.notes values['partner_id']=this.partner_id | values['description']=this.notes or '' values['partner_id']=this.partner_id.id | def action_apply(self, cr, uid, ids, context=None): this = self.browse(cr, uid, ids)[0] record_id = context and context.get('record_id', False) or False values={} values['name']=this.name values['user_id']=this.user_id and this.user_id.id values['categ_id']=this.category_id and this.category_id.id values['section_id']=... |
class audittrail_objects_proxy(osv_pool): | class audittrail_objects_proxy(object_proxy): | def _name_get_resname(self, cr, uid, ids, *args): data = {} for resname in self.browse(cr, uid, ids,[]): model_object = resname.object_id res_id = resname.res_id if model_object and res_id: model_pool = self.pool.get(model_object.model) res = model_pool.read(cr, uid, res_id, ['name']) data[resname.id] = res['name'] els... |
'name': pool.get('ir.sequence').get(cr, uid, 'stock.picking'), | 'name': pool.get('ir.sequence').get(cr, uid, 'stock.picking.in'), | def _do_split(self, cr, uid, data, context): move_obj = pooler.get_pool(cr.dbname).get('stock.move') pick_obj = pooler.get_pool(cr.dbname).get('stock.picking') delivery_obj = pooler.get_pool(cr.dbname).get('stock.delivery') pick = pick_obj.browse(cr, uid, [data['id']])[0] new_picking = None new_moves = [] complete, to... |
pur_tax_parent = mod_obj._get_id(cr, uid, 'account', 'vat_code_base_purchases') | pur_tax_parent = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_purchases') | def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid,... |
sal_tax_parent = mod_obj._get_id(cr, uid, 'account', 'vat_code_base_sales') | sal_tax_parent = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_sales') | def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid,... |
'name': 'VAT%s%%'%(s_tax*100), 'code': 'VAT%s%%'%(s_tax*100), | 'name': 'TAX%s%%'%(s_tax*100), 'code': 'TAX%s%%'%(s_tax*100), | def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid,... |
{'name':'VAT%s%%'%(s_tax*100), 'description':'VAT%s%%'%(s_tax*100), | {'name':'TAX%s%%'%(s_tax*100), 'description':'TAX%s%%'%(s_tax*100), | def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid,... |
'name': 'VAT%s%%'%(p_tax*100), 'code': 'VAT%s%%'%(p_tax*100), | 'name': 'TAX%s%%'%(p_tax*100), 'code': 'TAX%s%%'%(p_tax*100), | def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid,... |
{'name':'VAT%s%%'%(p_tax*100), 'description':'VAT%s%%'%(p_tax*100), | {'name':'TAX%s%%'%(p_tax*100), 'description':'TAX%s%%'%(p_tax*100), | def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid,... |
if move.prodlot_id and (move.prodlot_id.product_id.id != move.product_id.id): | if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): | def _check_product_lot(self, cr, uid, ids): for move in self.browse(cr, uid, ids): if move.prodlot_id and (move.prodlot_id.product_id.id != move.product_id.id): return False return True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.