rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
visibility = False if vals.get('category_id', False): category_pool = self.pool.get('idea.category') category = category_pool.browse(cr, user, vals.get('category_id'), context) visibility = category.visibility vals.update({ 'visibility':visibility }) | def write(self, cr, user, ids, vals, context=None): """ Update redord(s) exist in {ids}, with new value provided in {vals} | |
rcal = self.export_cal(cr, uid, r_ids, 'vevent', context=context) | r_datas = model_obj.read(cr, uid, r_ids, context=context) rcal = CalDAV.export_cal(self, cr, uid, r_datas, 'vevent', context=context) for revents in rcal.contents.get('vevent', []): ical.contents['vevent'].append(revents) | def create_ics(self, cr, uid, datas, name, ical, context=None): """ create calendaring and scheduling information @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 """ |
data_ids = mod_obj.search(cr, uid, line_domain, context=context) | data_ids = mod_obj.search(cr, uid, line_domain, order="id", context=context) | def get_calendar_objects(self, cr, uid, ids, parent=None, domain=None, context=None): if not context: context = {} if not domain: domain = [] res = [] ctx_res_id = context.get('res_id', None) ctx_model = context.get('model', None) for cal in self.browse(cr, uid, ids): for line in cal.line_ids: if ctx_model and ctx_mode... |
def get_children(self,uri, filters=None): | def get_childs(self,uri, filters=None): | def get_children(self,uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get children: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True) |
fp = Popen(['file','-b',fname], shell=False, stdout=PIPE).stdout | fp = Popen(['file','-b','--mime',fname], shell=False, stdout=PIPE).stdout | def doIndex(self,content, filename=None, content_type=None, realfname = None, debug=False): fobj = None fname = None mime = None if content_type and self.mimes.has_key(content_type): mime = content_type fobj = self.mimes[content_type] elif filename: bname,ext = os.path.splitext(filename) if self.exts.has_key(ext): fobj... |
mime2 = result.strip() | mime2 = result.split(';')[0] | def doIndex(self,content, filename=None, content_type=None, realfname = None, debug=False): fobj = None fname = None mime = None if content_type and self.mimes.has_key(content_type): mime = content_type fobj = self.mimes[content_type] elif filename: bname,ext = os.path.splitext(filename) if self.exts.has_key(ext): fobj... |
'planned_hours': fields.float('Planned Hours', required=True, help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'), | 'planned_hours': fields.float('Planned Hours', help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'), | 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 |
('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model !'), ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model !'), | ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model (Credit Or Debit Must Be "0")!'), ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model (Credit + Debit Must Be greater "0")!'), | def generate(self, cr, uid, ids, datas={}, context={}): move_ids = [] for model in self.browse(cr, uid, ids, context): period_id = self.pool.get('account.period').find(cr,uid, context=context) if not period_id: raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !')) period_id = period_id[0] m... |
result = obj_model.read(cr, uid, [vals['res_id']], context=context) | result = obj_model.read(cr, uid, [vals['res_id']], ['name', 'partner_id', 'address_id'], context=context) | def create(self, cr, uid, vals, context=None): if not context: context = {} vals['title'] = vals['name'] vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False) if not vals['parent_id']: vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context) if not vals.... |
if not ids: raise osv.except_osv(_('Invalid !'), _('Please save voucher before selection partner !')) line_ids = line_pool.search(cr, uid, [('voucher_id','=',ids[0])]) if line_ids: line_pool.unlink(cr, uid, line_ids) voucher_id = ids[0] | voucher_id = ids and ids[0] or False | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, context={}): """ Returns a dict that contains new values and context @param cr: A database cursor @param user: ID of the user currently logged in @param partner_id: latest value from user input for field partner_id @param args: other arguments @param conte... |
result[id] = price | result[id] = price result['item_id'] = {id: item_id} | def price_get(self, cr, uid, ids, prod_id, qty, partner=None, context=None): ''' context = { 'uom': Unit of Measure (int), 'partner': Partner ID (int), 'date': Date of the pricelist (%Y-%m-%d), } ''' context = context or {} currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') supp... |
'type': 'other', | 'type': 'liquidity', | def execute(self, cr, uid, ids, context=None): obj_multi = self.browse(cr, uid, ids[0]) obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.templ... |
vals_journal['type'] = 'cash' | vals_journal['type'] = line.account_type == 'cash' and 'cash' or 'bank' | def execute(self, cr, uid, ids, context=None): obj_multi = self.browse(cr, uid, ids[0]) obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.templ... |
consumed_products[consumed_product.product_id.id] = 0 consumed_products[consumed_product.product_id.id] -= consumed_product.product_qty | consumed_products[consumed_product.product_id.id] = consumed_product.product_qty check[consumed_product.product_id.id] = 0 for f in production.product_lines: if f.product_id.id == consumed_product.product_id.id: if (len(production.move_lines2) - scraped) > len(production.product_lines): check[consumed_product.product_i... | def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): """ To produce final product based on production mode (consume/consume&produce). If Production mode is consume, all stock move lines of raw materials will be done/consumed. If Production mode is consume & produce, all stock... |
rest_qty = production_qty * f.product_qty / production.product_qty - consumed_qty if rest_qty > 0: stock_mov_obj.action_consume(cr, uid, [raw_product.id], rest_qty, production.location_src_id.id, context=context) | if consumed_qty == 0: consumed_qty = production_qty * f.product_qty / production.product_qty if consumed_qty > 0: stock_mov_obj.action_consume(cr, uid, [raw_product.id], consumed_qty, production.location_src_id.id, context=context) | def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): """ To produce final product based on production mode (consume/consume&produce). If Production mode is consume, all stock move lines of raw materials will be done/consumed. If Production mode is consume & produce, all stock... |
vals_line['amount'] = 00.0 | vals_line['amount'] = 0.0 | def create(self, cr, uid, vals, *args, **kwargs): obj_timesheet = self.pool.get('hr.analytic.timesheet') task_obj = self.pool.get('project.task') vals_line = {} obj_task = task_obj.browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (... |
timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=kwargs['context']) | timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context) | def create(self, cr, uid, vals, *args, **kwargs): obj_timesheet = self.pool.get('hr.analytic.timesheet') task_obj = self.pool.get('project.task') vals_line = {} obj_task = task_obj.browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (... |
prod_id, amount, unit, context=kwargs['context']) if amount_unit: vals_line['amount'] = (-1) * vals['hours']* (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj_timesheet.write(cr, uid, [timeline_id], vals_line, {}) | prod_id, amount, unit, context=context) if amount_unit and 'amount' in amount_unit.get('value',{}): updv = { 'amount': amount_unit['value']['amount'] * (-1.0) } obj_timesheet.write(cr, uid, [timeline_id], updv, context=context) | def create(self, cr, uid, vals, *args, **kwargs): obj_timesheet = self.pool.get('hr.analytic.timesheet') task_obj = self.pool.get('project.task') vals_line = {} obj_task = task_obj.browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (... |
vals_line = {} | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_i... | |
task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_id list_avail_ids = timesheet_obj.search(cr, uid, [], context=context) if line_id in list_avail_ids: | if isinstance(ids, (long, int)): ids = [ids,] for task in self.browse(cr, uid, ids, context=context): line_id = task.hr_analytic_timesheet_id if not line_id: continue vals_line = {} | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_i... |
vals_line['product_id'] = result['product_id'] vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['product_uom_id'] = result['product_uom_id'] | for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'): if result.get(fld, False): vals_line[fld] = result[fld] | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_i... |
unit = False amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context=context) if amount_unit: vals_line['amount'] = (-1) * vals['hours'] * (amount_unit.get('value',{}).get('amount',0.0) or 0.0) obj.write(cr, uid, [line_id], vals_line, context=context) | amount_unit = obj.on_change_unit_amount(cr, uid, line_id.id, prod_id=prod_id, unit_amount=vals_line['unit_amount'], unit=False, context=context) if amount_unit and 'amount' in amount_unit.get('value',{}): vals_line['amount'] = amount_unit['value']['amount'] * (-1.0) obj.write(cr, uid, [line_id.id], vals_line, context... | def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} vals_line = {} obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0] line_id = task.hr_analytic_timesheet_i... |
pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] | hat_obj = self.pool.get('hr.analytic.timesheet') hat_ids = [] for task in self.browse(cr, uid, ids): if task.hr_analytic_timesheet_id: hat_ids.append(task.hr_analytic_timesheet_id) | def unlink(self, cr, uid, ids, *args, **kwargs): pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] |
list_avail_ids = pool_analytic_timesheet.search(cr, uid, []) if timesheet_id in list_avail_ids: obj = pool_analytic_timesheet.unlink(cr, uid, [timesheet_id], *args, **kwargs) | if hat_ids: hat_obj.unlink(cr, uid, hat_ids, *args, **kwargs) | def unlink(self, cr, uid, ids, *args, **kwargs): pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] |
'hr_analytic_timesheet_id':fields.integer('Related Timeline Id') | 'hr_analytic_timesheet_id':fields.many2one('hr.analytic.timesheet','Related Timeline Id', ondelete='set null'), | def unlink(self, cr, uid, ids, *args, **kwargs): pool_analytic_timesheet = self.pool.get('hr.analytic.timesheet') for work_id in ids: timesheet_id = self.read(cr, uid, work_id, ['hr_analytic_timesheet_id'])['hr_analytic_timesheet_id'] |
def _lang_get(self, cr, uid, context={}): | def _lang_get(self, cr, uid, context=None): | def _lang_get(self, cr, uid, context={}): """ Get language for language selection field. @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 @return: list of dictionary which contain code and name and id... |
def _tz_get(self, cr, uid, context={}): | def _tz_get(self, cr, uid, context=None): | def _tz_get(self, cr, uid, context={}): return [(x.lower(), x) for x in pytz.all_timezones] |
def onchange_allday(self, cr, uid, ids, allday, context={}): | def onchange_allday(self, cr, uid, ids, allday, context=None): | def onchange_allday(self, cr, uid, ids, allday, context={}): """Sets duration as 24 Hours if event is selcted for all day @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 calendar event’s IDs. @param allday: ... |
def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}): | def browse(self, cr, uid, ids, context=None, list_class=None, fields_process=None): | def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}): """ Overrides orm browse 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 context: A standard... |
WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %s", (date1, date2, a['id'])) | WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %s", (date1, date2, a['id'])) | def _lines_p(self, date1, date2): res = [] acc_obj = self.pool.get('account.account') |
WHERE date>=%s AND date<=%s AND amount<0 AND general_account_id = %s", (date1, date2, a['id'])) | WHERE date>=%s AND date<=%s AND amount>0 AND general_account_id = %s", (date1, date2, a['id'])) | def _lines_p(self, date1, date2): res = [] acc_obj = self.pool.get('account.account') |
'confirmed': "is scheduled for the '" + datetime.strptime(pick.min_date, '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d') + "'.", | 'confirmed': "is scheduled for the '" + msg , | def log_picking(self, cr, uid, ids, context=None): """ This function will create log messages for picking. @param cr: the database cursor @param uid: the current user's ID for security checks, @param ids: List of Picking Ids @param context: A standard dictionary for contextual values """ for pick in self.browse(cr, uid... |
if not view_id and context.get('invoice_type', False): | if not view_id: | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj.get_object_reference(cr, uid, '... |
if context.get('invoice_type') in ('out_invoice', 'out_refund'): | if context.get('invoice_type', False) in ('out_invoice', 'out_refund') or context.get('line_type', False) == 'customer': | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj.get_object_reference(cr, uid, '... |
xml_id = 'action_invoice_tree5' | xml_id = 'action_invoice_tree1' | def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = ... |
xml_id = 'action_invoice_tree8' | xml_id = 'action_invoice_tree2' | def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = ... |
xml_id = 'action_invoice_tree10' | xml_id = 'action_invoice_tree3' | def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = ... |
xml_id = 'action_invoice_tree12' | xml_id = 'action_invoice_tree4' | def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = ... |
partner_id = partner_rec.id or False | partner_id = partner.id or False | def make_po(self, cr, uid, ids, context={}): """ Make purchase order from procurement @return: New created Purchase Orders procurement wise """ res = {} company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id partner_obj = self.pool.get('res.partner') uom_obj = self.pool.get('product.uom') priceli... |
self.log(cr, uid, lead.id, | leads.log(cr, uid, lead.id, | def action_apply(self, cr, uid, ids, context=None): """ This converts lead to opportunity and opens Opportunity view @param ids: ids of the leads to convert to opportunities |
avg(extract('epoch' from (date_closed-c.create_date)))/3600 as delay_close | avg(extract('epoch' from (date_closed-c.create_date)))/(3600*24) as delay_close | def init(self, cr): """ Display Est.Revenue , Average Probability ,Est.Revenue Probability @param cr: the current row, from the database cursor """ |
self.write(cr, uid, [t.id], {'state': 'open', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),}) | data = {'state': 'open'} if not t.date_start: data['date_start'] = time.strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [t.id], data) | def do_open(self, cr, uid, ids, *args): tasks= self.browse(cr,uid,ids) for t in tasks: self.write(cr, uid, [t.id], {'state': 'open', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),}) message = _('Task ') + " '" + t.name + "' "+ _("is Open.") self.log(cr, uid, t.id, message) return True |
new_ids = [] if (data['model'] == 'account.account'): new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or [] else: new_ids.append(data['form']['chart_account_id']) | new_ids = ids if (data['model'] == 'ir.ui.menu'): new_ids = [data['form']['chart_account_id']] | def set_context(self, objects, data, ids, report_type=None): self.borne_date = self.get_min_date(data['form']) new_ids = [] if (data['model'] == 'account.account'): new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or [] else: new_ids.append(data['form']['chart_account_id']) ob... |
update_val['product_uos_qty'] = uos_qty_rest | update_val['product_uos_qty'] = uos_qty_rest if location_dest_id: update_val.update({'location_dest_id': location_dest_id}) if location_id: update_val.update({'location_id': location_id}) | def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !')) |
class report_products_to_received_planned(osv.osv): _name = "report.products.to.received.planned" _description = "Received Products vs Planned" _auto = False _columns = { 'date':fields.date('Date'), 'qty': fields.float('Actual Qty', digits_compute=dp.get_precision('Product UoM')), 'planned_qty': fields.float('Planned Q... | def action_move(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') picking_obj = self.pool.get('stock.picking') account_move_obj = self.pool.get('account.move') for act in self.read(cr, uid, ids): move_lines = move_obj.browse(cr, uid, act['move_ids']) for line in move_lines: if line.picking_id: p... | |
FROM res_partner,account_move_line AS l, account_account\ | FROM res_partner,account_move_line AS l, account_account, account_move am\ | def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS rec... |
ORDER BY res_partner.name', (self.date_from,)) | ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,)) | def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS rec... |
move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] | def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS rec... | |
GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from)) | AND (l.date <= %s)\ GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from, self.date_from,)) | def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS rec... |
GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids),self.date_from)) | AND (l.date <= %s)\ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids),self.date_from, self.date_from,)) | def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS rec... |
self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit)\ FROM account_move_line AS l, account_account, account_move am \ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\ AND (am.state IN %s)\ AND (account_account.type IN %s)\ AND (l.partner_id IN %s)\ AND ((l.reconcile_id IS NULL)\ OR (l.reconcile_i... | args_list += (self.date_from,) self.cr.execute('''SELECT l.partner_id, SUM(l.debit-l.credit) FROM account_move_line AS l, account_account, account_move am WHERE (l.account_id = account_account.id) AND (l.move_id=am.id) AND (am.state IN %s) AND (account_account.type IN %s) AND (l.partner_id IN %s) AND ((l.reconcile_id I... | def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS rec... |
if values['total']: res.append(values) | res.append(values) | def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS rec... |
AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from)) | AND (l.date <= %s)\ AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,)) | def _get_lines_with_out_partner(self, form): res = [] move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] |
args_list += (self.date_from,) | def _get_lines_with_out_partner(self, form): res = [] move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] | |
def _sheet_search(self, cursor, user, obj, name, args): | def _sheet_search(self, cursor, user, obj, name, args, context={}): | def _sheet_search(self, cursor, user, obj, name, args): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') |
AND s.user_id = e.user_id) ' + \ | AND s.user_id = r.user_id) ' + \ | def _sheet_search(self, cursor, user, obj, name, args): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') |
return True | def process_wi_email(self, cr, uid, activity, workitem, context=None): print 'Sending Email Init', activity.name return self.pool.get('email.template').generate_mail(cr, uid, activity.email_template_id.id, [workitem.res_id], context=context) | |
return pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application) | res = pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application) return (16, res) | def change_digit(cr): return pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application) |
"AND debit > 0", | "AND debit > 0 " \ "ORDER BY date_maturity", | 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... |
"AND credit > 0", | "AND credit > 0 " \ "ORDER BY date_maturity", | 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... |
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in') | self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in') | def sign_in(self, cr, uid, data, context=None): if context is None: context = {} emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'na... |
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out') | self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out') | def sign_out(self, cr, uid, data, context=None): emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'... |
'res.partner':(_get_partners, ['free_member', 'membership_state'], 10) | 'res.partner':(_get_partners, ['free_member', 'membership_state','associate_member'], 10) | 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 |
data = {} domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) | value = {} if case.section_id.id : domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] else : domain = [('type', '=', stage_type)] | def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {} |
data = {'stage_id': next_stage.id} | value.update({'stage_id': next_stage.id}) | def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {} |
data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) | value.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], value, context=context) | def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {} |
if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 | def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False | |
if inv.tax_amount > 0: | if inv.tax_amount: | def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False |
if inv.journal_id.type in ('sale','purchase_refund'): | if inv.journal_id.type in ('sale','purchase_refund') and amount > 0: | def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False |
return super(Wiki, self).copy_data(cr, uid, id, {'wiki_id': False}, context) | return super(wiki_wiki2, self).copy_data(cr, uid, id, {'wiki_id': False}, context) | def copy_data(self, cr, uid, id, default=None, context=None): |
employee_ids=employee_obj.search(cr, uid, [('parent_id','=',employee.id)], context=context) | def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): if context is None: context = {} evaluation_plan_id=False if employee_id: employee_obj=self.pool.get('hr.employee') for employee in employee_obj.browse(cr, uid, [employee_id], context=context): if employee and employee.evaluation_plan_id and emplo... | |
apprai_id = [] | 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 ==... | |
def msg_new(self, cr, uid, msg, model): print ' MSG NEW' , model | def msg_new(self, cr, uid, msg, model): | def msg_new(self, cr, uid, msg, model): print ' MSG NEW' , model message = self.msg_body_get(msg) res_model = self.pool.get(model) res_id = res_model.msg_new(cr, uid, msg) if res_id: attachments = message['attachment'] |
warning += [_("Relation not found: %s on '%s'") % (line[i], relation)] | warning += [_("Relation not found: %s on '%s'") % (word, relation)] | def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in... |
_("Relation not found: %s on '%s'") % (line[i], relation)) | _("Relation not found: %s on '%s'") % (word, relation)) | def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in... |
'title': 'Bad Lot Assignation !', 'message': 'You are moving %.2f products but only %.2f available in this lot.' % (product_qty, prodlot.stock_available or 0.0) | 'title': _('Bad Lot Assignation !'), 'message': _('You are moving %.2f products but only %.2f available in this lot.') % (product_qty, prodlot.stock_available or 0.0) | def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False, loc_id=False, product_id=False, context=None): """ On change of production lot gives a warning message. @param prodlot_id: Changed production lot id @param product_qty: Quantity of product @param loc_id: Location id @param product_id: Product ... |
required=True, | required=False, | def _get_charts(self, cr, uid, context=None): modules = self.pool.get('ir.module.module') ids = modules.search(cr, uid, [('category_id','=','Account Charts')]) charts = list( sorted(((m.name, m.shortdesc) for m in modules.browse(cr, uid, ids)), key=itemgetter(1))) charts.insert(0,('configurable','Generic Chart Of Accou... |
data_id = data_pool.search(cr, uid, [('model','=','account.account'), ('name','=','chart0')]) if data_id: data = data_pool.browse(cr, uid, data_id[0]) account_id = data.res_id acc_ids = obj_acc._get_children_and_consol(cr, uid, [account_id]) if acc_ids: cr.execute("update account_account set active='f' where id in " + ... | def execute(self, cr, uid, ids, context=None): if context is None: context = {} data_pool = self.pool.get('ir.model.data') obj_acc = self.pool.get('account.account') super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('r... | |
self.rpc(self.model, 'history', [id], 'Receive', True, msg['From'], message['body'], False, False, {'model' : self.model}) | self.rpc(self.model, 'history', [id], 'Receive', True, msg_to, message['body'], msg_from, False, {'model' : self.model}) | def msg_new(self, msg): message = self.msg_body_get(msg) msg_subject = self._decode_header(msg['Subject']) msg_from = self._decode_header(msg['From']) msg_cc = self._decode_header(msg['Cc'] or '') data = { 'name': msg_subject, 'email_from': msg_from, 'email_cc': msg_cc, 'user_id': False, 'description': message['body']... |
self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], body['body']) | self.rpc(self.model, 'history', [id], 'Send', True, self._decode_header(msg['From']), body['body']) | def msg_user(self, msg, id): body = self.msg_body_get(msg) |
self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], message['body']) | self.rpc(self.model, 'history', [id], 'Send', True, self._decode_header(msg['From']), message['body']) | def msg_partner(self, msg, id): message = self.msg_body_get(msg) body = message['body'] act = 'case_open' self.rpc(self.model, act, [id]) #body2 = '\n'.join(map(lambda l: '> '+l, (body or '').split('\n'))) #data = { # 'description':body, #} #self.rpc(self.model, 'write', [id], data) attachments = message['attachment... |
if not context.get('allow_write_off', False): | if not allow_write_off: | 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', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['... |
HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) | HAVING ABS(SUM(debit-credit)) = %s AND count(*)>0"%(account_id, 0.0) | 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', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['... |
HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) | HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0"%(account_id, max_amount or 0.0) | 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', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['... |
if not context.get('allow_write_off', False): | if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: | 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', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['... |
else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) | 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', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['... | |
'nodestroy':True, | 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', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['... | |
'alert_date': fields.datetime('Alert Date', help="The date signifying an alert to notify about the production lot."), | 'alert_date': fields.datetime('Alert Date', help="The date an alert should be notified about the production lot."), | def calc_date(self, cr, uid, context=None): """Compute the limit date for a given date""" if context is None: context = {} if not context.get('product_id', False): date = False else: product = pooler.get_pool(cr.dbname).get('product.product').browse( cr, uid, context['product_id']) duration = getattr(product, dtype) # ... |
'alert_time': fields.integer('Product Alert Time', help="The number of days after which, needs an alert to notify about the production lot."), | 'alert_time': fields.integer('Product Alert Time', help="The number of days after which an alert should be notified about the production lot."), | def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {}... |
sum(planned_revenue) as amount_revenue, sum(planned_cost) as amount_costs, sum(planned_revenue*probability/100)::decimal(16,2) as amount_revenue_prob, avg(probability)::decimal(16,2) as probability, | def init(self, cr): tools.drop_view_if_exists(cr, 'project_issue_report') cr.execute(""" create or replace view project_issue_report as ( select min(c.id) as id, to_char(c.create_date, 'YYYY') as name, to_char(c.create_date, 'MM') as month, c.state, c.user_id, c.section_id, c.categ_id, c.stage_id, count(*) as nbr, sum(... | |
for inv in self.browse(cr,uid,ids): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context) | for inv in self.browse(cr, uid, ids, context=context): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context) | def action_done(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') for inv in self.browse(cr,uid,ids): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context) return True |
c['location'] = loc_id for prod in product_product_obj.browse(cr, uid, product_ids, context=c): for f in field_names: if f == 'stock_real': result[loc_id][f] += prod.qty_available elif f == 'stock_virtual': result[loc_id][f] += prod.virtual_available elif f == 'stock_real_value': amount = prod.qty_available * prod.stan... | if loc_id in ids: c['location'] = loc_id for prod in product_product_obj.browse(cr, uid, product_ids, context=c): for f in field_names: if f == 'stock_real': result[loc_id][f] += prod.qty_available elif f == 'stock_virtual': result[loc_id][f] += prod.virtual_available elif f == 'stock_real_value': amount = prod.qty_ava... | 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 """ result = dict([(i, {}.fromkeys(field_names, 0.0)) for i in ids]) |
repeated_move_line_ids.append(move_line_id) | repeated_move_line_ids += move_line_id | def _search_invoices(obj, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) line_obj = pool.get('account.move.line') statement_obj = pool.get('account.bank.statement') journal_obj = pool.get('account.journal') statement = statement_obj.browse(cr, uid, data['id'], context=context) args_move_line = [] repeated_... |
c.type_id as type_id, | c.type_action as type_action, | def init(self, cr): |
c.priority,c.type_id,c.date_deadline,c.date_closed | c.priority,c.type_action,c.date_deadline,c.date_closed | def init(self, cr): |
m.exdate, m.exrule from " + self._table + \ | m.exdate, m.exrule, m.recurrent_id, m.recurrent_uid from " + self._table + \ | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): """Gives virtual event ids for recurring events based on value of Recurrence Rule This method gives ids of dates that comes between start date and end date of calendar views @param self: The object pointer @param cr: the current ... |
result.append(idval) count += 1 | if not data['recurrent_id']: result.append(idval) count += 1 else: ex_id = real_id2base_calendar_id(data['recurrent_uid'], data['recurrent_id']) recur_dict.append(ex_id) | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): """Gives virtual event ids for recurring events based on value of Recurrence Rule This method gives ids of dates that comes between start date and end date of calendar views @param self: The object pointer @param cr: the current ... |
ids = result | ids = list(set(result)-set(recur_dict)) | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): """Gives virtual event ids for recurring events based on value of Recurrence Rule This method gives ids of dates that comes between start date and end date of calendar views @param self: The object pointer @param cr: the current ... |
attrs.append("attrs='{'readonly':[('state','=','valid')]}'") | attrs.append('''attrs="{'readonly':[('state','=','valid')]}"''') | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') |
linktopartner = "http:\\\\"+web_server+":"+str(web_server_port)+"\\openerp\\form\\view?model=res.partner&id="+str(vals) win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, linktopartner) | linktopartner = "http://"+web_server+":"+str(web_server_port)+"/openerp/form/view?model=res.partner&id="+str(vals) win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, str(linktopartner)) | def OpenPartnerForm(txtProcessor,*args): import win32con b = check() if not b: return #Acquiring control of the text box partner_link = txtProcessor.GetControl() #Reading Current Selected Email. ex = txtProcessor.window.manager.outlook.ActiveExplorer() assert ex.Selection.Count == 1 mail = ex.Selection.Item(1) partner_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.