rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
create or replace view report_stock_inventory as ( (select
CREATE OR REPLACE view report_stock_inventory AS ( (SELECT
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
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("""
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
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("""
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
) union all ( select
) UNION ALL ( SELECT
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
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("""
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
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("""
70911f1e6859e4f03d8351e60e310cc25e5794f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/70911f1e6859e4f03d8351e60e310cc25e5794f9/report_stock_move.py
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']: for period in periods: ids_journal_period = obj_jperiod.search(cr,uid, [('journal_id','=',journal),('period_id','=',period)], context=context) if ids_journal_period: ids_final.append(ids_journal_period) if not ids_final: raise osv.except_osv(_('No Data Available'), _('No records found for your selection!')) return { 'type': 'ir.actions.report.xml', 'report_name': 'account.central.journal.wiz', 'datas': data, 'nodestroy':True, }
b3f25454685b0dd394e747fe2ec5229725f9a3a1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b3f25454685b0dd394e747fe2ec5229725f9a3a1/account_central_journal.py
if not ids_final: raise osv.except_osv(_('No Data Available'), _('No records found for your selection!'))
if not ids_final: raise osv.except_osv(_('No Data Available'), _('No records found for your selection!'))
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']: for period in periods: ids_journal_period = obj_jperiod.search(cr,uid, [('journal_id','=',journal),('period_id','=',period)], context=context) if ids_journal_period: ids_final.append(ids_journal_period) if not ids_final: raise osv.except_osv(_('No Data Available'), _('No records found for your selection!')) return { 'type': 'ir.actions.report.xml', 'report_name': 'account.central.journal.wiz', 'datas': data, 'nodestroy':True, }
b3f25454685b0dd394e747fe2ec5229725f9a3a1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b3f25454685b0dd394e747fe2ec5229725f9a3a1/account_central_journal.py
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_obj = pool.get('res.currency') statement_reconcile_obj = pool.get('account.bank.statement.reconcile') statement = statement_obj.browse(cursor, user, data['id'], context=context) for line in line_obj.browse(cursor, user, line_ids, context=context): ctx = context.copy() ctx['date'] = line.ml_maturity_date # was value_date earlier,but this field exists no more now amount = currency_obj.compute(cursor, user, line.currency.id, statement.currency.id, line.amount_currency, context=ctx) if line.move_line_id: reconcile_id = statement_reconcile_obj.create(cursor, user, { 'line_ids': [(6, 0, [line.move_line_id.id])] }, context=context) statement_line_obj.create(cursor, user, { 'name': line.order_id.reference or '?', 'amount': - amount, 'type': 'supplier', 'partner_id': line.partner_id.id, 'account_id': line.move_line_id.account_id.id, 'statement_id': statement.id, 'ref': line.communication, 'reconcile_id': reconcile_id, }, context=context) return {}
8f83fa784934f08cf123c5383338466793d05ae9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8f83fa784934f08cf123c5383338466793d05ae9/wizard_populate_statement.py
if isinstance(result, list): for rec in result: if not rec.get('action_id',True): rec['action_id'] = (self._get_menu(cr, uid),'Menu') else: if not result.get('action_id',True): result['action_id'] = (self._get_menu(cr, uid),'Menu')
def override_password(o): if 'password' in o and ( 'id' not in o or o['id'] != uid ): o['password'] = '********' return o
73cee227e1fe2e83d04382ea401d3c3c222aedeb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/73cee227e1fe2e83d04382ea401d3c3c222aedeb/res_user.py
fields_order.remove(context['group_by'])
if context['group_by'] in fields_order: fields_order.remove(context['group_by'])
def create(self, cr, uid, ids, datas, context=None): if not context: context={} self.context = context pool = pooler.get_pool(cr.dbname) model = pool.get(datas['model']) model_id = pool.get('ir.model').search(cr, uid, [('model','=',model._name)]) if model_id: model_desc = pool.get('ir.model').browse(cr, uid, model_id[0], context).name self.title = model_desc else: model_desc = model._description self.title = model_desc
7c5bc6cde05c41a743a7b7277daf1acf00c7f93f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7c5bc6cde05c41a743a7b7277daf1acf00c7f93f/ps_list.py
r.update({f:(r['__domain'][0][2],r[r['__domain'][0][0]])}) if result['fields'][f]['type'] == 'date' and r[f]: r[f] = ''
r.update({f:(r['__domain'][0][2],r[r['__domain'][0][0]])})
def create(self, cr, uid, ids, datas, context=None): if not context: context={} self.context = context pool = pooler.get_pool(cr.dbname) model = pool.get(datas['model']) model_id = pool.get('ir.model').search(cr, uid, [('model','=',model._name)]) if model_id: model_desc = pool.get('ir.model').browse(cr, uid, model_id[0], context).name self.title = model_desc else: model_desc = model._description self.title = model_desc
7c5bc6cde05c41a743a7b7277daf1acf00c7f93f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7c5bc6cde05c41a743a7b7277daf1acf00c7f93f/ps_list.py
format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y')) d1 = datetime.strptime(line[f],'%Y-%m-%d') new_d1 = d1.strftime(format)
new_d1 = line[f] if not line.get('__group'): format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y')) d1 = datetime.strptime(line[f],'%Y-%m-%d') new_d1 = d1.strftime(format)
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
7c5bc6cde05c41a743a7b7277daf1acf00c7f93f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7c5bc6cde05c41a743a7b7277daf1acf00c7f93f/ps_list.py
format = str(locale.nl_langinfo(locale.T_FMT)) d1 = datetime.strptime(line[f], '%H:%M:%S') new_d1 = d1.strftime(format)
new_d1 = line[f] if not line.get('__group'): format = str(locale.nl_langinfo(locale.T_FMT)) d1 = datetime.strptime(line[f], '%H:%M:%S') new_d1 = d1.strftime(format)
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
7c5bc6cde05c41a743a7b7277daf1acf00c7f93f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7c5bc6cde05c41a743a7b7277daf1acf00c7f93f/ps_list.py
format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'))+' '+str(locale.nl_langinfo(locale.T_FMT)) d1 = datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S') new_d1 = d1.strftime(format)
new_d1 = line[f] if not line.get('__group'): format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'))+' '+str(locale.nl_langinfo(locale.T_FMT)) d1 = datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S') new_d1 = d1.strftime(format)
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
7c5bc6cde05c41a743a7b7277daf1acf00c7f93f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7c5bc6cde05c41a743a7b7277daf1acf00c7f93f/ps_list.py
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 id in to_update.keys(): if to_update[id]['partner_id'] in data['partner_ids'][0][2]: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], date, int(id),))
2ea0ca0aa00cb829a1dac8a485f7abe5facb9cfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2ea0ca0aa00cb829a1dac8a485f7abe5facb9cfb/account_followup_print.py
singer_statement()
account_cashbox_line()
def on_change_sub(self, cr, uid, ids, pieces, number,*a):
c909e8af22db1f6cfa821df04c7e550448da427b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c909e8af22db1f6cfa821df04c7e550448da427b/account_cash_statement.py
'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')
c909e8af22db1f6cfa821df04c7e550448da427b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c909e8af22db1f6cfa821df04c7e550448da427b/account_cash_statement.py
'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')
c909e8af22db1f6cfa821df04c7e550448da427b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c909e8af22db1f6cfa821df04c7e550448da427b/account_cash_statement.py
'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_id', string='Opening Cashbox'), 'ending_details_ids': fields.one2many('singer.statement', 'ending_id', string='Closing Cashbox'),
'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('account.cashbox.line', 'starting_id', string='Opening Cashbox'), 'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing 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')
c909e8af22db1f6cfa821df04c7e550448da427b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c909e8af22db1f6cfa821df04c7e550448da427b/account_cash_statement.py
'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')
c909e8af22db1f6cfa821df04c7e550448da427b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c909e8af22db1f6cfa821df04c7e550448da427b/account_cash_statement.py
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') statement_pool = self.pool.get('account.bank.statement')
c909e8af22db1f6cfa821df04c7e550448da427b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c909e8af22db1f6cfa821df04c7e550448da427b/account_cash_statement.py
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')
c909e8af22db1f6cfa821df04c7e550448da427b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c909e8af22db1f6cfa821df04c7e550448da427b/account_cash_statement.py
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):
1c056da2e1bbd5a09a1f48d5e2162f6c978655e4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1c056da2e1bbd5a09a1f48d5e2162f6c978655e4/wiki_create_menu.py
for menu in self.browse(cr, uid, ids):
def wiki_menu_create(self, cr, uid, ids, context):
1c056da2e1bbd5a09a1f48d5e2162f6c978655e4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1c056da2e1bbd5a09a1f48d5e2162f6c978655e4/wiki_create_menu.py
print 'Created menu', menu_id, action_id
def wiki_menu_create(self, cr, uid, ids, context):
1c056da2e1bbd5a09a1f48d5e2162f6c978655e4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1c056da2e1bbd5a09a1f48d5e2162f6c978655e4/wiki_create_menu.py
module = get_module_from_path(fabsolutepath)
module = get_module_from_path(frelativepath)
def get_module_from_path(path, mod_paths=None):
34be1742ade6d225afe6f80e65f404b5e34e52eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/34be1742ade6d225afe6f80e65f404b5e34e52eb/translate.py
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
45915a7d1e8d7dfe715ee3237eacf5d87ec9dc68 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/45915a7d1e8d7dfe715ee3237eacf5d87ec9dc68/account_voucher.py
@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:
001d95a574dd31a9b0d995f0ac55365b570d3806 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/001d95a574dd31a9b0d995f0ac55365b570d3806/mrp.py
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:
001d95a574dd31a9b0d995f0ac55365b570d3806 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/001d95a574dd31a9b0d995f0ac55365b570d3806/mrp.py
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
f7eae25635f6966d88cdbfc057fef7ac01f12d3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f7eae25635f6966d88cdbfc057fef7ac01f12d3d/sale_order_dates.py
return res
return res
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
f7eae25635f6966d88cdbfc057fef7ac01f12d3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f7eae25635f6966d88cdbfc057fef7ac01f12d3d/sale_order_dates.py
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.append(dt_s) if dates_list: res[order.id] = min(dates_list) return res
f7eae25635f6966d88cdbfc057fef7ac01f12d3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f7eae25635f6966d88cdbfc057fef7ac01f12d3d/sale_order_dates.py
return res
return res
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.append(dt_s) if dates_list: res[order.id] = min(dates_list) return res
f7eae25635f6966d88cdbfc057fef7ac01f12d3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f7eae25635f6966d88cdbfc057fef7ac01f12d3d/sale_order_dates.py
'commitment_date': fields.function(_get_commitment_date, method=True,store=True, type='date', string='Commitment Date', help="Date on which delivery of products is to be made"),
'commitment_date': fields.function(_get_commitment_date, method=True, store=True, type='date', string='Commitment Date', help="Date on which delivery of products is to be made"),
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.append(dt_s) if dates_list: res[order.id] = min(dates_list) return res
f7eae25635f6966d88cdbfc057fef7ac01f12d3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f7eae25635f6966d88cdbfc057fef7ac01f12d3d/sale_order_dates.py
'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True,string='Effective Date',help="Date on which picking is created"),
'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True, string='Effective Date',help="Date on which picking is created"),
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.append(dt_s) if dates_list: res[order.id] = min(dates_list) return res
f7eae25635f6966d88cdbfc057fef7ac01f12d3d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f7eae25635f6966d88cdbfc057fef7ac01f12d3d/sale_order_dates.py
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_char(s.date_order, 'MM') as month, to_char(s.date_order, 'YYYY-MM-DD') as day, s.partner_id as partner_id, s.user_id as user_id, s.shop_id as shop_id, s.company_id as company_id, extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay, s.state, s.shipped, s.shipped::integer as shipped_qty_1, s.pricelist_id as pricelist_id, s.project_id as analytic_account_id from sale_order s, ( select l.id as id, l.product_id as product_id, (case when u.uom_type not in ('reference') then (select name from product_uom where uom_type='reference' and category_id=u.category_id) else u.name end) as uom_name, sum(l.product_uom_qty/u.factor) as product_uom_qty, sum(l.product_uom_qty*l.price_unit) as price_total, pt.categ_id, l.order_id from 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) group by l.id, l.order_id, l.product_id, u.name, pt.categ_id, u.uom_type, u.category_id) el where s.id = el.order_id group by el.id, el.product_id, el.uom_name, el.product_uom_qty, el.price_total, el.categ_id, el.order_id, s.date_order, s.date_confirm, s.partner_id, s.user_id, s.shop_id, s.company_id, s.state, s.shipped, s.pricelist_id, s.project_id ) """)
11cdeb99298b071b75855a1e8633d04af8c567c9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/11cdeb99298b071b75855a1e8633d04af8c567c9/sale_report.py
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 location_id : specify source location @param context: context arguments @return: Consumed lines """ if context is None: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
9110935b2e2d3b32ce4317fd95ec94afca14b51a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9110935b2e2d3b32ce4317fd95ec94afca14b51a/stock.py
'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()
6637f578c7973b2bd03a334161c5b773f65555ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6637f578c7973b2bd03a334161c5b773f65555ac/sale.py
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_id)]
47c59039e2262f54768bc755805354888ac18efd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/47c59039e2262f54768bc755805354888ac18efd/directory_report.py
value[f] = False
if f not in value: value[f] = False
fld_def = ((f in self._columns) and self._columns[f]) \ or ((f in self._inherit_fields) and self._inherit_fields[f][2]) \ or False
ebb2a2b3645340d8dc4ddda422d3f268ba96370b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ebb2a2b3645340d8dc4ddda422d3f268ba96370b/orm.py
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)
a5cb75b4238c630833f94678cd482e999e88306d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a5cb75b4238c630833f94678cd482e999e88306d/account.py
return date.strftime(self.lang_obj.date_format)
return date.strftime(str(self.lang_obj.date_format))
def __str__(self): if self.val: if getattr(self,'name', None): date = datetime.strptime(self.name, DT_FORMAT) return date.strftime(self.lang_obj.date_format) return self.val
7b6b348700f87f77f32c425435629d7c649986a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b6b348700f87f77f32c425435629d7c649986a4/report_sxw.py
.strftime("%s %s"%(self.lang_obj.date_format, self.lang_obj.time_format))
.strftime("%s %s"%(str(self.lang_obj.date_format), str(self.lang_obj.time_format)))
def __str__(self): if self.val and getattr(self,'name', None): return datetime.strptime(self.name, DHM_FORMAT)\ .strftime("%s %s"%(self.lang_obj.date_format, self.lang_obj.time_format)) return self.val
7b6b348700f87f77f32c425435629d7c649986a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b6b348700f87f77f32c425435629d7c649986a4/report_sxw.py
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.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty) cur = line.order_id.pricelist_id.currency_id res[line.id] = cur_obj.round(cr, uid, cur, taxes['total']) return res
478ad61bb1e8b549a15572913d5b6e270bc60d38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/478ad61bb1e8b549a15572913d5b6e270bc60d38/sale.py
def _get_line_uom(line): if (line.order_id.invoice_quantity=='order') or not line.procurement_id: if line.product_uos: return line.product_uos.id return line.product_uom.id else: return self.pool.get('procurement.order').uom_get(cr, uid, line.procurement_id.id, context=context)
478ad61bb1e8b549a15572913d5b6e270bc60d38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/478ad61bb1e8b549a15572913d5b6e270bc60d38/sale.py
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 arguments, like lang, time zone @return: Returns a dict which contains new values, and context """ if not journal_id: return {} currency_pool = self.pool.get('res.currency') move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') default = { 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False}, }
4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec/voucher.py
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 arguments, like lang, time zone @return: Returns a dict which contains new values, and context """ if not journal_id: return {} currency_pool = self.pool.get('res.currency') move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') default = { 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False}, }
4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec/voucher.py
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 arguments, like lang, time zone @return: Returns a dict which contains new values, and context """ if not journal_id: return {} currency_pool = self.pool.get('res.currency') move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') default = { 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False}, }
4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec/voucher.py
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
4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4a3baffa6dfeca0db4cd0bcbe105c0026883c2ec/voucher.py
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_voucher, self).unlink(self, cr, uid, unlink_ids)
4b8f8dff839a3601d1a23e36d4720bdb69c0813d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4b8f8dff839a3601d1a23e36d4720bdb69c0813d/voucher.py
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_voucher, self).unlink(self, cr, uid, unlink_ids)
4b8f8dff839a3601d1a23e36d4720bdb69c0813d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4b8f8dff839a3601d1a23e36d4720bdb69c0813d/voucher.py
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 limit: The Number of Results to Return """
189affe8f2c0bb996740acbd836e555a2e51cc03 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/189affe8f2c0bb996740acbd836e555a2e51cc03/base_calendar.py
res['auto'] = eval(rec.get('auto'))
res['auto'] = eval(rec.get('auto','False'))
def _tag_report(self, cr, rec, data_node=None): res = {} for dest,f in (('name','string'),('model','model'),('report_name','name')): res[dest] = rec.get(f,'').encode('utf8') assert res[dest], "Attribute %s of report is empty !" % (f,) for field,dest in (('rml','report_rml'),('xml','report_xml'),('xsl','report_xsl'),('attachment','attachment'),('attachment_use','attachment_use')): if rec.get(field): res[dest] = rec.get(field).encode('utf8') if rec.get('auto'): res['auto'] = eval(rec.get('auto')) if rec.get('sxw'): sxw_content = misc.file_open(rec.get('sxw')).read() res['report_sxw_content'] = sxw_content if rec.get('header'): res['header'] = eval(rec.get('header')) if rec.get('report_type'): res['report_type'] = rec.get('report_type')
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
res['header'] = eval(rec.get('header'))
res['header'] = eval(rec.get('header','False'))
def _tag_report(self, cr, rec, data_node=None): res = {} for dest,f in (('name','string'),('model','model'),('report_name','name')): res[dest] = rec.get(f,'').encode('utf8') assert res[dest], "Attribute %s of report is empty !" % (f,) for field,dest in (('rml','report_rml'),('xml','report_xml'),('xsl','report_xsl'),('attachment','attachment'),('attachment_use','attachment_use')): if rec.get(field): res[dest] = rec.get(field).encode('utf8') if rec.get('auto'): res['auto'] = eval(rec.get('auto')) if rec.get('sxw'): sxw_content = misc.file_open(rec.get('sxw')).read() res['report_sxw_content'] = sxw_content if rec.get('header'): res['header'] = eval(rec.get('header')) if rec.get('report_type'): res['report_type'] = rec.get('report_type')
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
res['multi'] = rec.get('multi') and eval(rec.get('multi'))
res['multi'] = rec.get('multi') and eval(rec.get('multi','False'))
def _tag_report(self, cr, rec, data_node=None): res = {} for dest,f in (('name','string'),('model','model'),('report_name','name')): res[dest] = rec.get(f,'').encode('utf8') assert res[dest], "Attribute %s of report is empty !" % (f,) for field,dest in (('rml','report_rml'),('xml','report_xml'),('xsl','report_xsl'),('attachment','attachment'),('attachment_use','attachment_use')): if rec.get(field): res[dest] = rec.get(field).encode('utf8') if rec.get('auto'): res['auto'] = eval(rec.get('auto')) if rec.get('sxw'): sxw_content = misc.file_open(rec.get('sxw')).read() res['report_sxw_content'] = sxw_content if rec.get('header'): res['header'] = eval(rec.get('header')) if rec.get('report_type'): res['report_type'] = rec.get('report_type')
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
if not rec.get('menu') or eval(rec.get('menu','')):
if not rec.get('menu') or eval(rec.get('menu','False')):
def _tag_report(self, cr, rec, data_node=None): res = {} for dest,f in (('name','string'),('model','model'),('report_name','name')): res[dest] = rec.get(f,'').encode('utf8') assert res[dest], "Attribute %s of report is empty !" % (f,) for field,dest in (('rml','report_rml'),('xml','report_xml'),('xsl','report_xsl'),('attachment','attachment'),('attachment_use','attachment_use')): if rec.get(field): res[dest] = rec.get(field).encode('utf8') if rec.get('auto'): res['auto'] = eval(rec.get('auto')) if rec.get('sxw'): sxw_content = misc.file_open(rec.get('sxw')).read() res['report_sxw_content'] = sxw_content if rec.get('header'): res['header'] = eval(rec.get('header')) if rec.get('report_type'): res['report_type'] = rec.get('report_type')
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
multi = rec.get('multi','') and eval(rec.get('multi',''))
multi = rec.get('multi','') and eval(rec.get('multi','False'))
def _tag_wizard(self, cr, rec, data_node=None): string = rec.get("string",'').encode('utf8') model = rec.get("model",'').encode('utf8') name = rec.get("name",'').encode('utf8') xml_id = rec.get('id','').encode('utf8') self._test_xml_id(xml_id) multi = rec.get('multi','') and eval(rec.get('multi','')) res = {'name': string, 'wiz_name': name, 'multi': multi, 'model': model}
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
if (not rec.get('menu') or eval(rec.get('menu',''))) and id:
if (not rec.get('menu') or eval(rec.get('menu','False'))) and id:
def _tag_wizard(self, cr, rec, data_node=None): string = rec.get("string",'').encode('utf8') model = rec.get("model",'').encode('utf8') name = rec.get("name",'').encode('utf8') xml_id = rec.get('id','').encode('utf8') self._test_xml_id(xml_id) multi = rec.get('multi','') and eval(rec.get('multi','')) res = {'name': string, 'wiz_name': name, 'multi': multi, 'model': model}
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
elif self.mode=='update' and (rec.get('menu') and eval(rec.get('menu','False'))==False): value = 'ir.actions.wizard,'+str(id) self._remove_ir_values(cr, string, value, model)
def _tag_wizard(self, cr, rec, data_node=None): string = rec.get("string",'').encode('utf8') model = rec.get("model",'').encode('utf8') name = rec.get("name",'').encode('utf8') xml_id = rec.get('id','').encode('utf8') self._test_xml_id(xml_id) multi = rec.get('multi','') and eval(rec.get('multi','')) res = {'name': string, 'wiz_name': name, 'multi': multi, 'model': model}
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
if (not rec.get('menu') or eval(rec.get('menu',''))) and id:
if (not rec.get('menu') or eval(rec.get('menu','False'))) and id:
def _tag_url(self, cr, rec, data_node=None): url = rec.get("string",'').encode('utf8') target = rec.get("target",'').encode('utf8') name = rec.get("name",'').encode('utf8') xml_id = rec.get('id','').encode('utf8') self._test_xml_id(xml_id)
97f26473091c4723e1d97feb7d150a1465b4b151 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/97f26473091c4723e1d97feb7d150a1465b4b151/convert.py
rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context) ids2 = map(itemgetter('id'), rows) if datas['ids'] != ids2: rows_new = [] for id in datas['ids']: rows_new += [elem for elem in rows if elem['id'] == id] rows = rows_new
rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context) ids2 = map(itemgetter('id'), rows) if datas['ids'] != ids2: rows_new = [] for id in datas['ids']: rows_new += [elem for elem in rows if elem['id'] == id] rows = rows_new
def get_groupby_data(groupby = [], domain = []): records = model.read_group(cr, uid, domain, fields_order, groupby , 0, None, context) for rec in records: rec['__group'] = True rec['__no_leaf'] = self.groupby_no_leaf rec['__grouped_by'] = groupby[0] if (isinstance(groupby, list) and groupby) else groupby for f in fields_order: if f not in rec: rec.update({f:False}) elif isinstance(rec[f], tuple): rec[f] = rec[f][1] rows.append(rec) inner_groupby = (rec.get('__context', {})).get('group_by',[]) inner_domain = rec.get('__domain', []) if inner_groupby: get_groupby_data(inner_groupby, inner_domain) else: if self.groupby_no_leaf: continue child_ids = model.search(cr, uid, inner_domain) res = model.read(cr, uid, child_ids, result['fields'].keys(), context) res.sort(lambda x,y: cmp(ids.index(x['id']), ids.index(y['id']))) rows.extend(res)
85bb4e09bc8ebec89b98df32c090c4693a90ef5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/85bb4e09bc8ebec89b98df32c090c4693a90ef5b/ps_list.py
col.set('tree','float')
col.set('tree','float')
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
85bb4e09bc8ebec89b98df32c090c4693a90ef5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/85bb4e09bc8ebec89b98df32c090c4693a90ef5b/ps_list.py
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
85bb4e09bc8ebec89b98df32c090c4693a90ef5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/85bb4e09bc8ebec89b98df32c090c4693a90ef5b/ps_list.py
col.set('tree','float')
col.set('tree', 'float')
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
85bb4e09bc8ebec89b98df32c090c4693a90ef5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/85bb4e09bc8ebec89b98df32c090c4693a90ef5b/ps_list.py
if tsum[f] >= 0.01 : prec = '%.2f' total = prec%(tsum[f]) txt = str(total or '') else: txt = str(tsum[f] or '')
if tsum[f] != 0.0: digits = fields[fields_order[f]].get('digits', (16, 2)) prec = '%%.%sf' % (digits[1], ) total = prec % (tsum[f], ) txt = str(total or '') else: txt = str(tsum[f] or '')
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
85bb4e09bc8ebec89b98df32c090c4693a90ef5b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/85bb4e09bc8ebec89b98df32c090c4693a90ef5b/ps_list.py
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 = self.pool.get('resource.resource') uom_pool = self.pool.get('product.uom') phase_resource = False if context is None: context = {} default_uom_id = self._get_default_uom_id(cr, uid) for phase in self.browse(cr, uid, ids, context=context): if not phase.responsible_id: raise osv.except_osv(_('No responsible person assigned !'),_("You must assign a responsible person for phase '%s' !") % (phase.name,)) phase_resource_obj = resource_pool.generate_resources(cr, uid, [phase.responsible_id.id], calendar_id, context=context) avg_hours = uom_pool._compute_qty(cr, uid, phase.product_uom.id, phase.duration, default_uom_id) duration = str(avg_hours) + 'H' # Create a new project for each phase 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_vacation(cr, uid, calendar_id))
91ace29a8aa15492de8857b4a2f9f0bba6de869e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/91ace29a8aa15492de8857b4a2f9f0bba6de869e/project_long_term.py
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_vacation(cr, uid, calendar_id))
91ace29a8aa15492de8857b4a2f9f0bba6de869e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/91ace29a8aa15492de8857b4a2f9f0bba6de869e/project_long_term.py
def action_move_create(self, cr, uid, ids, *args): """Creates invoice related analytics and financial move lines""" ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') context = {} for inv in self.browse(cr, uid, ids): if not inv.invoice_line: raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.')) if inv.move_id: continue
50960407e600c5e189bf55dd43924b375f42aeb3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50960407e600c5e189bf55dd43924b375f42aeb3/invoice.py
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_sequence_id: sid = obj_inv.journal_id.invoice_sequence_id.id number = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id=%s', {'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id}) else: number = self.pool.get('ir.sequence').get(cr, uid, 'account.invoice.' + invtype) if invtype in ('in_invoice', 'in_refund'): ref = reference else: ref = self._convert_ref(cr, uid, number) cr.execute('UPDATE account_invoice SET number=%s ' \ 'WHERE id=%s', (number, id)) cr.execute('UPDATE account_move SET ref=%s ' \ 'WHERE id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_move_line SET ref=%s ' \ 'WHERE move_id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_analytic_line SET ref=%s ' \ 'FROM account_move_line ' \ 'WHERE account_move_line.move_id = %s ' \ 'AND account_analytic_line.move_id = account_move_line.id', (ref, move_id)) return True
50960407e600c5e189bf55dd43924b375f42aeb3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50960407e600c5e189bf55dd43924b375f42aeb3/invoice.py
def refund(self, cr, uid, ids, date=None, period_id=None, description=None): invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id']) new_ids = [] for invoice in invoices: del invoice['id']
50960407e600c5e189bf55dd43924b375f42aeb3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/50960407e600c5e189bf55dd43924b375f42aeb3/invoice.py
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_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")")
b663b4518fa927de4d2a8e1481a1ea66979f86ef /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b663b4518fa927de4d2a8e1481a1ea66979f86ef/crm_meeting.py
return self.pool.get(current_user_menu.type)\ .read(cr, uid, current_user_menu.id)
return {'menu_reload':True, 'type': 'object'}
def _next(self, cr, uid, context=None): self.__logger.info('getting next operation') next = self._next_action(cr, uid) self.__logger.info('next action is %s', next) if next: action = next.action_id return { 'view_mode': action.view_mode, 'view_type': action.view_type, 'view_id': action.view_id and [action.view_id.id] or False, 'res_model': action.res_model, 'type': action.type, 'target': action.target, } self.__logger.info('all configuration actions have been executed')
7819a48a22921bbee38e797d13bb2d7f20507072 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7819a48a22921bbee38e797d13bb2d7f20507072/res_config.py
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 'Please wait %d sec to start server....'%(waittime) wait_count += 1 time.sleep(waittime) res = execute(connector, method, *args) else: return res wait_count = 0 return res
c6b0b3f058d2ae2345e201d93f4b709b892f8366 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c6b0b3f058d2ae2345e201d93f4b709b892f8366/tiny_xmlrpc.py
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: stored_login = stored_login[0] if not login(db,stored_login,passwd): return False salt = _salt_cache[passwd] cr.execute(' select count(*) from res_users where id=%s and password=%s', (int(uid), encrypt_md5( passwd, salt )) ) res = cr.fetchone()[0] cr.close() if not bool(res): raise security.ExceptionNoTb('AccessDenied') if res: security._uid_cache[uid] = passwd return bool(res)
04a4cf4a321ee59054ee6a6973fb6774bfc18218 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/04a4cf4a321ee59054ee6a6973fb6774bfc18218/crypt.py
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: stored_login = stored_login[0] if not login(db,stored_login,passwd): return False salt = _salt_cache[passwd] cr.execute(' select count(*) from res_users where id=%s and password=%s', (int(uid), encrypt_md5( passwd, salt )) ) res = cr.fetchone()[0] cr.close() if not bool(res): raise security.ExceptionNoTb('AccessDenied') if res: security._uid_cache[uid] = passwd return bool(res)
04a4cf4a321ee59054ee6a6973fb6774bfc18218 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/04a4cf4a321ee59054ee6a6973fb6774bfc18218/crypt.py
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]
04a4cf4a321ee59054ee6a6973fb6774bfc18218 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/04a4cf4a321ee59054ee6a6973fb6774bfc18218/crypt.py
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
6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780/account_invoice_refund.py
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
6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780/account_invoice_refund.py
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
6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780/account_invoice_refund.py
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
6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780/account_invoice_refund.py
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
6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780/account_invoice_refund.py
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
6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bc2e55c1f70f27f7f02ea2bb7eff4684ffc2780/account_invoice_refund.py
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 case IDs @param context: A standard dictionary for contextual values""" if not context: context = {} stage_pool = self.pool.get('crm.case.stage') model = self._name for case in self.browse(cr, uid, ids, context): next_stage = False data = {} domain = [('object_id.model', '=', model)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order='sequence') index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) if index + 1 == len(stages): return False else: next_stage = stages[index + 1] if next_stage: data = {'stage_id': next_stage} stage = stage_pool.browse(cr, uid, next_stage, context=context) if stage.on_change: data.update({'probability': stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage
8d3797a58a929f1648f068f5ce112aa97f66a793 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8d3797a58a929f1648f068f5ce112aa97f66a793/crm.py
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: List of case IDs @param context: A standard dictionary for contextual values""" if not context: context = {} stage_pool = self.pool.get('crm.case.stage') model = self._name for case in self.browse(cr, uid, ids, context): prev_stage = False data = {} domain = [('object_id.model', '=', model)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order='sequence') index = 0 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) if index == 0: return False else: prev_stage = stages[index - 1] if prev_stage: data = {'stage_id': prev_stage} stage = stage_pool.browse(cr, uid, prev_stage, context=context) if stage.on_change: data.update({'probability': stage.probability}) self.write(cr, uid, [case.id], data, context=context) return prev_stage
8d3797a58a929f1648f068f5ce112aa97f66a793 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8d3797a58a929f1648f068f5ce112aa97f66a793/crm.py
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')
5042d16033366fcd9915508304939ffee76e2202 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5042d16033366fcd9915508304939ffee76e2202/account_cash_statement.py
'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)
acbebe49ffc58250a7b62fe53edaed0fabdad112 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/acbebe49ffc58250a7b62fe53edaed0fabdad112/marketing_campaign.py
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 dictionary for contextual values @param return: Dictionary of state Value """ res = {} for line in self.browse(cr, uid, ids): cr.execute(''' SELECT i.state, i.id FROM account_invoice i WHERE i.id = ( SELECT l.invoice_id FROM account_invoice_line l WHERE l.id = ( SELECT ml.account_invoice_line FROM membership_membership_line ml WHERE ml.id = %s ) ) ''', (line.id,)) fetched = cr.fetchone() if not fetched : res[line.id] = 'canceled' continue istate = fetched[0] state = 'none' if (istate == 'draft') | (istate == 'proforma'): state = 'waiting' elif istate == 'open': state = 'invoiced' elif istate == 'paid': state = 'paid' inv = self.pool.get('account.invoice').browse(cr, uid, fetched[1]) for payment in inv.payment_ids: if payment.invoice and payment.invoice.type == 'out_refund': state = 'canceled' elif istate == 'cancel': state = 'canceled' res[line.id] = state return res
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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 dictionary for contextual values @param return: Dictionary of state Value """ res = {} for line in self.browse(cr, uid, ids): cr.execute(''' SELECT i.state, i.id FROM account_invoice i WHERE i.id = ( SELECT l.invoice_id FROM account_invoice_line l WHERE l.id = ( SELECT ml.account_invoice_line FROM membership_membership_line ml WHERE ml.id = %s ) ) ''', (line.id,)) fetched = cr.fetchone() if not fetched : res[line.id] = 'canceled' continue istate = fetched[0] state = 'none' if (istate == 'draft') | (istate == 'proforma'): state = 'waiting' elif istate == 'open': state = 'invoiced' elif istate == 'paid': state = 'paid' inv = self.pool.get('account.invoice').browse(cr, uid, fetched[1]) for payment in inv.payment_ids: if payment.invoice and payment.invoice.type == 'out_refund': state = 'canceled' elif istate == 'cancel': state = 'canceled' res[line.id] = state return res
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
'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 dictionary for contextual values @param return: Dictionary of state Value """ res = {} for line in self.browse(cr, uid, ids): cr.execute(''' SELECT i.state, i.id FROM account_invoice i WHERE i.id = ( SELECT l.invoice_id FROM account_invoice_line l WHERE l.id = ( SELECT ml.account_invoice_line FROM membership_membership_line ml WHERE ml.id = %s ) ) ''', (line.id,)) fetched = cr.fetchone() if not fetched : res[line.id] = 'canceled' continue istate = fetched[0] state = 'none' if (istate == 'draft') | (istate == 'proforma'): state = 'waiting' elif istate == 'open': state = 'invoiced' elif istate == 'paid': state = 'paid' inv = self.pool.get('account.invoice').browse(cr, uid, fetched[1]) for payment in inv.payment_ids: if payment.invoice and payment.invoice.type == 'out_refund': state = 'canceled' elif istate == 'cancel': state = 'canceled' res[line.id] = state return res
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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 ids2: ids2 = res_obj.search(cr, uid, [('associate_member','in',ids2)], context=context) list_partner += ids2 return list_partner
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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.search(cr, uid, [('associate_member','in',ids2)], context=context) list_partner += ids2 return list_partner
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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 Name @param context: A standard dictionary for contextual values @param return: Dictionary of Membership state Value """ 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.membership_stop and today > partner_data.membership_stop: res[id] = 'old' continue s = 4 if partner_data.member_lines: for mline in partner_data.member_lines: if mline.date_to >= today: if mline.account_invoice_line and mline.account_invoice_line.invoice_id: mstate = mline.account_invoice_line.invoice_id.state if mstate == 'paid': s = 0 inv = mline.account_invoice_line.invoice_id for payment in inv.payment_ids: if payment.invoice.type == 'out_refund': s = 2 break elif mstate == 'open' and s!=0: s = 1 elif mstate == 'cancel' and s!=0 and s!=1: s = 2 elif (mstate == 'draft' or mstate == 'proforma') and s!=0 and s!=1: s = 3 if s==4: for mline in partner_data.member_lines: if mline.date_from < today and mline.date_to < today and mline.date_from<=mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid': s = 5 else: s = 6 if s==0: res[id] = 'paid' elif s==1: res[id] = 'invoiced' elif s==2: res[id] = 'canceled' elif s==3: res[id] = 'waiting' elif s==5: res[id] = 'old' elif s==6: res[id] = 'none' if partner_data.free_member and s!=0: res[id] = 'free' if partner_data.associate_member: res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context) res[id] = res_state[partner_data.associate_member.id] return res
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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 Name @param context: A standard dictionary for contextual values @param return: Dictionary of Membership state Value """ 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.membership_stop and today > partner_data.membership_stop: res[id] = 'old' continue s = 4 if partner_data.member_lines: for mline in partner_data.member_lines: if mline.date_to >= today: if mline.account_invoice_line and mline.account_invoice_line.invoice_id: mstate = mline.account_invoice_line.invoice_id.state if mstate == 'paid': s = 0 inv = mline.account_invoice_line.invoice_id for payment in inv.payment_ids: if payment.invoice.type == 'out_refund': s = 2 break elif mstate == 'open' and s!=0: s = 1 elif mstate == 'cancel' and s!=0 and s!=1: s = 2 elif (mstate == 'draft' or mstate == 'proforma') and s!=0 and s!=1: s = 3 if s==4: for mline in partner_data.member_lines: if mline.date_from < today and mline.date_to < today and mline.date_from<=mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid': s = 5 else: s = 6 if s==0: res[id] = 'paid' elif s==1: res[id] = 'invoiced' elif s==2: res[id] = 'canceled' elif s==3: res[id] = 'waiting' elif s==5: res[id] = 'old' elif s==6: res[id] = 'none' if partner_data.free_member and s!=0: res[id] = 'free' if partner_data.associate_member: res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context) res[id] = res_state[partner_data.associate_member.id] return res
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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):
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
limit=1, order='date_from')
limit=1, order='date_from', context=context)
def _membership_date(self, cr, uid, ids, name, args, context=None):
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
['date_from'])['date_from']
['date_from'], context=context)['date_from']
def _membership_date(self, cr, uid, ids, name, args, context=None):
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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):
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
['date_to'])['date_to']
['date_to'], context=context)['date_to']
def _membership_date(self, cr, uid, ids, name, args, context=None):
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py
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):
2a4c1e50cb967d4599507ed63424b4f85c7753ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a4c1e50cb967d4599507ed63424b4f85c7753ea/membership.py