rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.obj_pl = report_pl.report_pl_account_horizontal(cr, uid, name, context=context) | self.obj_pl = account_profit_loss.report_pl_account_horizontal(cr, uid, name, context=context) | def __init__(self, cr, uid, name, context=None): super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context=context) self.obj_pl = report_pl.report_pl_account_horizontal(cr, uid, name, context=context) self.result_sum_dr = 0.0 self.result_sum_cr = 0.0 self.result = {} self.res_bl = {} self.result_temp ... |
ids = map(lambda x: base_calendar_id2real_id(x), ids) | ids = map(lambda x: base_calendar.base_calendar_id2real_id(x), ids) | def export_cal(self, cr, uid, ids, context={}): ids = map(lambda x: base_calendar_id2real_id(x), ids) event_data = self.read(cr, uid, ids) event_obj = self.pool.get('basic.calendar.event') ical = event_obj.export_cal(cr, uid, event_data, context={'model': self._name}) return ical.serialize() |
period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])[0]['date_start'] period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])[0]['date_stop'] | period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])['date_start'] period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])['date_stop'] | def _build_context(self, cr, uid, ids, data, context = None): result = {} result['fiscalyear'] = data['form']['fiscalyear_id'] and data['form']['fiscalyear_id'] or False if data['form']['filter'] == 'filter_date': result['date_from'] = data['form']['date_from'] result['date_to'] = data['form']['date_to'] elif data['for... |
new_qty = data['form']['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_stock_return_history: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False | def _create_returns(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) move_obj = pool.get('stock.move') pick_obj = pool.get('stock.picking') uom_obj = pool.get('product.uom') pick=pick_obj.browse(cr, uid, [data['id']])[0] new_picking=None date_cur=time.strftime('%Y-%m-%d %H:%M:%S') for move in move_obj... | |
'product_qty': data['form']['return%s' % move.id], | 'product_qty': new_qty, | def _create_returns(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) move_obj = pool.get('stock.move') pick_obj = pool.get('stock.picking') uom_obj = pool.get('product.uom') pick=pick_obj.browse(cr, uid, [data['id']])[0] new_picking=None date_cur=time.strftime('%Y-%m-%d %H:%M:%S') for move in move_obj... |
data['form']['return%s' % move.id], move.product_uos.id), | new_qty, move.product_uos.id), | def _create_returns(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) move_obj = pool.get('stock.move') pick_obj = pool.get('stock.picking') uom_obj = pool.get('product.uom') pick=pick_obj.browse(cr, uid, [data['id']])[0] new_picking=None date_cur=time.strftime('%Y-%m-%d %H:%M:%S') for move in move_obj... |
addr, port = self.request.getsockname() | if hasattr(self.request, 'getsockname'): addr, port = self.request.getsockname() | def setup(self): self.davpath = '/'+config.get_misc('webdav','vdir','webdav') addr, port = self.server.server_name, self.server.server_port server_proto = getattr(self.server,'proto', 'http').lower() try: addr, port = self.request.getsockname() except Exception, e: self.log_error("Cannot calculate own address:" , e) # ... |
self.log_error("Cannot calculate own address:" , e) | self.log_error("Cannot calculate own address: %s" , e) | def setup(self): self.davpath = '/'+config.get_misc('webdav','vdir','webdav') addr, port = self.server.server_name, self.server.server_port server_proto = getattr(self.server,'proto', 'http').lower() try: addr, port = self.request.getsockname() except Exception, e: self.log_error("Cannot calculate own address:" , e) # ... |
reference = obj_inv.reference or number or '' | reference = obj_inv.reference or '' | def action_number(self, cr, uid, ids, *args): #TODO: not correct fix but required a frech values before reading it. self.write(cr, uid, ids, {}) |
ref = reference | if not reference: ref = self._convert_ref(cr, uid, number) else: ref = reference | def action_number(self, cr, uid, ids, *args): #TODO: not correct fix but required a frech values before reading it. self.write(cr, uid, ids, {}) |
ttype = context.get('ttype', False) | ttype = context.get('type', False) | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Returns a list of ids based on search domain {args} @param cr: A database cursor @param user: ID of the user currently logged in @param args: list of conditions to be applied in search opertion @param offset: default fro... |
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): | if (m.product_id.cost_method == 'average'): | def view_init(self, cr, uid, fields_list, context=None): res = super(stock_partial_move, self).view_init(cr, uid, fields_list, context=context) move_obj = self.pool.get('stock.move') if not context: context={} for m in move_obj.browse(cr, uid, context.get('active_ids', [])): if m.state in ('done', 'cancel'): raise osv.... |
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): | if m.product_id.cost_method == 'average': | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): result = super(stock_partial_move, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) move_obj = self.pool.get('stock.move') move_ids = context.get('active_ids', False) move_ids = mov... |
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): | if m.product_id.cost_method == 'average': | def do_partial(self, cr, uid, ids, context): """ Makes partial moves and pickings done. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary ... |
def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): | def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if ids and (base_start_date or base_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:... |
result = [] | def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if ids and (base_start_date or base_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:... | |
ids = result return ids | if isinstance(select, (str, int, long)): return result and result[0] or False return result | def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if ids and (base_start_date or base_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:... |
if not isinstance(res,list): res= [res] | def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): start_date = arg[2] elif arg[1] in ('<', '<... | |
'voucher_type':inv.type, | 'type' : inv.type, | def action_move_line_create(self, cr, uid, ids, *args): for inv in self.browse(cr, uid, ids): if inv.move_id: continue company_currency = inv.company_id.currency_id.id |
pricelist_version_ids = product_pricelist_version_obj.search(cr, uid, []) | pricelist_version_ids = self.pool.get('product.pricelist').search(cr, uid, []) | def _create_parent_category_list(id, lst): if not id: return [] parent = product_category_tree.get(id) if parent: lst.append(parent) return _create_parent_category_list(parent, lst) else: return lst |
obj = self.pool.get(template.object_name.model) | def unlink_action(self, cr, uid, ids, context): for template in self.browse(cr, uid, ids, context): obj = self.pool.get(template.object_name.model) try: if template.ref_ir_act_window: self.pool.get('ir.actions.act_window').unlink(cr, uid, template.ref_ir_act_window.id, context) if template.ref_ir_value: self.pool.get('... | |
def _sheet_search(self, cursor, user, obj, name, args, context): | def _sheet_search(self, cursor, user, obj, name, args, context=None): | def _sheet_search(self, cursor, user, obj, name, args, context): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') |
def _sheet_search(self, cursor, user, obj, name, args, context={}): | def _sheet_search(self, cursor, user, obj, name, args, context=None): | def _sheet_search(self, cursor, user, obj, name, args, context={}): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') |
AND l2.id IN %%s AND """ + \ | AND l2.id IN %s AND """ + \ | def _balance(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} c = context.copy() c['initital_bal'] = True sql = """SELECT l2.id, SUM(l1.debit-l1.credit) FROM account_move_line l1, account_move_line l2 WHERE l2.account_id = l1.account_id AND l1.id <= l2.id AND l2.id IN %%s AND """ + \ self.... |
def _inherit_apply(src, inherit): | def raise_view_error(error_msg, child_view_id): view, child_view = self.pool.get('ir.ui.view').browse(cr, user, [view_id, child_view_id], context) raise AttributeError(("View definition error for inherited view '%(xml_id)s' on '%(model)s' model: " + error_msg) % { 'xml_id': child_view.xml_id, 'parent_xml_id': view.xml... | def _inherit_apply(src, inherit): def _find(node, node2): if node2.tag == 'xpath': res = node.xpath(node2.get('expr')) if res: return res[0] else: return None else: for n in node.getiterator(node2.tag): res = True if node2.tag == 'field': # only compare field names, a field can be only once in a given view # at a given... |
raise AttributeError(_('Unknown position in inherited view %s !') % pos) | raise_view_error("Invalid position value: '%s'" % pos, inherit_id) | def _find(node, node2): if node2.tag == 'xpath': res = node.xpath(node2.get('expr')) if res: return res[0] else: return None else: for n in node.getiterator(node2.tag): res = True if node2.tag == 'field': # only compare field names, a field can be only once in a given view # at a given level (and for multilevel express... |
raise AttributeError(_("Couldn't find tag '%s' in parent view !") % tag) | raise_view_error("Element '%s' not found in parent view '%%(parent_xml_id)s'" % tag, inherit_id) | def _find(node, node2): if node2.tag == 'xpath': res = node.xpath(node2.get('expr')) if res: return res[0] else: return None else: for n in node.getiterator(node2.tag): res = True if node2.tag == 'field': # only compare field names, a field can be only once in a given view # at a given level (and for multilevel express... |
result = _inherit_apply(result, inherit) | result = _inherit_apply(result, inherit, id) | def _inherit_apply_rec(result, inherit_id): # get all views which inherit from (ie modify) this view cr.execute('select arch,id from ir_ui_view where inherit_id=%s and model=%s order by priority', (inherit_id, self._name)) sql_inherit = cr.fetchall() for (inherit, id) in sql_inherit: result = _inherit_apply(result, inh... |
res_id = False | def _process_email(self, cr, uid, server, message, context={}): history_pool = self.pool.get('mail.server.history') msg_txt = email.message_from_string(message) message_id = msg_txt.get('Message-ID', False) msg = {} if not message_id: return False fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = me... | |
model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context) | if hasattr(model_pool, 'message_update'): model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context) else: logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name)) return False | def _process_email(self, cr, uid, server, message, context={}): history_pool = self.pool.get('mail.server.history') msg_txt = email.message_from_string(message) message_id = msg_txt.get('Message-ID', False) msg = {} if not message_id: return False fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = me... |
res_id = model_pool.message_new(cr, uid, msg, context) | if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_new is not define in model %s' % (model_pool._name)) return False | def _process_email(self, cr, uid, server, message, context={}): history_pool = self.pool.get('mail.server.history') msg_txt = email.message_from_string(message) message_id = msg_txt.get('Message-ID', False) msg = {} if not message_id: return False fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = me... |
self._process_email(cr, uid, server, data[0][1], context) imap_server.store(num, '+FLAGS', '\\Seen') count += 1 logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch %s email(s) from %s' % (count, server.name)) | if self._process_email(cr, uid, server, data[0][1], context): imap_server.store(num, '+FLAGS', '\\Seen') count += 1 logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch/process %s email(s) from %s' % (count, server.name)) | def fetch_mail(self, cr, uid, ids, context={}): fp = os.popen('ping www.google.com -c 1 -w 5',"r") if not fp.read(): logger.notifyChannel('imap', netsvc.LOG_WARNING, 'No address associated with hostname !') |
'period': fields.selection([('month','Monthly'), ('3months','3 Monthly')], 'Periods', required=True), 'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Your Bank and Cash Accounts',required=True), | 'period': fields.selection([('month','Monthly'), ('3months','3 Monthly')], 'Periods', required=True), 'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Your Bank and Cash Accounts'), | 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... |
'date_start': time.strftime('%Y-01-01'), 'date_stop': time.strftime('%Y-12-31'), 'period': lambda *a: 'month', 'sale_tax': lambda *a: 0.0, 'purchase_tax': lambda *a: 0.0, | 'date_start': lambda *a: time.strftime('%Y-01-01'), 'date_stop': lambda *a: time.strftime('%Y-12-31'), 'period': 'month', 'sale_tax': 0.0, 'purchase_tax': 0.0, | def _get_default_charts(self, cr, uid, context=None): module_name = False company_id = self._default_company(cr, uid, context=context) company = self.pool.get('res.company').browse(cr, uid, company_id) address_id = self.pool.get('res.partner').address_get(cr, uid, [company.partner_id.id]) if address_id['default']: addr... |
'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True), | 'bank_account_id': fields.many2one('account.installer', 'Bank Account', required=True), | def modules_to_install(self, cr, uid, ids, context=None): modules = super(account_installer, self).modules_to_install( cr, uid, ids, context=context) chart = self.read(cr, uid, ids, ['charts'], context=context)[0]['charts'] self.logger.notifyChannel( 'installer', netsvc.LOG_DEBUG, 'Installing chart of accounts %s'%char... |
s.create_date as date, to_char(s.date_from,'YYYY/mm/dd') as date_from, to_char(s.date_to,'YYYY/mm/dd') as date_to, | date_trunc('seconds',s.create_date) as date, date_trunc('day',s.date_from) as date_from, date_trunc('day',s.date_to) as date_to, | def init(self, cr): tools.drop_view_if_exists(cr, 'hr_holidays_report') cr.execute(""" create or replace view hr_holidays_report as ( select min(s.id) as id, s.create_date as date, to_char(s.date_from,'YYYY/mm/dd') as date_from, to_char(s.date_to,'YYYY/mm/dd') as date_to, s.number_of_days_temp, s.employee_id, s.user_id... |
self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ' 'WHERE id IN %s', (tuple(ids),)) | if (data['model'] == 'account.journal.period'): self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ' 'WHERE id IN %s', (tuple(ids),)) else: self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ') | def set_context(self, objects, data, ids, report_type=None): super(journal_print, self).set_context(objects, data, ids, report_type) self.cr.execute('SELECT period_id, journal_id ' 'FROM account_journal_period ' 'WHERE id IN %s', (tuple(ids),)) res = self.cr.fetchall() self.period_ids, self.journal_ids = zip(*res) |
def _compute_total(self, cr, uid, ids, name, args, context=None): position_pool = self.pool.get('account.fiscal.position') voucher_pool = self.pool.get('account.voucher') voucher_line_pool = self.pool.get('account.voucher.line') partner_pool = self.pool.get('res.partner') tax_pool = self.pool.get('account.tax') res = ... | def _compute_total(self, cr, uid, ids, name, args, context=None): position_pool = self.pool.get('account.fiscal.position') voucher_pool = self.pool.get('account.voucher') voucher_line_pool = self.pool.get('account.voucher.line') partner_pool = self.pool.get('res.partner') tax_pool = self.pool.get('account.tax') res = ... | |
ids = move_line_pool.search(cr, uid, [('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) | search_type = 'credit' account_type = False if ttype == 'receipt': search_type = 'debit' account_type = 'receivable' elif ttype == 'payment': search_type = 'credit' account_type = 'payable' ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partn... | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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 argu... |
'type':'dr', | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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 argu... | |
'type':'cr', | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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 argu... | |
res = {'payment_ids':res, 'account_id':account_id} | res = { 'payment_ids':res, 'account_id':account_id, 'amount':total } | def onchange_partner_id(self, cr, uid, ids, partner_id, ttype, journal_id=False, 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 argu... |
if inv.type == 'sale': | if inv.type in ('sale', 'receipt'): | def action_move_line_create(self, cr, uid, ids, *args): journal_pool = self.pool.get('account.journal') sequence_pool = self.pool.get('ir.sequence') move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') analytic_pool = self.pool.get('account.analytic.line') currency_pool = self.p... |
if inv.type in ('sale'): | if inv.type in ('sale', 'receipt'): | def action_move_line_create(self, cr, uid, ids, *args): journal_pool = self.pool.get('account.journal') sequence_pool = self.pool.get('ir.sequence') move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') analytic_pool = self.pool.get('account.analytic.line') currency_pool = self.p... |
'date_original': fields.date('Date', readonly="1"), 'date_due': fields.date('Due Date', readonly="1"), | 'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly="1"), 'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly="1"), | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which require... |
'amount_unreconciled': fields.float('Open Balance', readonly="1"), | 'amount_unreconciled': fields.related('move_line_id','balance', type='float', relation='account.move.line', string='Open Balance', readonly="1"), | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which require... |
'type': lambda *a: 'cr' | 'type': lambda *a: 'cr', 'name': lambda *a: 'Payment' | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which require... |
'name': case.partner_name or case.name, | 'name': case.partner_contact or case.name, | def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data[... |
'phone': case.phone, 'mobile': case.mobile, | 'phone': case.partner_phone, 'mobile': case.partner_mobile, | def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data[... |
inv_line['account_id'] = acc | def action_invoice(self, cr, uid, ids, context=None): """Create a invoice of order """ inv_ref = self.pool.get('account.invoice') inv_line_ref = self.pool.get('account.invoice.line') product_obj = self.pool.get('product.product') inv_ids = [] | |
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): job_ids = [] | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, cou... |
if arg[0]=='contact_id': | elif arg[0] == 'contact_id': | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, cou... |
return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count) | elif arg[0] == 'name': contact_obj = self.pool.get('res.partner.contact') search_arg = ['|', ('first_name', 'ilike', arg[2]), ('name', 'ilike', arg[2])] contact_ids = contact_obj.search(cr, user, search_arg, offset=offset, limit=limit, order=order, context=context, count=count) contacts = contact_obj.browse(cr, user, c... | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, cou... |
class many2many_domain(fields.many2many): def set(self, cr, obj, id, name, values, user=None, context=None): return super(many2many_domain, self).set(cr, obj, id, name, values, user=user, context=context) def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} m... | def rounding(f, r): if not r: return f return round(f / r) * r | |
'move_lines': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), 'move_lines2': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed... | 'move_lines': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}), 'move_lines2': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed... | def _production_date(self, cr, uid, ids, prop, unknow_none, context={}): """ Finds production planned date. @param prop: Name of field. @param unknow_none: @return: Dictionary of values. """ result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = prod.date_planned[:10] return result |
(_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']) | (_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']), (_check_recursion, _('Error ! You cannot create recursive tasks.'), ['parent_ids']) | def _is_template(self, cr, uid, ids, field_name, arg, context=None): res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = True if task.project_id: if task.project_id.active == False or task.project_id.state == 'template': res[task.id] = False return res |
except Exception: | except Exception, e: | def get_childs(self, uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get childs: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True) |
tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) | tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = ... |
context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id']) | context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id'], context=context) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = ... |
report_sxw.report_sxw('report.account.journal.period.print.wiz', 'account.journal.period', 'addons/account/report/wizard_account_journal.rml', parser=journal_print, header=False) | def _sum_credit(self, period_id, journal_id): self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 | |
id = super(Wiki, self).create(cr, uid, vals, context) | id = super(wiki_wiki2, self).create(cr, uid, vals, context) | def create(self, cr, uid, vals, context=None): |
result = super(Wiki, self).write(cr, uid, ids, vals, context) | result = super(wiki_wiki2, self).write(cr, uid, ids, vals, context) | def write(self, cr, uid, ids, vals, context=None): |
self.query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) | self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) | def set_context(self, objects, data, ids, report_type=None): new_ids = ids obj_move = self.pool.get('account.move.line') self.sortby = data['form'].get('sortby', 'sort_date') self.query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(cr, uid, ob... |
AND s.user_id = e.user_id) \ | AND s.user_id = r.user_id) \ | def _sheet(self, cursor, user, ids, name, args, context): sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') cursor.execute("SELECT a.id, COALESCE(MAX(s.id), 0) \ FROM hr_timesheet_sheet_sheet s \ LEFT JOIN (hr_attendance a \ LEFT JOIN hr_employee e \ ON (a.employee_id = e.id)) \ ON (s.date_to >= date_trunc('day',a.... |
'sequence' : lambda * a: 1, | def _get_in_visible_answer_type(self,cr, uid, context={}): return context.get('in_visible_answer_type', False) | |
from account_period where date('%s') | from account_period where date(%s) | def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs |
(form['date'], self.pool.get('res.users').browse(cr, uid, uid,context=context).company_id.id,)) | (date, self.pool.get('res.users').browse(cr, uid, uid,context=context).company_id.id,)) | def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs |
limit 1 """, (form['date'],)) | limit 1 """, (date,)) | def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs |
'name': ((type1=='move_history_ids') and 'Upstream Traceability') or 'Downstream Traceability', | 'name': ((type1=='move_history_ids') and 'Donwstream Traceability') or 'Upstream Traceability', | def action_traceability(self, cr, uid, ids, context={}): """ It traces the information of a product @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: A dictionary of values """ |
if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) | def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = F... | |
val['shipped'] = False | def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = F... | |
if len(obj.message_ids) >= action.trg_max_history: | history_ids = filter(lambda x: x.history, obj.message_ids) if len(history_ids) <= action.trg_max_history: | def do_check(self, cr, uid, action, obj, context={}): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param context: A standard dictionary for contextual values""" ok = super(base_action_rule, self).do_check(cr, uid, actio... |
vevent.add(field).value = str(data[map_field]) | vevent.add(field).value = str(data[map_field].encode('utf8')) | def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field... |
vevent.add(field).value = data.get(map_field)[1] | vevent.add(field).value = (data.get(map_field)[1]).encode('utf8') | def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field... |
vevent.add(field).value = (data[map_field]).upper() | vevent.add(field).value = (data[map_field].encode('utf8')).upper() | def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field... |
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \ | def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_d... |
self.cr.execute("SELECT sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ | def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_d... |
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ | def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_d... |
self.cr.execute("SELECT sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ | def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0 |
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \ | def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0 |
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \ | self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ | def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0 |
self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) | self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'probability' : 100.0}) | def case_close(self, cr, uid, ids, *args): """Closes Case @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) cases[... |
self.write(cr, uid, ids, {'state': 'cancel', 'active': True}) | self.write(cr, uid, ids, {'state': 'cancel', 'active': True, 'probability' : 0.0}) | def case_cancel(self, cr, uid, ids, *args): """Cancels Case @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) case... |
'email_to': fields.char('Email TO', size=84), | 'email_to': fields.char('Email To', size=84), | def _note_get(self, cursor, user, ids, name, arg, context=None): """ Gives case History Description @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case History’s IDs @param context: A standard dictionary fo... |
ftp.login(user.get('login',''), user.get('password','')) | ftp.login(user.get('login',''), user.get('login','')) | def get_ftp_login(cr, uid, ormobj): ftp = get_plain_ftp() user = ormobj.pool.get('res.users').read(cr, uid, uid) ftp.login(user.get('login',''), user.get('password','')) ftp.cwd("/" + cr.dbname) return ftp |
'planned_hours': backlog.planned_hours, | 'planned_hours': backlog.expected_hours, | def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') task = self.pool.get('project.task') backlog_id = self.pool.get('scrum.product.backlog') ids_task = [] |
_order = "date desc" | _order = "date desc ,id desc" | def _currency(self, cursor, user, ids, name, args, context=None): res = {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') default_currency = res_users_obj.browse(cursor, user, user, context=context).company_id.currency_id for statement in self.browse(cursor, user, ids, conte... |
fnode = nodes.node_file(None, None, nctx, fbro) | if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) | def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_siz... |
data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro) | result[fbro.id] = datas else: result[fbro.id] = size | def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_siz... |
work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, date_end, hours or 0.0, resource_id or False) | work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, date_end, hours or 0.0, resource_id and resource_id[0] or False) | def _check_date_start(self, cr, uid, task, date_end, context={}): """ Check And Compute date_end of task if change in date_start < older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.proj... |
work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, date_start, hours or 0.0, resource.id or False) | work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, date_start, hours or 0.0, resource_id and resource_id[0] or False) | def _check_date_end(self, cr, uid, task, date_start, context={}): """ Check And Compute date_end of task if change in date_end > older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.projec... |
return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} | return {'value': {'price_unit': 0.0, 'name': '', 'product_qty': 1.0, 'date_planned': False, 'notes': '', 'product_uom' : False}, 'domain':{'product_uom':[]}} | def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\... |
'product_qty': qty, | 'product_qty': qty or 1.0, | def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\... |
move_id = move_obj.create(cr, uid, {'journal_id': data.property_stock_journal.id}) | move_id = move_obj.create(cr, uid, {'journal_id': data.categ_id.property_stock_journal.id}) | def change_price(self, cr, uid, ids, context): """ @summary: Changes the Standard Price of Product. And creates an account move accordingly. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionar... |
'type_id': fields.many2one('crm.case.resource.type', 'Version', domain="[('object_id.model', '=', 'project.issue')]"), | 'type_id': fields.many2one('crm.case.resource.type', 'Version'), | def _get_data(self, cr, uid, ids, field_names, arg, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current users ID for security checks, @param ids: List of case and section Datas IDs @param context: A standard dictionary for contextual values "... |
cr.execute("select id from account_journal where name= '%s' and special_journal='t'"%(r[0])) | cr.execute("select id from account_journal where name= '%s' and special_journal='t'"%(r)) | def _get_v( self, cr, uid, ids,*a): """ Changed the Validation state of order @return: State """ |
cr.execute('select distinct product_id, location_id from stock_move where location_id in %s or location_dest_id in %s', (tuple(ids), tuple(ids))) res_products_by_location = sorted(cr.dictfetchall(), key=itemgetter('location_id')) | cr.execute('select distinct product_id, location_id from stock_move where location_id in %s', (tuple(ids), )) dict1 = cr.dictfetchall() cr.execute('select distinct product_id, location_dest_id as location_id from stock_move where location_dest_id in %s', (tuple(ids), )) dict2 = cr.dictfetchall() res_products_by_locatio... | def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False) |
if mline.date_from <= today and mline.date_to >= today: | if mline.date_to >= today: | def _membership_state(self, cr, uid, ids, name, args, context=None): res = {} for id in ids: res[id] = 'none' today = time.strftime('%Y-%m-%d') for id in ids: partner_data = self.browse(cr,uid,id) if partner_data.membership_cancel and today > partner_data.membership_cancel: res[id] = 'canceled' continue if partner_data... |
state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) pass | if context.get('active_id',False): state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) pass | def view_init(self, cr , uid , fields_list, context=None): obj_inv = self.pool.get('account.invoice') if context is None: context = {} state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change cu... |
if self.path not in self.redirect_paths: | redir_path = self._find_redirect() if redir_path is False: | def send_head(self): """Common code for GET and HEAD commands. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.