bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def name_get(self, cr, user, ids, context={}): if not len(ids): return [] res = [] for r in self.read(cr, user, ids, ['name','zip','country_id', 'city','partner_id', 'street']): if context.get('contact_display', 'contact')=='partner' and r['partner_id']: res.append((r['id'], r['partner_id'][1])) else: addr = r['name'] or '' if r['name'] and (r['city'] or r['country_id']): addr += ', ' addr += (r['country_id'] and r['country_id'][1] or '') + ' ' + (r['city'] or '') + ' ' + (r['street'] or '') if context.get('contact_display', 'contact')=='partner_address': res.append((r['id'], "%s: %s" % (r['partner_id'][1], addr.strip() or '/'))) else: res.append((r['id'], addr.strip() or '/')) return res
def name_get(self, cr, user, ids, context={}): if not len(ids): return [] res = [] for r in self.read(cr, user, ids, ['name','zip','country_id', 'city','partner_id', 'street']): if context.get('contact_display', 'contact')=='partner' and r['partner_id']: res.append((r['id'], r['partner_id'][1])) else: addr = r['name'] or '' if r['name'] and (r['city'] or r['country_id']): addr += ', ' addr += (r['country_id'] and r['country_id'][1] or '') + ' ' + (r['city'] or '') + ' ' + (r['street'] or '') if (context.get('contact_display', 'contact')=='partner_address') and r['partner_id']: res.append((r['id'], "%s: %s" % (r['partner_id'][1], addr.strip() or '/'))) else: res.append((r['id'], addr.strip() or '/')) return res
467,900
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders .
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders .
467,901
def __init__(self, exp): # check if the expression is valid if not reduce(lambda acc, val: acc and (self._is_operator(val) or self._is_leaf(val)), exp, True): raise ValueError('Bad domain expression: %r' % (exp,)) self.__exp = exp self.__tables = {} # used to store the table to use for the sql generation. key = index of the leaf self.__joins = [] self.__main_table = None # 'root' table. set by parse() self.__DUMMY_LEAF = (1, '=', 1) # a dummy leaf that must not be parsed or sql generated
def __init__(self, exp): # check if the expression is valid if not reduce(lambda acc, val: acc and (self._is_operator(val) or self._is_leaf(val)), exp, True): raise ValueError('Bad domain expression: %r' % (exp,)) self.__exp = exp self.__field_tables = {} self.__all_tables = set() # used to store the table to use for the sql generation. key = index of the leaf self.__joins = [] self.__main_table = None # 'root' table. set by parse() self.__DUMMY_LEAF = (1, '=', 1) # a dummy leaf that must not be parsed or sql generated
467,902
def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent)
def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent)
467,903
def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent)
def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent)
467,904
def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent)
def rg(ids, table, parent): if not ids: return [] ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context) return ids + rg(ids2, table, parent)
467,905
def to_sql(self): stack = [] params = [] for i, e in reverse_enumerate(self.__exp): if self._is_leaf(e, internal=True): table = self.__tables.get(i, self.__main_table) q, p = self.__leaf_to_sql(e, table) params.insert(0, p) stack.append(q) else: if e == '!': stack.append('(NOT (%s))' % (stack.pop(),)) else: ops = {'&': ' AND ', '|': ' OR '} q1 = stack.pop() q2 = stack.pop() stack.append('(%s %s %s)' % (q1, ops[e], q2,))
def to_sql(self): stack = [] params = [] for i, e in reverse_enumerate(self.__exp): if self._is_leaf(e, internal=True): table = self.__field_tables.get(i, self.__main_table) q, p = self.__leaf_to_sql(e, table) params.insert(0, p) stack.append(q) else: if e == '!': stack.append('(NOT (%s))' % (stack.pop(),)) else: ops = {'&': ' AND ', '|': ' OR '} q1 = stack.pop() q2 = stack.pop() stack.append('(%s %s %s)' % (q1, ops[e], q2,))
467,906
def to_sql(self): stack = [] params = [] for i, e in reverse_enumerate(self.__exp): if self._is_leaf(e, internal=True): table = self.__tables.get(i, self.__main_table) q, p = self.__leaf_to_sql(e, table) params.insert(0, p) stack.append(q) else: if e == '!': stack.append('(NOT (%s))' % (stack.pop(),)) else: ops = {'&': ' AND ', '|': ' OR '} q1 = stack.pop() q2 = stack.pop() stack.append('(%s %s %s)' % (q1, ops[e], q2,))
def to_sql(self): stack = [] params = [] for i, e in reverse_enumerate(self.__exp): if self._is_leaf(e, internal=True): table = self.__tables.get(i, self.__main_table) q, p = self.__leaf_to_sql(e, table) params.insert(0, p) stack.append(q) else: if e == '!': stack.append('(NOT (%s))' % (stack.pop(),)) else: ops = {'&': ' AND ', '|': ' OR '} q1 = stack.pop() q2 = stack.pop() stack.append('(%s %s %s)' % (q1, ops[e], q2,))
467,907
def get_tables(self): return ['"%s"' % t._table for t in set(self.__tables.values()+[self.__main_table])]
def get_tables(self): return ['"%s"' % t._table for t in set(self.__tables.values()+[self.__main_table])]
467,908
def search(self, cr, uid, args, offset=0, limit=2000, order=None, context=None, count=False): if context is None: context = {} ids = osv.orm.orm.search(self, cr, uid, args, offset, limit, order, context=context, count=(count and uid==1))
def search(self, cr, uid, args, offset=0, limit=2000, order=None, context=None, count=False): if context is None: context = {} ids = osv.orm.orm.search(self, cr, uid, args, offset, limit, order, context=context, count=(count and uid==1))
467,909
def write(self, cr, uid, ids, vals, context=None): if 'date' in vals: new_vals = {'date_deadline': vals.get('date')} obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview') for evalutation in self.browse(cr, uid, ids, context=context): for survey_req in evalutation.survey_request_ids: obj_hr_eval_iterview.write(cr, uid, [survey_req.id], new_vals, context=context) return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context)
def write(self, cr, uid, ids, vals, context=None): if 'date' in vals: new_vals = {'date_deadline': vals.get('date')} obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview') for evalutation in self.browse(cr, uid, ids, context=context): for survey_req in evalutation.survey_request_ids: obj_hr_eval_iterview.write(cr, uid, [survey_req.id], new_vals, context=context) return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context)
467,910
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) return amount
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code } ) return amount
467,911
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) return amount
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': production.product_id.id } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': production.product_id.id } ) return amount
467,912
def import_data(self, cr, uid, fields, datas, mode='init', current_module='', noupdate=False, context=None, filename=None): """ Import given data in given module
defExample of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) import_data(self,Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) cr,Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) uid,Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) fields,Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) datas,Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) mode='init',Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) current_module='',Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) noupdate=False,Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) context=None,Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) filename=None):Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) """Example of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) ImportExample of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) givenExample of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) dataExample of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) inExample of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) givenExample of fields to import for a sale.order .id, (=database_id) partner_id, (=name_search) order_line/.id, (=database_id) order_line/name, order_line/product_id/id, (=xml id) order_line/price_unit, order_line/product_uom_qty, order_line/product_uom/id (=xml_id) module
467,913
def import_data(self, cr, uid, fields, datas, mode='init', current_module='', noupdate=False, context=None, filename=None): """ Import given data in given module
def import_data(self, cr, uid, fields, datas, mode='init', current_module='', noupdate=False, context=None, filename=None): """ Import given data in given module
467,914
def import_data(self, cr, uid, fields, datas, mode='init', current_module='', noupdate=False, context=None, filename=None): """ Import given data in given module
def import_data(self, cr, uid, fields, datas, mode='init', current_module='', noupdate=False, context=None, filename=None): """ Import given data in given module
467,915
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
467,916
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
467,917
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
467,918
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) field = fields[i] if field[:len(prefix)] <> prefix: if line[i] and skip: return False continue
467,919
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
467,920
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
467,921
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
467,922
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
467,923
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,924
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,925
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,926
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,927
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,928
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,929
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,930
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,931
fields_def = self.fields_get(cr, uid, context=context)
fields_def = self.fields_get(cr, uid, context=context)
467,932
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name))
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name))
467,933
def get_id(self, cr, uid, sequence_id, test='id', context={}): cr.execute('select id from ir_sequence where '+test+'=%s and active=%s', (sequence_id, True,)) res = cr.dictfetchone() if res: for line in self.browse(cr, uid, res['id'], context=context).fiscal_ids: if line.fiscalyear_id.id==context.get('fiscalyear_id', False): return super(ir_sequence, self).get_id(cr, uid, line.sequence_id.id, test="id", context=context) return super(ir_sequence, self).get_id(cr, uid, sequence_id, test, context)
def get_id(self, cr, uid, sequence_id, test='id', context={}): if test not in ('id=%s', 'code=%s'): raise ValueError('invalid test') cr.execute('select id from ir_sequence where '+test+'=%s and active=%s', (sequence_id, True,)) res = cr.dictfetchone() if res: for line in self.browse(cr, uid, res['id'], context=context).fiscal_ids: if line.fiscalyear_id.id==context.get('fiscalyear_id', False): return super(ir_sequence, self).get_id(cr, uid, line.sequence_id.id, test="id", context=context) return super(ir_sequence, self).get_id(cr, uid, sequence_id, test, context)
467,934
def create(self, cr, uid, vals, context={}): attendee_ids = vals.get('attendee_ids',False) model = context.get('model', False) res_id = context.get('active_id', False) state = context.get('state', False) attendee_obj = self.pool.get('calendar.attendee') if attendee_ids and model and res_id: attend = False if model == 'calendar.attendee' and state == 'delegated': attend = attendee_obj.read(cr, uid, res_id, ['ref','user_id','del_to_user_ids']) for v1, v2, attendee in attendee_ids: vals = {} ref = '%s,%d'%(model, res_id) if attend: ref = attend['ref'] del_from_user_ids = [attend['user_id'][0]] del_to_user_ids = attend['del_to_user_ids'] del_to_user_ids.append(attendee['user_id']) vals.update({ 'del_from_user_ids' : [(6, 0, del_from_user_ids)] }) attendee_obj.write(cr, uid, [res_id], {'del_to_user_ids' : [(6, 0, del_to_user_ids)]}) vals.update({ 'ref': ref, }) attendee.update(vals) attendee_obj.create(cr, uid, attendee) res = super(invite_attendee_wizard, self).create(cr, uid, {}, context=context) return res
def create(self, cr, uid, vals, context={}): attendee_ids = vals.get('attendee_ids',False) model = context.get('model', False) res_id = context.get('active_id', False) state = context.get('state', False) attendee_obj = self.pool.get('calendar.attendee') if attendee_ids and model and res_id: attend = False if model == 'calendar.attendee' and state == 'delegated': attend = attendee_obj.read(cr, uid, res_id, ['ref','user_id','del_to_user_ids']) for v1, v2, attendee in attendee_ids: vals = {} ref = '%s,%d'%(model, res_id) if attend: ref = attend['ref'] del_from_user_ids = [attend['user_id'][0]] del_to_user_ids = attend['del_to_user_ids'] del_to_user_ids.append(attendee['user_id']) vals.update({ 'del_from_user_ids' : [(6, 0, del_from_user_ids)] }) attendee_obj.write(cr, uid, [res_id], {'state':'delegated','del_to_user_ids' : [(6, 0, del_to_user_ids)]}) vals.update({ 'ref': ref, }) attendee.update(vals) attendee_obj.create(cr, uid, attendee) res = super(invite_attendee_wizard, self).create(cr, uid, {}, context=context) return res
467,935
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
467,936
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
467,937
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
467,938
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
467,939
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' Call the scheduler to check the procurement order @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param use_new_cursor: False or the dbname @param context: A standard dictionary for contextual values @return: Dictionary of values ''' if not context: context = {}
467,940
def create_automatic_op(self, cr, uid, context=None): """ Create procurement of virtual stock < 0 @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param context: A standard dictionary for contextual values @return: Dictionary of values """ if not context: context = {} product_obj = self.pool.get('product.product') proc_obj = self.pool.get('procurement.order') warehouse_obj = self.pool.get('stock.warehouse') wf_service = netsvc.LocalService("workflow")
def create_automatic_op(self, cr, uid, context=None): """ Create procurement of virtual stock < 0 @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param context: A standard dictionary for contextual values @return: Dictionary of values """ if not context: context = {} product_obj = self.pool.get('product.product') proc_obj = self.pool.get('procurement.order') warehouse_obj = self.pool.get('stock.warehouse') wf_service = netsvc.LocalService("workflow")
467,941
def create_automatic_op(self, cr, uid, context=None): """ Create procurement of virtual stock < 0 @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param context: A standard dictionary for contextual values @return: Dictionary of values """ if not context: context = {} product_obj = self.pool.get('product.product') proc_obj = self.pool.get('procurement.order') warehouse_obj = self.pool.get('stock.warehouse') wf_service = netsvc.LocalService("workflow")
def create_automatic_op(self, cr, uid, context=None): """ Create procurement of virtual stock < 0 @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param context: A standard dictionary for contextual values @return: Dictionary of values """ if not context: context = {} product_obj = self.pool.get('product.product') proc_obj = self.pool.get('procurement.order') warehouse_obj = self.pool.get('stock.warehouse') wf_service = netsvc.LocalService("workflow")
467,942
def _procure_orderpoint_confirm(self, cr, uid, automatic=False,\ use_new_cursor=False, context=None, user_id=False): ''' Create procurement based on Orderpoint use_new_cursor: False or the dbname @param self: The object pointer @param cr: The current row, from the database cursor, @param user_id: The current user ID for security checks @param context: A standard dictionary for contextual values @param param: False or the dbname @return: Dictionary of values """ ''' if not context: context = {} if use_new_cursor: cr = pooler.get_db(use_new_cursor).cursor() orderpoint_obj = self.pool.get('stock.warehouse.orderpoint') location_obj = self.pool.get('stock.location') procurement_obj = self.pool.get('procurement.order') request_obj = self.pool.get('res.request') wf_service = netsvc.LocalService("workflow") report = [] offset = 0 ids = [1] if automatic: self.create_automatic_op(cr, uid, context=context) while ids: ids = orderpoint_obj.search(cr, uid, [], offset=offset, limit=100) for op in orderpoint_obj.browse(cr, uid, ids): if op.procurement_id.state != 'exception': if op.procurement_id and op.procurement_id.purchase_id and op.procurement_id.purchase_id.state in ('draft', 'confirmed'): continue prods = location_obj._product_virtual_get(cr, uid, op.location_id.id, [op.product_id.id], {'uom': op.product_uom.id})[op.product_id.id] if prods < op.product_min_qty: qty = max(op.product_min_qty, op.product_max_qty)-prods reste = qty % op.qty_multiple if reste > 0: qty += op.qty_multiple - reste newdate = datetime.today() + relativedelta( days = int(op.product_id.seller_delay)) if qty <= 0: continue if op.product_id.type not in ('consu'): proc_id = procurement_obj.create(cr, uid, { 'name': op.name, 'date_planned': newdate.strftime('%Y-%m-%d'), 'product_id': op.product_id.id, 'product_qty': qty, 'product_uom': op.product_uom.id, 'location_id': op.location_id.id, 'procure_method': 'make_to_order', 'origin': op.name }) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr) orderpoint_obj.write(cr, uid, [op.id], {'procurement_id': proc_id}) offset += len(ids) if use_new_cursor: cr.commit() if user_id and report: request_obj.create(cr, uid, { 'name': 'Orderpoint report.', 'act_from': user_id, 'act_to': user_id, 'body': '\n'.join(report) }) if use_new_cursor: cr.commit() cr.close() return {}
def _procure_orderpoint_confirm(self, cr, uid, automatic=False,\ use_new_cursor=False, context=None, user_id=False): ''' Create procurement based on Orderpoint use_new_cursor: False or the dbname @param self: The object pointer @param cr: The current row, from the database cursor, @param user_id: The current user ID for security checks @param context: A standard dictionary for contextual values @param param: False or the dbname @return: Dictionary of values """ ''' if not context: context = {} if use_new_cursor: cr = pooler.get_db(use_new_cursor).cursor() orderpoint_obj = self.pool.get('stock.warehouse.orderpoint') location_obj = self.pool.get('stock.location') procurement_obj = self.pool.get('procurement.order') request_obj = self.pool.get('res.request') wf_service = netsvc.LocalService("workflow") report = [] offset = 0 ids = [1] if automatic: self.create_automatic_op(cr, uid, context=context) while ids: ids = orderpoint_obj.search(cr, uid, [], offset=offset, limit=100) for op in orderpoint_obj.browse(cr, uid, ids): if op.procurement_id.state != 'exception': if op.procurement_id and op.procurement_id.purchase_id and op.procurement_id.purchase_id.state in ('draft', 'confirmed'): continue prods = location_obj._product_virtual_get(cr, uid, op.location_id.id, [op.product_id.id], {'uom': op.product_uom.id})[op.product_id.id] if prods < op.product_min_qty: qty = max(op.product_min_qty, op.product_max_qty)-prods reste = qty % op.qty_multiple if reste > 0: qty += op.qty_multiple - reste newdate = datetime.today() + relativedelta( days = int(op.product_id.seller_delay)) if qty <= 0: continue if op.product_id.type not in ('consu'): proc_id = procurement_obj.create(cr, uid, { 'name': op.name, 'date_planned': newdate.strftime('%Y-%m-%d'), 'product_id': op.product_id.id, 'product_qty': qty, 'product_uom': op.product_uom.id, 'location_id': op.location_id.id, 'procure_method': 'make_to_order', 'origin': op.name }) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr) orderpoint_obj.write(cr, uid, [op.id], {'procurement_id': proc_id}) offset += len(ids) if use_new_cursor: cr.commit() if user_id and report: request_obj.create(cr, uid, { 'name': 'Orderpoint report.', 'act_from': user_id, 'act_to': user_id, 'body': '\n'.join(report) }) if use_new_cursor: cr.commit() cr.close() return {}
467,943
def _procure_orderpoint_confirm(self, cr, uid, automatic=False,\ use_new_cursor=False, context=None, user_id=False): ''' Create procurement based on Orderpoint use_new_cursor: False or the dbname @param self: The object pointer @param cr: The current row, from the database cursor, @param user_id: The current user ID for security checks @param context: A standard dictionary for contextual values @param param: False or the dbname @return: Dictionary of values """ ''' if not context: context = {} if use_new_cursor: cr = pooler.get_db(use_new_cursor).cursor() orderpoint_obj = self.pool.get('stock.warehouse.orderpoint') location_obj = self.pool.get('stock.location') procurement_obj = self.pool.get('procurement.order') request_obj = self.pool.get('res.request') wf_service = netsvc.LocalService("workflow") report = [] offset = 0 ids = [1] if automatic: self.create_automatic_op(cr, uid, context=context) while ids: ids = orderpoint_obj.search(cr, uid, [], offset=offset, limit=100) for op in orderpoint_obj.browse(cr, uid, ids): if op.procurement_id.state != 'exception': if op.procurement_id and op.procurement_id.purchase_id and op.procurement_id.purchase_id.state in ('draft', 'confirmed'): continue prods = location_obj._product_virtual_get(cr, uid, op.location_id.id, [op.product_id.id], {'uom': op.product_uom.id})[op.product_id.id] if prods < op.product_min_qty: qty = max(op.product_min_qty, op.product_max_qty)-prods reste = qty % op.qty_multiple if reste > 0: qty += op.qty_multiple - reste newdate = datetime.today() + relativedelta( days = int(op.product_id.seller_delay)) if qty <= 0: continue if op.product_id.type not in ('consu'): proc_id = procurement_obj.create(cr, uid, { 'name': op.name, 'date_planned': newdate.strftime('%Y-%m-%d'), 'product_id': op.product_id.id, 'product_qty': qty, 'product_uom': op.product_uom.id, 'location_id': op.location_id.id, 'procure_method': 'make_to_order', 'origin': op.name }) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr) orderpoint_obj.write(cr, uid, [op.id], {'procurement_id': proc_id}) offset += len(ids) if use_new_cursor: cr.commit() if user_id and report: request_obj.create(cr, uid, { 'name': 'Orderpoint report.', 'act_from': user_id, 'act_to': user_id, 'body': '\n'.join(report) }) if use_new_cursor: cr.commit() cr.close() return {}
def _procure_orderpoint_confirm(self, cr, uid, automatic=False,\ use_new_cursor=False, context=None, user_id=False): ''' Create procurement based on Orderpoint use_new_cursor: False or the dbname @param self: The object pointer @param cr: The current row, from the database cursor, @param user_id: The current user ID for security checks @param context: A standard dictionary for contextual values @param param: False or the dbname @return: Dictionary of values """ ''' if not context: context = {} if use_new_cursor: cr = pooler.get_db(use_new_cursor).cursor() orderpoint_obj = self.pool.get('stock.warehouse.orderpoint') location_obj = self.pool.get('stock.location') procurement_obj = self.pool.get('procurement.order') request_obj = self.pool.get('res.request') wf_service = netsvc.LocalService("workflow") report = [] offset = 0 ids = [1] if automatic: self.create_automatic_op(cr, uid, context=context) while ids: ids = orderpoint_obj.search(cr, uid, [], offset=offset, limit=100) for op in orderpoint_obj.browse(cr, uid, ids): if op.procurement_id.state != 'exception': if op.procurement_id and op.procurement_id.purchase_id and op.procurement_id.purchase_id.state in ('draft', 'confirmed'): continue prods = location_obj._product_virtual_get(cr, uid, op.location_id.id, [op.product_id.id], {'uom': op.product_uom.id})[op.product_id.id] if prods < op.product_min_qty: qty = max(op.product_min_qty, op.product_max_qty)-prods reste = qty % op.qty_multiple if reste > 0: qty += op.qty_multiple - reste newdate = datetime.today() + relativedelta( days = int(op.product_id.seller_delay)) if qty <= 0: continue if op.product_id.type not in ('consu'): proc_id = procurement_obj.create(cr, uid, { 'name': op.name, 'date_planned': newdate.strftime('%Y-%m-%d'), 'product_id': op.product_id.id, 'product_qty': qty, 'product_uom': op.product_uom.id, 'location_id': op.location_id.id, 'procure_method': 'make_to_order', 'origin': op.name }) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr) orderpoint_obj.write(cr, uid, [op.id], {'procurement_id': proc_id}) offset += len(ids) if use_new_cursor: cr.commit() if user_id and report: request_obj.create(cr, uid, { 'name': 'Orderpoint report.', 'act_from': user_id, 'act_to': user_id, 'body': '\n'.join(report) }) if use_new_cursor: cr.commit() cr.close() return {}
467,944
def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0): """ Finds Products and Workcenters for related BoM for manufacturing order. @param bom: BoM of particular product. @param factor: Factor of product UoM. @param properties: A List of properties Ids. @param addthis: If BoM found then True else False. @param level: Depth level to find BoM lines starts from 10. @return: result: List of dictionaries containing product details. result2: List of dictionaries containing workcenter details. """ factor = factor / (bom.product_efficiency or 1.0) factor = rounding(factor, bom.product_rounding) if factor < bom.product_rounding: factor = bom.product_rounding result = [] result2 = [] phantom = False if bom.type == 'phantom' and not bom.bom_lines: newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties) if newbom: res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10) result = result + res[0] result2 = result2 + res[1] phantom = True else: phantom = False if not phantom: if addthis and not bom.bom_lines: result.append( { 'name': bom.product_id.name, 'product_id': bom.product_id.id, 'product_qty': bom.product_qty * factor, 'product_uom': bom.product_uom.id, 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False, 'product_uos': bom.product_uos and bom.product_uos.id or False, }) if bom.routing_id: for wc_use in bom.routing_id.workcenter_lines: wc = wc_use.workcenter_id d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle) mult = (d + (m and 1.0 or 0.0)) cycle = mult * wc_use.cycle_nbr result2.append({ 'name': bom.routing_id.name, 'workcenter_id': wc.id, 'sequence': level+(wc_use.sequence or 0), 'cycle': cycle, 'hour': float(wc_use.hour_nbr*mult + ((wc.time_start or 0.0)+(wc.time_stop or 0.0)+cycle*(wc.time_cycle or 0.0)) * (wc.time_efficiency or 1.0)), }) for bom2 in bom.bom_lines: res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10) result = result + res[0] result2 = result2 + res[1] return result, result2
def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0): """ Finds Products and Workcenters for related BoM for manufacturing order. @param bom: BoM of particular product. @param factor: Factor of product UoM. @param properties: A List of properties Ids. @param addthis: If BoM found then True else False. @param level: Depth level to find BoM lines starts from 10. @return: result: List of dictionaries containing product details. result2: List of dictionaries containing workcenter details. """ factor = factor / (bom.product_efficiency or 1.0) factor = rounding(factor, bom.product_rounding) if factor < bom.product_rounding: factor = bom.product_rounding result = [] result2 = [] phantom = False if bom.type == 'phantom' and not bom.bom_lines: newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties) if newbom: res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10) result = result + res[0] result2 = result2 + res[1] phantom = True else: phantom = False if not phantom: if addthis and not bom.bom_lines: result.append( { 'name': bom.product_id.name, 'product_id': bom.product_id.id, 'product_qty': bom.product_qty * factor, 'product_uom': bom.product_uom.id, 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False, 'product_uos': bom.product_uos and bom.product_uos.id or False, }) if bom.routing_id: for wc_use in bom.routing_id.workcenter_lines: wc = wc_use.workcenter_id d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle) mult = (d + (m and 1.0 or 0.0)) cycle = mult * wc_use.cycle_nbr result2.append({ 'name': tools.ustr(wc_use.name) + ' - ' + tools.ustr(bom.product_id.name), 'workcenter_id': wc.id, 'sequence': level+(wc_use.sequence or 0), 'cycle': cycle, 'hour': float(wc_use.hour_nbr*mult + ((wc.time_start or 0.0)+(wc.time_stop or 0.0)+cycle*(wc.time_cycle or 0.0)) * (wc.time_efficiency or 1.0)), }) for bom2 in bom.bom_lines: res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10) result = result + res[0] result2 = result2 + res[1] return result, result2
467,945
def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False
def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False
467,946
def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False
def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False
467,947
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_acc_tax_template = self.pool.get('account.tax.code.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_acc_chart_template = self.pool.get('account.chart.template') obj_acc_journal_view = self.pool.get('account.journal.view') mod_obj = self.pool.get('ir.model.data') obj_sequence = self.pool.get('ir.sequence') property_obj = self.pool.get('ir.property') fields_obj = self.pool.get('ir.model.fields') obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_acc_tax_template = self.pool.get('account.tax.code.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_acc_chart_template = self.pool.get('account.chart.template') obj_acc_journal_view = self.pool.get('account.journal.view') mod_obj = self.pool.get('ir.model.data') obj_sequence = self.pool.get('ir.sequence') property_obj = self.pool.get('ir.property') fields_obj = self.pool.get('ir.model.fields') obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account')
467,948
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name', 'auction1'], context) name = [(r['id'],'['+r['auction1']+'] '+ r['name']) for r in reads] return name
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name', 'auction1'], context) name = [(r['id'],'['+r['auction1']+'] '+ r['name']) for r in reads] return name
467,949
def get_dav_eprop(self, cr, ns, prop): if not self.DAV_M_NS: return None if self.DAV_M_NS.has_key(ns): prefix = self.DAV_M_NS[ns] else: logger.debug("No namespace: %s ( for prop: %s)",ns, prop) return None
def get_dav_eprop(self, cr, ns, prop): if not self.DAV_M_NS: return None if self.DAV_M_NS.has_key(ns): prefix = self.DAV_M_NS[ns] else: logger.debug('No namespace: %s ("%s")',ns, prop) return None
467,950
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
467,951
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
467,952
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return self._find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
467,953
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id
467,954
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False data = {} domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id
467,955
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id
467,956
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
467,957
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
467,958
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
467,959
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
467,960
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
467,961
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
def _process_end(self, cr, uid, modules): if not modules: return True modules = list(modules) module_in = ",".join(["%s"] * len(modules)) cr.execute('select id,name,model,res_id,module from ir_model_data where module in (' + module_in + ') and noupdate=%s', modules + [False]) wkf_todo = [] for (id, name, model, res_id,module) in cr.fetchall(): if (module,name) not in self.loads: self.unlink_mark[(model,res_id)] = id if model=='workflow.activity': cr.execute('select res_type,res_id from wkf_instance where id in (select inst_id from wkf_workitem where act_id=%s)', (res_id,)) wkf_todo.extend(cr.fetchall()) cr.execute("update wkf_transition set condition='True', role_id=NULL, signal=NULL,act_to=act_from,act_from=%s where act_to=%s", (res_id,res_id)) cr.execute("delete from wkf_transition where act_to=%s", (res_id,))
467,962
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,963
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') can_see = any(access_pool.check_groups(cr, user, group) for group in groups) if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,964
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,965
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,966
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,967
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,968
def default_get(self, cr, uid, fields_list, context=None): """ Returns default values for the fields in fields_list. :param fields_list: list of fields to get the default values for (example ['field1', 'field2',]) :type fields_list: list :param context: usual context dictionary - it may contains keys in the form ``default_XXX`` where XXX is a field name to set or override a default value. :return: dictionary of the default values (set on the object model class, through user preferences, or in the context) """ # trigger view init hook self.view_init(cr, uid, fields_list, context)
def default_get(self, cr, uid, fields_list, context=None): """ Returns default values for the fields in fields_list. :param fields_list: list of fields to get the default values for (example ['field1', 'field2',]) :type fields_list: list :param context: usual context dictionary - it may contains keys in the form ``default_XXX``, where XXX is a field name to set or override a default value. :return: dictionary of the default values (set on the object model class, through user preferences, or in the context) """ # trigger view init hook self.view_init(cr, uid, fields_list, context)
467,969
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,970
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,971
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,972
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,973
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,974
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,975
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,976
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
defgenerate_configurable_chart(self,cr,uid,ids,context=None):obj_acc=self.pool.get('account.account')obj_acc_tax=self.pool.get('account.tax')obj_journal=self.pool.get('account.journal')obj_sequence=self.pool.get('ir.sequence')obj_acc_template=self.pool.get('account.account.template')obj_fiscal_position_template=self.pool.get('account.fiscal.position.template')obj_fiscal_position=self.pool.get('account.fiscal.position')mod_obj=self.pool.get('ir.model.data')analytic_journal_obj=self.pool.get('account.analytic.journal')
467,977
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,978
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,979
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
defseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id generate_configurable_chart(self,seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id cr,seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id uid,seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id ids,seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id context=None):seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id obj_accseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('account.account')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id obj_acc_taxseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('account.tax')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id obj_journalseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('account.journal')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id obj_sequenceseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('ir.sequence')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id obj_acc_templateseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('account.account.template')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id obj_fiscal_position_templateseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('account.fiscal.position.template')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id obj_fiscal_positionseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('account.fiscal.position')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id mod_objseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('ir.model.data')seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id analytic_journal_objseq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id =seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id self.pool.get('account.analytic.journal')
467,980
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
467,981
def _get_partners(self, cr, uid, ids, context={}): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) ids+=ids2 return ids
def _get_partners(self, cr, uid, ids, context={}): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) ids+=ids2 return ids
467,982
def copy(self, cr, uid, id, default=None, context=None): """Overrides orm copy method @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case’s IDs @param context: A standard dictionary for contextual values """ if context is None: context = {} if default is None: default = {} default.update({'backlog_ids': [], 'meeting_ids': []}) return super(scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
def copy(self, cr, uid, id, default=None, context=None): """Overrides orm copy method @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case’s IDs @param context: A standard dictionary for contextual values """ if context is None: context = {} if default is None: default = {} default.update({'backlog_ids': [], 'meeting_ids': []}) return super(scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
467,983
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') access_pool = self.pool.get('ir.model.access') can_see = any(access_pool.check_groups(cr, user, group) for group in groups) if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') access_pool = self.pool.get('ir.model.access') can_see = any(access_pool.check_groups(cr, user, group) for group in groups) if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,984
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): raise NotImplementedError(_('The search method is not implemented on this object !'))
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for records based on a search domain. :param cr: database cursor :param user: current user id :param args: list of tuples specifying the search domain [('field_name', 'operator', value), ...]. Pass an empty list to match all records. :param offset: optional number of results to skip in the returned values (default: 0) :param limit: optional max number of records to return (default: **None**) :param order: optional columns to sort by (default: self._order=id ) :param context: optional context arguments, like lang, time zone :type context: dictionary :param count: optional (default: **False**), if **True**, returns only the number of records matching the criteria, not their ids :return: id or list of ids of records matching the criteria :rtype: integer or list of integers :raise AccessError: * if user tries to bypass access rules for read on the requested object. **Expressing a search domain (args)** Each tuple in the search domain needs to have 3 elements, in the form: **('field_name', 'operator', value)**, where: * **field_name** must be a valid name of field of the object model, possibly following many-to-one relationships using dot-notation, e.g 'street' or 'partner_id.country' are valid values. * **operator** must be a string with a valid comparison operator from this list: ``=, !=, >, >=, <, <=, like, ilike, in, not in, child_of, parent_left, parent_right`` The semantics of most of these operators are obvious. The ``child_of`` operator will look for records who are children or grand-children of a given record, according to the semantics of this model (i.e following the relationship field named by ``self._parent_name``, by default ``parent_id``. * **value** must be a valid value to compare with the values of **field_name**, depending on its type. Domain criteria can be combined using 3 logical operators than can be added between tuples: '**&**' (logical AND, default), '**|**' (logical OR), '**!**' (logical NOT). These are **prefix** operators and the arity of the '**&**' and '**|**' operator is 2, while the arity of the '**!**' is just 1. Be very careful about this when you combine them the first time. Here is an example of searching for Partners named *ABC* from Belgium and Germany whose language is not english :: [('name','=','ABC'),'!',('language.code','=','en_US'),'|',('country_id.code','=','be'),('country_id.code','=','de')) The '&' is omitted as it is the default, and of course we could have used '!=' for the language, but what this domain really represents is:: (name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany)) """ return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) def _search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None): """ Private implementation of search() method, allowing specifying the uid to use for the access right check. This is useful for example when filling in the selection list for a drop-down and avoiding access rights errors, by specifying ``access_rights_uid=1`` to bypass access rights check, but not ir.rules! :param access_rights_uid: optional user ID to use when checking access rights (not for ir.rules, this is only for ir.model.access) """ raise NotImplementedError(_('The search method is not implemented on this object !'))
467,985
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if not context: context = {}
def _search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None): if not context: context = {}
467,986
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
467,987
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
467,988
def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if args is None: args = [] if context is None: context = {} args = args[:] if name: args += [(self._rec_name, operator, name)] ids = self.search(cr, user, args, limit=limit, context=context) res = self.name_get(cr, name_get_uid or user, ids, context) return res
def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if args is None: args = [] if context is None: context = {} args = args[:] if name: args += [(self._rec_name, operator, name)] access_rights_uid = name_get_uid or user ids = self._search(cr, user, args, limit=limit, context=context, access_rights_uid=access_rights_uid) res = self.name_get(cr, access_rights_uid, ids, context) return res
467,989
def create_child(self, cr, path, data): """ API function to create a child file object and node Return the node_* created """ dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) fil_obj=dirobj.pool.get('ir.attachment') val = { 'name': path, 'datas_fname': path, 'parent_id': self.dir_id, 'res_model': self.res_model, 'res_id': self.res_id, # Datas are not set here }
def create_child(self, cr, path, data): """ API function to create a child file object and node Return the node_* created """ dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) fil_obj=dirobj.pool.get('ir.attachment') val = { 'name': path, 'datas_fname': path, 'parent_id': self.dir_id, 'res_model': self.res_model, 'res_id': self.res_id, # Datas are not set here }
467,990
def fill_inventory(self, cr, uid, ids, context): """ To fill stock inventory according to products available in the selected locations.. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') for fill_inventory in self.browse(cr, uid, ids): res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res
def fill_inventory(self, cr, uid, ids, context): """ To fill stock inventory according to products available in the selected locations.. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') for fill_inventory in self.browse(cr, uid, ids): res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res
467,991
def fill_inventory(self, cr, uid, ids, context): """ To fill stock inventory according to products available in the selected locations.. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') for fill_inventory in self.browse(cr, uid, ids): res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res
def fill_inventory(self, cr, uid, ids, context): """ To fill stock inventory according to products available in the selected locations.. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') for fill_inventory in self.browse(cr, uid, ids): res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res
467,992
def _default_category(self, cr, uid, context={}): if 'categ_id' in context and context['categ_id']: return context['categ_id'] return False
def _default_category(self, cr, uid, context={}): if 'categ_id' in context and context['categ_id']: return context['categ_id'] return False
467,993
def _get_categ(self, cursor, user, context={}): md = self.pool.get('ir.model.data') return md._get_id(cr, uid, 'product', 'cat0') or False
def _get_categ(self, cursor, user, context={}): md = self.pool.get('ir.model.data') return md._get_id(cr, uid, 'product', 'cat0') or False
467,994
def _get_categ(self, cursor, user, context={}): md = self.pool.get('ir.model.data') return md._get_id(cr, uid, 'product', 'cat0') or False
def _get_categ(self, cursor, user, context={}): md = self.pool.get('ir.model.data') return md._get_id(cr, uid, 'product', 'cat0') or False
467,995
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'order_policy': 'manual', _get_order(self,'order_policy': 'manual', cr,'order_policy': 'manual', uid,'order_policy': 'manual', ids,'order_policy': 'manual', context=None):'order_policy': 'manual', if'order_policy': 'manual', context'order_policy': 'manual', is'order_policy': 'manual', None:'order_policy': 'manual', context'order_policy': 'manual', ='order_policy': 'manual', {}'order_policy': 'manual', result'order_policy': 'manual', ='order_policy': 'manual', {}'order_policy': 'manual', for'order_policy': 'manual', line'order_policy': 'manual', in'order_policy': 'manual', self.pool.get('sale.order.line').browse(cr,'order_policy': 'manual', uid,'order_policy': 'manual', ids,'order_policy': 'manual', context=context):'order_policy': 'manual', result[line.order_id.id]'order_policy': 'manual', ='order_policy': 'manual', True'order_policy': 'manual', return'order_policy': 'manual', result.keys()
467,996
def duplicate_template(self, cr, uid, ids, context={}): project_obj = self.pool.get('project.project') data_obj = self.pool.get('ir.model.data') task_obj = self.pool.get('project.task') result = [] for proj in self.browse(cr, uid, ids, context=context): parent_id = context.get('parent_id',False) # check me where to pass context for parent id ?? new_id = project_obj.copy(cr, uid, proj.id, default = { 'name': proj.name +_(' (copy)'), 'state':'open', 'parent_id':parent_id}, context=context) result.append(new_id) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() for (tasks_id,) in res: task_obj.copy(cr, uid, tasks_id, default = { 'project_id': new_id, 'active':True}, context=context) child_ids = self.search(cr, uid, [('parent_id','=', proj.id)], context=context) if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id})
def duplicate_template(self, cr, uid, ids, context={}): project_obj = self.pool.get('project.project') data_obj = self.pool.get('ir.model.data') task_obj = self.pool.get('project.task') result = [] for proj in self.browse(cr, uid, ids, context=context): parent_id = context.get('parent_id',False) # check me where to pass context for parent id ?? new_id = project_obj.copy(cr, uid, proj.id, default = { 'name': proj.name +_(' (copy)'), 'state':'open', 'parent_id':parent_id}, context=context) result.append(new_id) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() child_ids = self.search(cr, uid, [('parent_id','=', proj.category_id.id)], context=context) parent_id = self.read(cr, uid, new_id, ['category_id'])['category_id'][0] if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id})
467,997
def duplicate_template(self, cr, uid, ids, context={}): project_obj = self.pool.get('project.project') data_obj = self.pool.get('ir.model.data') task_obj = self.pool.get('project.task') result = [] for proj in self.browse(cr, uid, ids, context=context): parent_id = context.get('parent_id',False) # check me where to pass context for parent id ?? new_id = project_obj.copy(cr, uid, proj.id, default = { 'name': proj.name +_(' (copy)'), 'state':'open', 'parent_id':parent_id}, context=context) result.append(new_id) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() for (tasks_id,) in res: task_obj.copy(cr, uid, tasks_id, default = { 'project_id': new_id, 'active':True}, context=context) child_ids = self.search(cr, uid, [('parent_id','=', proj.id)], context=context) if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id})
def duplicate_template(self, cr, uid, ids, context={}): project_obj = self.pool.get('project.project') data_obj = self.pool.get('ir.model.data') task_obj = self.pool.get('project.task') result = [] for proj in self.browse(cr, uid, ids, context=context): parent_id = context.get('parent_id',False) # check me where to pass context for parent id ?? new_id = project_obj.copy(cr, uid, proj.id, default = { 'name': proj.name +_(' (copy)'), 'state':'open', 'parent_id':parent_id}, context=context) result.append(new_id) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() for (tasks_id,) in res: task_obj.copy(cr, uid, tasks_id, default = { 'project_id': new_id, 'active':True}, context=context) child_ids = self.search(cr, uid, [('parent_id','=', proj.id)], context=context) if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id})
467,998
def setActive(self, cr, uid, ids, value=True, context={}): task_obj = self.pool.get('project.task') for proj in self.browse(cr, uid, ids, context): self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context) cr.execute('select id from project_task where project_id=%s', (proj.id,)) tasks_id = [x[0] for x in cr.fetchall()] if tasks_id: task_obj.write(cr, uid, tasks_id, {'active': value}, context=context) child_ids = self.search(cr, uid, [('parent_id','=', proj.id)]) if child_ids: self.setActive(cr, uid, child_ids, value, context) return True
def setActive(self, cr, uid, ids, value=True, context={}): task_obj = self.pool.get('project.task') for proj in self.browse(cr, uid, ids, context): self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context) cr.execute('select id from project_task where project_id=%s', (proj.id,)) tasks_id = [x[0] for x in cr.fetchall()] if tasks_id: task_obj.write(cr, uid, tasks_id, {'active': value}, context=context) child_ids = self.search(cr, uid, [('parent_id','=', proj.id)]) if child_ids: self.setActive(cr, uid, child_ids, value, context) return True
467,999