rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
sum(-m.product_qty*u.factor)::decimal as product_qty, sum(-pt.standard_price * m.product_qty * u.factor)::decimal as value from | coalesce(sum(-m.product_qty * u.factor)::decimal, 0.0) as product_qty, coalesce(sum(-pt.standard_price * m.product_qty * u.factor)::decimal, 0.0) as value FROM | def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute(""" |
left join stock_picking p on (m.picking_id=p.id) left join product_product pp on (m.product_id=pp.id) left join product_template pt on (pp.product_tmpl_id=pt.id) left join product_uom u on (m.product_uom=u.id) left join stock_location l on (m.location_id=l.id) group by | LEFT JOIN stock_picking p ON (m.picking_id=p.id) LEFT JOIN product_product pp ON (m.product_id=pp.id) LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) LEFT JOIN product_uom u ON (m.product_uom=u.id) LEFT JOIN stock_location l ON (m.location_id=l.id) GROUP BY | def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute(""" |
) union all ( select | ) UNION ALL ( SELECT | def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute(""" |
sum(m.product_qty*u.factor)::decimal as product_qty, sum(pt.standard_price * m.product_qty * u.factor)::decimal as value from | coalesce(sum(m.product_qty*u.factor)::decimal, 0.0) as product_qty, coalesce(sum(pt.standard_price * m.product_qty * u.factor)::decimal, 0.0) as value FROM | def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute(""" |
left join stock_picking p on (m.picking_id=p.id) left join product_product pp on (m.product_id=pp.id) left join product_template pt on (pp.product_tmpl_id=pt.id) left join product_uom u on (m.product_uom=u.id) left join stock_location l on (m.location_dest_id=l.id) group by | LEFT JOIN stock_picking p ON (m.picking_id=p.id) LEFT JOIN product_product pp ON (m.product_id=pp.id) LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) LEFT JOIN product_uom u ON (m.product_uom=u.id) LEFT JOIN stock_location l ON (m.location_dest_id=l.id) GROUP BY | def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute(""" |
periods = [x[0] for x in data['form']['periods'][1]] data['form']['periods'] = periods | periods = data['form']['periods'] | def _print_report(self, cr, uid, ids, data, query_line, context=None): periods = [x[0] for x in data['form']['periods'][1]] data['form']['periods'] = periods data['ids'] = ids obj_jperiod = self.pool.get('account.journal.period') if isinstance(periods, list): ids_final = [] for journal in data['form']['journal_ids']: f... |
ctx['date'] = line.ml_maturity_date | if data['form']['date_select'] == 'date_maturity': date_line = line.ml_maturity_date ctx['date'] = date_line | def _populate_statement(obj, cursor, user, data, context): line_ids = data['form']['lines'][0][2] if not line_ids: return {} pool = pooler.get_pool(cursor.dbname) line_obj = pool.get('payment.line') statement_obj = pool.get('account.bank.statement') statement_line_obj = pool.get('account.bank.statement.line') currency... |
if to_update[id]['partner_id'] in data['partner_ids'][0][2]: | if to_update[id]['partner_id'] in data['partner_ids']: | def do_print(self, cr, uid, ids, context=None): data = self.read(cr, uid, ids, [])[0] res = self._get_partners_followp(cr, uid, ids, context)['to_update'] to_update = res data['followup_id'] = 'followup_id' in context and context['followup_id'] or False date = 'date' in context and context['date'] or data['date'] for i... |
singer_statement() | account_cashbox_line() | def on_change_sub(self, cr, uid, ids, pieces, number,*a): |
'balance_start': fields.function(_get_starting_balance, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"), | 'balance_start': fields.function(_get_starting_balance, store=True, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"), | def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') |
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, string="Cash Transaction", help="Total cash transactions"), | 'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"), | def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') |
'balance_end': fields.function(_end_balance, method=True, string='Balance', help="Closing balance based on transactions"), 'balance_end_cash': fields.function(_balance_end_cash, method=True, string='Balance', help="Closing balance based on cashBox"), 'starting_details_ids': fields.one2many('singer.statement', 'starting... | 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on transactions"), 'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"), 'starting_details_ids': fields.one2many('acco... | def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') |
'user_id': lambda self, cr, uid, context=None: uid | 'user_id': lambda self, cr, uid, context=None: uid, 'company_id': _get_company | def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') |
cash_pool = self.pool.get('singer.statement') | cash_pool = self.pool.get('account.cashbox.line') | def onchange_journal_id(self, cr, uid, statement_id, journal_id, context={}): """ Changes balance start and starting details if journal_id changes" @param statement_id: Changed statement_id @param journal_id: Changed journal_id @return: Dictionary of changed values """ cash_pool = self.pool.get('singer.statement') st... |
cash_pool = self.pool.get('singer.statement') | cash_pool = self.pool.get('account.cashbox.line') | def button_open(self, cr, uid, ids, context=None): """ Changes statement state to Running. @return: True """ cash_pool = self.pool.get('singer.statement') statement_pool = self.pool.get('account.bank.statement') |
action_id = mod_obj._get_id(cr, uid, 'wiki', 'action_view_wiki_wiki_page_open') action_id = mod_obj.copy(cr, uid, action_id, context=context, default={ 'domain':"[('group_id','=',"+str(context.get('active_id',False))+"]", "name": menu.menu_name }) | for menu in self.browse(cr, uid, ids): action_id = mod_obj._get_id(cr, uid, 'wiki', 'action_view_wiki_wiki_page_open') action_id = mod_obj.copy(cr, uid, action_id, context=context, default={ 'domain':"[('group_id','=',"+str(context.get('active_id',False))+"]", "name": menu.menu_name }) | def wiki_menu_create(self, cr, uid, ids, context): |
for menu in self.browse(cr, uid, ids): | def wiki_menu_create(self, cr, uid, ids, context): | |
print 'Created menu', menu_id, action_id | def wiki_menu_create(self, cr, uid, ids, context): | |
if not (obj.amount == obj.voucher_id.amount): | if not (abs(obj.amount) == obj.voucher_id.amount): | def _check_amount(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): if obj.voucher_id: if not (obj.amount == obj.voucher_id.amount): return False return True |
@param name: @param arg: | @param name: name of the field @param arg: user defined argument | def _child_compute(self, cr, uid, ids, name, arg, context={}): """ @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID of mrp.production object @param name: @param arg: |
print "name",name print "arg",arg print "result",result | def _child_compute(self, cr, uid, ids, name, arg, context={}): """ @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID of mrp.production object @param name: @param arg: | |
def _get_effective_date(self, cr, uid, ids, name, arg, context={}): | def _get_effective_date(self, cr, uid, ids, name, arg, context=None): | def _get_effective_date(self, cr, uid, ids, name, arg, context={}): res = {} dates_list = [] for order in self.browse(cr, uid, ids): dates_list = [] for pick in order.picking_ids: dates_list.append(pick.date) if dates_list: res[order.id] = min(dates_list) else: res[order.id] = False return res |
def _get_commitment_date(self, cr, uid, ids, name, arg, context={}): | def _get_commitment_date(self, cr, uid, ids, name, arg, context=None): | def _get_commitment_date(self, cr, uid, ids, name, arg, context={}): res = {} dates_list = [] for order in self.browse(cr, uid, ids): dates_list = [] for line in order.order_line: dt = datetime.strptime(order.date_order, '%Y-%m-%d') + relativedelta(days=line.delay or 0.0) dt_s = dt.strftime('%Y-%m-%d') dates_list.appen... |
sale_order_line l left join product_uom u on (u.id=l.product_uom) left join product_template pt on (pt.id=l.product_id) | sale_order_line l ,product_uom u, product_product p, product_template pt where u.id = l.product_uom and pt.id = p.product_tmpl_id and p.id = l.product_id | def init(self, cr): tools.drop_view_if_exists(cr, 'sale_report') cr.execute(""" create or replace view sale_report as ( select el.*, -- (select count(1) from sale_order_line where order_id = s.id) as nbr, (select 1) as nbr, s.date_order as date, s.date_confirm as date_confirm, to_char(s.date_order, 'YYYY') as year, to_... |
for (id, name) in product_obj.name_get(cr, uid, [move.product_id.id]): message = _('Product ') + " '" + name + "' "+ _("is consumed with") + " '" + str(move.product_qty) + "' "+ _("quantity.") self.log(cr, uid, move.id, message) | for new_move in self.browse(cr, uid, res, context=context): for (id, name) in product_obj.name_get(cr, uid, [new_move.product_id.id]): message = _('Product ') + " '" + name + "' "+ _("is consumed with") + " '" + str(new_move.product_qty) + "' "+ _("quantity.") self.log(cr, uid, new_move.id, message) | def action_consume(self, cr, uid, ids, quantity, location_id=False, context=None): """ Consumed product with specific quatity from specific source location @param cr: the database cursor @param uid: the user id @param ids: ids of stock move object to be consumed @param quantity : specify consume quantity @param locati... |
'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), | 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', readonly=True, help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), | def _get_order(self, cr, uid, ids, context=None): if context is None: context = {} result = {} for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True return result.keys() |
def _model_search(self, cr, uid, obj, name, args): | def _model_search(self, cr, uid, obj, name, args, context={}): | def _model_search(self, cr, uid, obj, name, args): if not len(args): return [] model_id= args[0][2] if not model_id: return [] model = self.pool.get('ir.model').read(cr,uid,[model_id])[0]['model'] report_id = self.search(cr,uid,[('model','=',model)]) if not report_id: return [('id','=','0')] return [('id','in',report_i... |
if not context: | if context is None: | def write(self, cr, uid, ids, vals, context=None): if not context: context = {} if 'active' in vals and not vals['active']: self._check_moves(cr, uid, ids, "write", context) return super(account_account, self).write(cr, uid, ids, vals, context=context) |
taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty) | taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty) | def _amount_line(self, cr, uid, ids, field_name, arg, context=None): tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') res = {} context = context or {} for line in self.browse(cr, uid, ids, context=context): price = line.price_unit * line.product_uom_qty * (1 - (line.discount or 0.0) / 100.... |
if line.credit and line.reconcile_partial_id: | if line.credit and line.reconcile_partial_id and ttype == 'receipt': continue if line.debit and line.reconcile_partial_id and ttype == 'payment': | def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, currency_id=False, ttype=False, context={}): """price Returns a dict that contains new values and context @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context argume... |
if line.credit and line.reconcile_partial_id: | if line.credit and line.reconcile_partial_id and ttype == 'receipt': | def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, currency_id=False, ttype=False, context={}): """price Returns a dict that contains new values and context @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context argume... |
if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'): | if inv.type in ('sale', 'receipt'): | 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 |
def unlink(self, cr, uid, ids, context={}): | def unlink(self, cr, uid, ids, context=None): | def unlink(self, cr, uid, ids, context={}): vouchers = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in vouchers: if t['state'] in ('draft', 'cancel'): unlink_ids.append(t['id']) else: raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !') return super(account... |
return super(account_voucher, self).unlink(self, cr, uid, unlink_ids) | return super(account_voucher, self).unlink(cr, uid, unlink_ids, context=context) | def unlink(self, cr, uid, ids, context={}): vouchers = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in vouchers: if t['state'] in ('draft', 'cancel'): unlink_ids.append(t['id']) else: raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !') return super(account... |
start_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): """ @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 base_start_date: Get Start Date @param base_until_date: Get End Date @param l... | |
phase_resource = False | def generate_schedule(self, cr, uid, ids, start_date, calendar_id=False, context=None): """ Schedule phase with the start date till all the next phases are completed. @param: start_dsate : start date for the phase @param: calendar_id : working calendar of the project """ if context is None: context = {} resource_pool =... | |
start = start_date minimum_time_unit = 1 resource = phase_resource_obj | def Project(): start = start_date minimum_time_unit = 1 resource = phase_resource_obj # If project has working calendar then that # else the default one would be considered if calendar_id: working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context) vacation = tuple(resource_pool.compute... | |
number = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id=%s', {'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id}) | number = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id', {'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id}) | def action_number(self, cr, uid, ids, *args): cr.execute('SELECT id, type, number, move_id, reference ' \ 'FROM account_invoice ' \ 'WHERE id IN %s', (tuple(ids),)) obj_inv = self.browse(cr, uid, ids)[0] for (id, invtype, number, move_id, reference) in cr.fetchall(): if not number: if obj_inv.journal_id.invoice_sequenc... |
result = ids | result = [] | def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if isinstance(select, (str, int, long)): ids = [select] else: ids = select result = ids if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meetin... |
clean() | def execute(connector, method, *args): global wait_count res = False try: res = getattr(connector,method)(*args) except socket.error,e: if e.args[0] == 111: if wait_count > wait_limit: print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit) clean() sys.exit(1) print 'Pl... | |
def check_creds(db, uid, passwd): if security._uid_cache.get(db, {}).get(uid) and security._uid_cache.get(db, {}).get(uid) == passwd: | def check(db, uid, passwd): cached_pass = security._uid_cache.get(db, {}).get(uid) if (cached_pass is not None) and cached_pass == passwd: | def check_creds(db, uid, passwd): if security._uid_cache.get(db, {}).get(uid) and security._uid_cache.get(db, {}).get(uid) == passwd: return True cr = pooler.get_db(db).cursor() if passwd not in _salt_cache: cr.execute( 'select login from res_users where id=%s', (uid,) ) stored_login = cr.fetchone() if stored_login: st... |
return False | return security.ExceptionNoTb('AccessDenied') | def check_creds(db, uid, passwd): if security._uid_cache.get(db, {}).get(uid) and security._uid_cache.get(db, {}).get(uid) == passwd: return True cr = pooler.get_db(db).cursor() if passwd not in _salt_cache: cr.execute( 'select login from res_users where id=%s', (uid,) ) stored_login = cr.fetchone() if stored_login: st... |
security.check_creds=check_creds | security.check=check | def access(db, uid, passwd, sec_level, ids): cr = pooler.get_db(db).cursor() salt = _salt_cache[passwd] cr.execute('select id from res_users where id=%s and password=%s', (uid, encrypt_md5( passwd, salt )) ) res = cr.fetchone() cr.close() if not res: raise security.ExceptionNoTb('Bad username or password') return res[0... |
invoice_domain.append(('id', '=', created_inv)) | invoice_domain.append(('id', 'in', created_inv)) | def compute_refund(self, cr, uid, ids, mode='refund', context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs |
domain = [('object_id.model', '=', model)] | domain = [('object_id.model', '=', model),('section_ids', '=', case.section_id.id)] | def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @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... |
domain = [('object_id.model', '=', model)] | domain = [('object_id.model', '=', model),('section_ids', '=', case.section_id.id)] | def stage_previous(self, cr, uid, ids, context=None): """This function computes previous stage for case from its current stage using available stage for that case type @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:... |
number = self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement') | number = self.pool.get('ir.sequence').get(cr, uid, statement.journal_id.sequence_id.code) | def button_open(self, cr, uid, ids, context=None): """ Changes statement state to Running. @return: True """ cash_pool = self.pool.get('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement') |
'keep_if_condition_not_met': fields.boolean('Keep as cancelled', | 'keep_if_condition_not_met': fields.boolean("Don't delete workitems", | def process_segment(self, cr, uid, segment_ids=None, context=None): Workitems = self.pool.get('marketing.campaign.workitem') if not segment_ids: segment_ids = self.search(cr, uid, [('state', '=', 'running')], context=context) |
for line in self.browse(cr, uid, ids): | for line in self.browse(cr, uid, ids, context=context): | def _state(self, cr, uid, ids, name, args, context=None): """Compute the state lines @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 Membership Line IDs @param name: Field Name @param context: A standard dic... |
inv = self.pool.get('account.invoice').browse(cr, uid, fetched[1]) | inv = self.pool.get('account.invoice').browse(cr, uid, fetched[1], context=context) | def _state(self, cr, uid, ids, name, args, context=None): """Compute the state lines @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 Membership Line IDs @param name: Field Name @param context: A standard dic... |
'state': fields.function(_state, method=True, string='Membership State', type='selection', selection=STATE, store=True), | 'state': fields.function( _state, method=True, string='Membership State', type='selection', selection=STATE, store = { 'account.invoice':(_get_membership_lines, ['state'], 10), }), | def _state(self, cr, uid, ids, name, args, context=None): """Compute the state lines @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 Membership Line IDs @param name: Field Name @param context: A standard dic... |
data_inv = member_line_obj.browse(cr, uid, ids, context) | data_inv = member_line_obj.browse(cr, uid, ids, context=context) | def _get_partner_id(self, cr, uid, ids, context=None): member_line_obj = self.pool.get('membership.membership_line') res_obj = self.pool.get('res.partner') data_inv = member_line_obj.browse(cr, uid, ids, context) list_partner = [] for data in data_inv: list_partner.append(data.partner.id) ids2 = list_partner while ids... |
data_inv = inv_obj.browse(cr, uid, ids, context) | data_inv = inv_obj.browse(cr, uid, ids, context=context) | def _get_invoice_partner(self, cr, uid, ids, context=None): inv_obj = self.pool.get('account.invoice') res_obj = self.pool.get('res.partner') data_inv = inv_obj.browse(cr, uid, ids, context) list_partner = [] for data in data_inv: list_partner.append(data.partner_id.id) ids2 = list_partner while ids2: ids2 = res_obj.se... |
partner_data = self.browse(cr, uid, id) | partner_data = self.browse(cr, uid, id, context=context) | def _membership_state(self, cr, uid, ids, name, args, context=None): """This Function return Membership State For Given Partner. @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 Partner IDs @param name: Field... |
res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context) | res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context=context) | def _membership_state(self, cr, uid, ids, name, args, context=None): """This Function return Membership State For Given Partner. @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 Partner IDs @param name: Field... |
for partner in self.browse(cr, uid, ids): | for partner in self.browse(cr, uid, ids, context=context): | def _membership_date(self, cr, uid, ids, name, args, context=None): |
limit=1, order='date_from') | limit=1, order='date_from', context=context) | def _membership_date(self, cr, uid, ids, name, args, context=None): |
['date_from'])['date_from'] | ['date_from'], context=context)['date_from'] | def _membership_date(self, cr, uid, ids, name, args, context=None): |
limit=1, order='date_to desc') | limit=1, order='date_to desc', context=context) | def _membership_date(self, cr, uid, ids, name, args, context=None): |
['date_to'])['date_to'] | ['date_to'], context=context)['date_to'] | def _membership_date(self, cr, uid, ids, name, args, context=None): |
line_id2 = member_line_obj.search(cr, uid, [('partner', '=', partner.id)],limit=1, order='date_cancel') | line_id2 = member_line_obj.search(cr, uid, [('partner', '=', partner.id)], limit=1, order='date_cancel', context=context) | def _membership_date(self, cr, uid, ids, name, args, context=None): |
res[partner.id]['membership_cancel'] = member_line_obj.read(cr, uid, line_id2[0],['date_cancel'])['date_cancel'] | res[partner.id]['membership_cancel'] = member_line_obj.read(cr, uid, line_id2[0], ['date_cancel'], context=context)['date_cancel'] | def _membership_date(self, cr, uid, ids, name, args, context=None): |
return super(Partner, self).copy(cr, uid, id, default, context) | return super(Partner, self).copy(cr, uid, id, default, context=context) | def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {} if context is None: context = {} default = default.copy() default['member_lines'] = [] return super(Partner, self).copy(cr, uid, id, default, context) |
} ) | }, context=context) | def create_membership_invoice(self, cr, uid, ids, product_id=None, datas=None, context=None): """ Create Customer Invoice of Membership for partners. @param datas: datas has dictionary value which consist Id of Membership product and Cost Amount of Membership. datas = {'membership_product_id': None, 'amount':None} """ ... |
model_data_ids_form = model_obj.search(cr,user,[('model','=','ir.ui.view'),('name','in',['membership_products_form','membership_products_tree'])]) resource_id_form = model_obj.read(cr, user, model_data_ids_form, fields=['res_id','name']) | model_data_ids_form = model_obj.search(cr,user,[('model','=','ir.ui.view'),('name','in',['membership_products_form','membership_products_tree'])], context=context) resource_id_form = model_obj.read(cr, user, model_data_ids_form, fields=['res_id','name'], context=context) | def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): model_obj = self.pool.get('ir.model.data') |
def action_cancel(self, cr, uid, ids, context=None): | def action_cancel(self, cr, uid, ids, *args): | def action_cancel(self, cr, uid, ids, context=None): '''Create a 'date_cancel' on the membership_line object''' if context is None: context = {} member_line_obj = self.pool.get('membership.membership_line') today = time.strftime('%Y-%m-%d') for invoice in self.browse(cr, uid, ids): mlines = member_line_obj.search(cr, u... |
if context is None: context = {} | def action_cancel(self, cr, uid, ids, context=None): '''Create a 'date_cancel' on the membership_line object''' if context is None: context = {} member_line_obj = self.pool.get('membership.membership_line') today = time.strftime('%Y-%m-%d') for invoice in self.browse(cr, uid, ids): mlines = member_line_obj.search(cr, u... | |
[ l.id for l in invoice.invoice_line])], context) member_line_obj.write(cr, uid, mlines, {'date_cancel':today}, context) return super(Invoice, self).action_cancel(cr, uid, ids, context) | [ l.id for l in invoice.invoice_line])]) member_line_obj.write(cr, uid, mlines, {'date_cancel':today}) return super(Invoice, self).action_cancel(cr, uid, ids) | def action_cancel(self, cr, uid, ids, context=None): '''Create a 'date_cancel' on the membership_line object''' if context is None: context = {} member_line_obj = self.pool.get('membership.membership_line') today = time.strftime('%Y-%m-%d') for invoice in self.browse(cr, uid, ids): mlines = member_line_obj.search(cr, u... |
for line in self.browse(cr, uid, ids): | for line in self.browse(cr, uid, ids, context=context): | def write(self, cr, uid, ids, vals, context=None): """Overrides orm write method """ if not context: context={} res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context) member_line_obj = self.pool.get('membership.membership_line') for line in self.browse(cr, uid, ids): if line.invoice_id.type ... |
ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)]) | ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)], context=context) | def write(self, cr, uid, ids, vals, context=None): """Overrides orm write method """ if not context: context={} res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context) member_line_obj = self.pool.get('membership.membership_line') for line in self.browse(cr, uid, ids): if line.invoice_id.type ... |
}) | }, context=context) | def write(self, cr, uid, ids, vals, context=None): """Overrides orm write method """ if not context: context={} res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context) member_line_obj = self.pool.get('membership.membership_line') for line in self.browse(cr, uid, ids): if line.invoice_id.type ... |
ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',id)]) | ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',id)], context=context) | def unlink(self, cr, uid, ids, context=None): """Remove Membership Line Record for Account Invoice Line """ if not context: context={} member_line_obj = self.pool.get('membership.membership_line') for id in ids: ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',id)]) member_line_obj.unlink(cr, uid, ... |
def create(self, cr, uid, vals, context={}): | def create(self, cr, uid, vals, context=None): | def create(self, cr, uid, vals, context={}): """Overrides orm create method """ result = super(account_invoice_line, self).create(cr, uid, vals, context) line = self.browse(cr, uid, result) member_line_obj = self.pool.get('membership.membership_line') if line.invoice_id.type == 'out_invoice': |
result = super(account_invoice_line, self).create(cr, uid, vals, context) line = self.browse(cr, uid, result) | result = super(account_invoice_line, self).create(cr, uid, vals, context=context) line = self.browse(cr, uid, result, context=context) | def create(self, cr, uid, vals, context={}): """Overrides orm create method """ result = super(account_invoice_line, self).create(cr, uid, vals, context) line = self.browse(cr, uid, result) member_line_obj = self.pool.get('membership.membership_line') if line.invoice_id.type == 'out_invoice': |
ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)]) | ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)], context=context) | def create(self, cr, uid, vals, context={}): """Overrides orm create method """ result = super(account_invoice_line, self).create(cr, uid, vals, context) line = self.browse(cr, uid, result) member_line_obj = self.pool.get('membership.membership_line') if line.invoice_id.type == 'out_invoice': |
}) | }, context=context) | def create(self, cr, uid, vals, context={}): """Overrides orm create method """ result = super(account_invoice_line, self).create(cr, uid, vals, context) line = self.browse(cr, uid, result) member_line_obj = self.pool.get('membership.membership_line') if line.invoice_id.type == 'out_invoice': |
run = False if transition.trigger != 'signal' and campaign_mode != 'manual': if transition.trigger == 'auto' or campaign_mode == 'test': run = True | run = transition.trigger == 'auto' \ or (transition.trigger == 'time' \ and campaign_mode == 'test') | def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': return |
'get_contract':self.get_contract, | def __init__(self, cr, uid, name, context): super(salary_structure_report, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, 'get_type':self.get_type, 'get_contract':self.get_contract, 'get_line_amount_type':self.get_line_amount_type, 'get_line_type':self.get_line_type, 'get_line_amount_sy... | |
def get_contract(self,emp): curr_date = "'"+time.strftime("%Y-%m-%d")+"'" sql_req= ''' SELECT c.id as id, c.wage as wage, struct_id as struct FROM hr_contract c LEFT JOIN hr_employee emp on (c.employee_id=emp.id) LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id) LEFT JOIN hr_contract_wage_type_period p o... | def get_contract(self,emp): curr_date = "'"+time.strftime("%Y-%m-%d")+"'" sql_req= ''' SELECT c.id as id, c.wage as wage, struct_id as struct FROM hr_contract c LEFT JOIN hr_employee emp on (c.employee_id=emp.id) LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id) LEFT JOIN hr_contract_wage_type_period p o... | |
tools.drop_view_if_exists(cr, 'stock_report_prodlots') | drop_view_if_exists(cr, 'stock_report_prodlots') | def init(self, cr): tools.drop_view_if_exists(cr, 'stock_report_prodlots') cr.execute(""" create or replace view stock_report_prodlots as ( select max(id) as id, location_id, product_id, prodlot_id, sum(qty) as name from ( select -max(sm.id) as id, sm.location_id, sm.product_id, sm.prodlot_id, -sum(sm.product_qty /uo.f... |
tools.drop_view_if_exists(cr, 'stock_report_tracklots') | drop_view_if_exists(cr, 'stock_report_prodlots') | def init(self, cr): tools.drop_view_if_exists(cr, 'stock_report_tracklots') cr.execute(""" create or replace view stock_report_tracklots as ( select max(id) as id, location_id, product_id, tracking_id, sum(qty) as name from ( select -max(sm.id) as id, sm.location_id, sm.product_id, sm.tracking_id, -sum(sm.product_qty ... |
tools.drop_view_if_exists(cr, 'report_stock_lines_date') | drop_view_if_exists(cr, 'stock_report_prodlots') | def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_lines_date') cr.execute(""" create or replace view report_stock_lines_date as ( select p.id as id, p.id as product_id, max(s.date) as date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) left join stock_inventory s on (... |
date_close = tasks[task.id][-1][1] | date_close = tasks[task.id] and tasks[task.id][-1][1] or False | def _compute_tasks(cr, uid, task_list, date_begin): sequences = [] users = {} tasks = {} last_date = date_begin for task in task_list: # TODO: reorder ! with dependencies if not task.planned_hours: continue if task.state in ('draft','open','progress') and task.user_id: # Find the starting date of the task if task.user... |
users[task.user_id.id] = date_close sequences.append((task.sequence, date_close)) if date_close>last_date: last_date=date_close | if date_close: users[task.user_id.id] = date_close sequences.append((task.sequence, date_close)) if date_close>last_date: last_date=date_close | def _compute_tasks(cr, uid, task_list, date_begin): sequences = [] users = {} tasks = {} last_date = date_begin for task in task_list: # TODO: reorder ! with dependencies if not task.planned_hours: continue if task.state in ('draft','open','progress') and task.user_id: # Find the starting date of the task if task.user... |
return user.context_section_id | print "section id",type(user.context_section_id) return int(user.context_section_id) | def _get_section(self, cr, uid, context): user = self.pool.get('res.users').browse(cr,uid,uid,context=context) return user.context_section_id |
GROUP BY partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from)) | GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), 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... |
if not password: return False | try: return self._login(db, login, password) except Exception, e: import logging logging.getLogger('netsvc').exception('Could not authenticate') return Exception('Access Denied') def _login(self, db, login, password): if not password: return False if db is False: raise RuntimeError("Cannot authenticate to False db!") | def login(self, db, login, password): |
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]}) | action_pool.run(cr, user, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]}) | def fetch_mail(self, cr, uid, ids, context={}): email_tool = self.pool.get('email.server.tools') action_pool = self.pool.get('ir.actions.server') context.update({'get_server': True}) for server in self.browse(cr, uid, ids, context): count = 0 user = server.user_id.id or uid try: if server.type == 'imap': imap_server = ... |
res = node.open_data(cr, mode) | try: res = node.open_data(cr, mode) except TypeError, e: raise IOError(errno.EINVAL, "No data") | def open(self, datacr, mode): if not (datacr and datacr[1]): raise OSError(1, 'Operation not permited.') # Reading operation cr, node, rem = datacr res = node.open_data(cr, mode) return res |
def _get_fiscalyear(self, data): if data['model']=='account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name return super(journal_print ,self)._get_fiscalyear(data) | def _sum_currency_amount_account(self, account, form): self._set_get_account_currency_code(account.id) self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone() | |
cr.execute(sql,(data['form']['date1'])) | cr.execute(sql,(data['form']['date1'],)) | def _check_date(self, cr, uid, data, context): |
def _get_chart_account(cursor, user, account): if account.parent_id: chart_account = _get_chart_account(cursor, user, account.parent_id) else: chart_account = account return chart_account | def _get_chart_account(cursor, user, account): if account.parent_id: chart_account = _get_chart_account(cursor, user, account.parent_id) else: chart_account = account return chart_account | |
s = decode_header(s) return ''.join(map(lambda x:self._to_decode(x[0], [x[1]]), s)) | s = decode_header(s) return ''.join(map(lambda x:self._to_decode(x[0], [x[1]]), s or [])) | def _decode_header(self, s): from email.Header import decode_header s = decode_header(s) return ''.join(map(lambda x:self._to_decode(x[0], [x[1]]), s)) |
'title': lead.title, | 'title': lead.title and lead.title.id or False, | def _create_partner(self, cr, uid, ids, context=None): """ This function Creates partner based on action. @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Lead to Partner's IDs @param context: A standard dict... |
computed_taxes = account_tax_obj.compute( | computed_taxes = account_tax_objcompute_all( | order_account = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id |
computed_taxes = account_tax_obj.compute(cr, uid, taxes, line.price_unit, line.qty) | computed_taxes = account_tax_objcompute_all(cr, uid, taxes, line.price_unit, line.qty) | def _amount_line_ttc(self, cr, uid, ids, field_name, arg, context): res = {} account_tax_obj = self.pool.get('account.tax') for line in self.browse(cr, uid, ids): tax_amount = 0.0 taxes = [t for t in line.product_id.taxes_id] computed_taxes = account_tax_obj.compute(cr, uid, taxes, line.price_unit, line.qty) for tax in... |
search_arg = ['|', ('first_name', 'ilike', arg[2]), ('name', 'ilike', arg[2])] contact_ids = contact_obj.search(cr, user, search_arg, offset=offset, \ limit=limit, order=order, context=context, count=count) contacts = contact_obj.browse(cr, user, contact_ids, context=context) for contact in contacts: job_ids.extend([it... | if arg[2] and not count: search_arg = ['|', ('first_name', 'ilike', arg[2]), ('name', 'ilike', arg[2])] contact_ids = contact_obj.search(cr, user, search_arg, offset=offset, limit=limit, order=order, context=context, count=count) contacts = contact_obj.browse(cr, user, contact_ids, context=context) for contact in conta... | def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ search parnter job @param self: The object pointer @param cr: the current row, from the database cursor, @param user: the current user @param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...]. @... |
import pdb pdb.set_trace() | def set_context(self, objects, data, ids, report_type = None): new_ids = ids if (data['model'] == 'ir.ui.menu'): new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or [] objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids) import pdb pdb.set_trace() super(journal_print... | |
m2o_order = m2o_order.split(",",1)[0].strip().split(" ",1)[0] | m2o_order_list = [] for order_part in m2o_order.split(",",1): m2o_order_list.append(order_part.strip().split(" ",1)[0].strip()) m2o_order = m2o_order_list | def _generate_m2o_order_by(self, order_field, query): """ Add possibly missing JOIN to ``query`` and generate the ORDER BY clause for m2o fields, either native m2o fields or function/related fields that are stored, including intermediate JOINs for inheritance if required. |
return '"%s"."%s"' % (dest_model._table, m2o_order) | qualify = lambda field: '"%s"."%s"' % (dest_model._table, field) return map(qualify, m2o_order) if isinstance(m2o_order, list) else qualify(m2o_order) | def _generate_m2o_order_by(self, order_field, query): """ Add possibly missing JOIN to ``query`` and generate the ORDER BY clause for m2o fields, either native m2o fields or function/related fields that are stored, including intermediate JOINs for inheritance if required. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.