bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
470,000
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
470,001
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
470,002
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
470,003
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
470,004
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') cr.execute("""
470,005
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, }
def _print_report(self, cr, uid, ids, data, query_line, context=None): periods = data['form']['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, }
470,006
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, }
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, }
470,007
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 {}
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() if data['form']['date_select'] == 'date_maturity': date_line = line.ml_maturity_date ctx['date'] = date_line # 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 {}
470,008
def override_password(o): if 'password' in o and ( 'id' not in o or o['id'] != uid ): o['password'] = '********' return o
def override_password(o): if 'password' in o and ( 'id' not in o or o['id'] != uid ): o['password'] = '********' return o
470,009
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
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
470,010
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
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
470,011
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
470,012
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
470,013
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
470,014
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),))
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']: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], date, int(id),))
470,015
def on_change_sub(self, cr, uid, ids, pieces, number,*a):
def on_change_sub(self, cr, uid, ids, pieces, number,*a):
470,016
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')
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')
470,017
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')
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')
470,018
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')
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')
470,019
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')
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')
470,020
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')
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('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement')
470,021
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')
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')
470,022
def wiki_menu_create(self, cr, uid, ids, context):
def wiki_menu_create(self, cr, uid, ids, context):
470,023
def wiki_menu_create(self, cr, uid, ids, context):
def wiki_menu_create(self, cr, uid, ids, context):
470,024
def wiki_menu_create(self, cr, uid, ids, context):
def wiki_menu_create(self, cr, uid, ids, context):
470,025
def get_module_from_path(path, mod_paths=None):
def get_module_from_path(path, mod_paths=None):
470,026
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
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 (abs(obj.amount) == obj.voucher_id.amount): return False return True
470,027
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 _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:
470,028
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 _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:
470,029
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_effective_date(self, cr, uid, ids, name, arg, context=None): 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
470,030
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_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
470,031
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
def _get_commitment_date(self, cr, uid, ids, name, arg, context=None): 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
470,032
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
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
470,033
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
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
470,034
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
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
470,035
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 ) """)
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 ,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 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 ) """)
470,036
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 !'))
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 !'))
470,037
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 _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()
470,038
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)]
def _model_search(self, cr, uid, obj, name, args, context={}): 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)]
470,039
fld_def = ((f in self._columns) and self._columns[f]) \ or ((f in self._inherit_fields) and self._inherit_fields[f][2]) \ or 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
470,040
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)
def write(self, cr, uid, ids, vals, context=None): if context is None: 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)
470,041
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
def __str__(self): if self.val: if getattr(self,'name', None): date = datetime.strptime(self.name, DT_FORMAT) return date.strftime(str(self.lang_obj.date_format)) return self.val
470,042
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
def __str__(self): if self.val and getattr(self,'name', None): return datetime.strptime(self.name, DHM_FORMAT)\ .strftime("%s %s"%(str(self.lang_obj.date_format), str(self.lang_obj.time_format))) return self.val
470,043
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
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, line.price_unit, 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
470,044
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)
def_get_line_uom(line):if(line.order_id.invoice_quantity=='order')ornotline.procurement_id:ifline.product_uos:returnline.product_uos.idreturnline.product_uom.idelse:returnself.pool.get('procurement.order').uom_get(cr,uid,line.procurement_id.id,context=context)
470,045
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}, }
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}, }
470,046
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}, }
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}, }
470,047
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}, }
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}, }
470,048
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 _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
470,049
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)
def unlink(self, cr, uid, ids, context=None): 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)
470,050
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)
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)
470,051
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 """
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 """
470,052
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')
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','False')) 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')
470,053
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')
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','False')) if rec.get('report_type'): res['report_type'] = rec.get('report_type')
470,054
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')
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')
470,055
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')
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')
470,056
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}
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','False')) res = {'name': string, 'wiz_name': name, 'multi': multi, 'model': model}
470,057
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}
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}
470,058
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}
defelif 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) _tag_wizard(self,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) cr,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) rec,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) data_node=None):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) stringelif 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) =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) rec.get("string",'').encode('utf8')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) modelelif 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) =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) rec.get("model",'').encode('utf8')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) nameelif 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) =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) rec.get("name",'').encode('utf8')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) xml_idelif 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) =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) rec.get('id','').encode('utf8')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) self._test_xml_id(xml_id)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) multielif 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) =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) rec.get('multi','')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) andelif 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) eval(rec.get('multi',''))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) reselif 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) =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) {'name':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) string,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) 'wiz_name':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) name,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) 'multi':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) multi,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) 'model':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) model}
470,059
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)
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)
470,060
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)
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)
470,061
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
470,062
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
470,063
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
470,064
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
def _append_node(name, text): n = etree.SubElement(config, name) n.text = text
470,065
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))
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') 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))
470,066
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))
def Project(): # 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))
470,067
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
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
470,068
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
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', {'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
470,069
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']
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']
470,070
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))+")")
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 = [] 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))+")")
470,071
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')
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')
470,072
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
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) 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
470,073
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)
def check(db, uid, passwd): cached_pass = security._uid_cache.get(db, {}).get(uid) if (cached_pass is not None) and cached_pass == 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)
470,074
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)
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 security.ExceptionNoTb('AccessDenied') 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)
470,075
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]
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]
470,076
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
defcompute_refund(self,cr,uid,ids,mode='refund',context=None):"""@paramcr:thecurrentrow,fromthedatabasecursor,@paramuid:thecurrentuser’sIDforsecuritychecks,@paramids:theaccountinvoicerefund’sIDorlistofIDs
470,077
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
defcompute_refund(self,cr,uid,ids,mode='refund',context=None):"""@paramcr:thecurrentrow,fromthedatabasecursor,@paramuid:thecurrentuser’sIDforsecuritychecks,@paramids:theaccountinvoicerefund’sIDorlistofIDs
470,078
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
defcompute_refund(self,cr,uid,ids,mode='refund',context=None):"""@paramcr:thecurrentrow,fromthedatabasecursor,@paramuid:thecurrentuser’sIDforsecuritychecks,@paramids:theaccountinvoicerefund’sIDorlistofIDs
470,079
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
defcompute_refund(self,cr,uid,ids,mode='refund',context=None):"""@paramcr:thecurrentrow,fromthedatabasecursor,@paramuid:thecurrentuser’sIDforsecuritychecks,@paramids:theaccountinvoicerefund’sIDorlistofIDs
470,080
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
defcompute_refund(self,cr,uid,ids,mode='refund',context=None):"""@paramcr:thecurrentrow,fromthedatabasecursor,@paramuid:thecurrentuser’sIDforsecuritychecks,@paramids:theaccountinvoicerefund’sIDorlistofIDs
470,081
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
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
470,082
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
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),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) 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
470,083
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
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),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) 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
470,084
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')
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')
470,085
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)
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)
470,086
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
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, context=context): 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
470,087
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
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], context=context) 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
470,088
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
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
470,089
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
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=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
470,090
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
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=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
470,091
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
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, context=context) 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
470,092
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
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=context) res[id] = res_state[partner_data.associate_member.id] return res
470,093
def _membership_date(self, cr, uid, ids, name, args, context=None):
def _membership_date(self, cr, uid, ids, name, args, context=None):
470,094
def _membership_date(self, cr, uid, ids, name, args, context=None):
def _membership_date(self, cr, uid, ids, name, args, context=None):
470,095
def _membership_date(self, cr, uid, ids, name, args, context=None):
def _membership_date(self, cr, uid, ids, name, args, context=None):
470,096
def _membership_date(self, cr, uid, ids, name, args, context=None):
def _membership_date(self, cr, uid, ids, name, args, context=None):
470,097
def _membership_date(self, cr, uid, ids, name, args, context=None):
def _membership_date(self, cr, uid, ids, name, args, context=None):
470,098
def _membership_date(self, cr, uid, ids, name, args, context=None):
def _membership_date(self, cr, uid, ids, name, args, context=None):
470,099