bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
f_pg_def = res[0]
|
f_pg_def = res[0]
| 469,600
|
f_pg_def = res[0]
|
f_pg_def = res[0]
| 469,601
|
f_pg_def = res[0]
|
f_pg_def = res[0]
| 469,602
|
f_pg_def = res[0]
|
f_pg_def = res[0]
| 469,603
|
f_pg_def = res[0]
|
f_pg_def = res[0]
| 469,604
|
f_pg_def = res[0]
|
f_pg_def = res[0]
| 469,605
|
f_pg_def = res[0]
|
f_pg_def = res[0]
| 469,606
|
cr.execute("SELECT conname, pg_catalog.pg_get_constraintdef(oid, true) as condef FROM pg_constraint where conname=%s", (conname,))
|
cr.execute("SELECT conname, pg_catalog.pg_get_constraintdef(oid, true) as condef FROM pg_constraint where conname=%s", (conname,))
| 469,607
|
cr.execute("SELECT conname, pg_catalog.pg_get_constraintdef(oid, true) as condef FROM pg_constraint where conname=%s", (conname,))
|
cr.execute("SELECT conname, pg_catalog.pg_get_constraintdef(oid, true) as condef FROM pg_constraint where conname=%s", (conname,))
| 469,608
|
def action_send(self, cr, uid, ids, context=None): record = self.read(cr, uid, ids, []) survey_ids = context.get('active_ids', []) record = record and record[0] partner_ids = record['partner_ids'] user_ref= self.pool.get('res.users') survey_ref= self.pool.get('survey')
|
def action_send(self, cr, uid, ids, context=None): record = self.read(cr, uid, ids, []) survey_ids = context.get('active_ids', []) record = record and record[0] partner_ids = record['partner_ids'] user_ref= self.pool.get('res.users') survey_ref= self.pool.get('survey')
| 469,609
|
def write(self, cr, uid, ids, vals, context=None): """ Update redord(s) comes in {ids}, with new value comes as {vals} return True on success, False otherwise
|
def write(self, cr, uid, ids, vals, context=None): """ Update redord(s) comes in {ids}, with new value comes as {vals} return True on success, False otherwise
| 469,610
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
| 469,611
|
def init(self, cr): tools.drop_view_if_exists(cr, 'report_products_to_received_planned') cr.execute(""" create or replace view report_products_to_received_planned as ( select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'in' where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.create_date
|
def init(self, cr): tools.drop_view_if_exists(cr, 'report_products_to_received_planned') cr.execute(""" create or replace view report_products_to_received_planned as ( select stock.create_date as date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'in' where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.create_date
| 469,612
|
def init(self, cr): tools.drop_view_if_exists(cr, 'report_products_to_received_planned') cr.execute(""" create or replace view report_products_to_received_planned as ( select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'in' where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.create_date
|
def init(self, cr): tools.drop_view_if_exists(cr, 'report_products_to_received_planned') cr.execute(""" create or replace view report_products_to_received_planned as ( select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'in' where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.create_date
| 469,613
|
def _poolJobs(self, db_name, check=False): try: db, pool = pooler.get_db_and_pool(db_name) except: return False cr = db.cursor() try: if not pool._init: now = datetime.now() cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority') for job in cr.dictfetchall(): nextcall = datetime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S') numbercall = job['numbercall']
|
def _poolJobs(self, db_name, check=False): try: db, pool = pooler.get_db_and_pool(db_name) except: return False cr = db.cursor() try: if not pool._init: now = datetime.now() cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority') for job in cr.dictfetchall(): nextcall = datetime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S') numbercall = job['numbercall']
| 469,614
|
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
|
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
| 469,615
|
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
|
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
| 469,616
|
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
|
defonchange_product_id(self,cr,uid,ids,product_id,product_uom_id,context={}):
| 469,617
|
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
|
defonchange_product_id(self,cr,uid,ids,product_id,product_uom_id,context={}):
| 469,618
|
def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') if context is None: context = {} month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1) user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year] for employee_id in ids: emp = obj_emp.read(cr, uid, [employee_id], ['name'])[0] stop, days_xml = False, [] user_repr = ''' <user> <name>%s</name> %%s </user> ''' % (toxml(emp['name'])) today, tomor = month, month + one_day while today.month == month.month: #### Work hour calculation sql = ''' select action, att.name from hr_employee as emp inner join hr_attendance as att on emp.id = att.employee_id where att.name between %s and %s and emp.id = %s order by att.name ''' cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), employee_id)) attendences = cr.dictfetchall() wh = 0 # Fake sign ins/outs at week ends, to take attendances across week ends into account if attendences and attendences[0]['action'] == 'sign_out': attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) if attendences and attendences[-1]['action'] == 'sign_in': attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) # sum up the attendances' durations for att in attendences: dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') if att['action'] == 'sign_out': wh += (dt - ldt).hours ldt = dt
|
def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') if context is None: context = {} month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1) user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year] for employee_id in ids: emp = obj_emp.read(cr, uid, [employee_id], ['name'])[0] stop, days_xml = False, [] user_repr = ''' <user> <name>%s</name> %%s </user> ''' % (toxml(emp['name'])) today, tomor = month, month + one_day while today.month == month.month: #### Work hour calculation sql = ''' select action, att.name from hr_employee as emp inner join hr_attendance as att on emp.id = att.employee_id where att.name between %s and %s and emp.id = %s order by att.name ''' cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), employee_id)) attendences = cr.dictfetchall() wh = 0 # Fake sign ins/outs at week ends, to take attendances across week ends into account if attendences and attendences[0]['action'] == 'sign_out': attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) if attendences and attendences[-1]['action'] == 'sign_in': attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) # sum up the attendances' durations for att in attendences: dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') if att['action'] == 'sign_out': wh += (dt - ldt).hours ldt = dt
| 469,619
|
def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') if context is None: context = {} month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1) user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year] for employee_id in ids: emp = obj_emp.read(cr, uid, [employee_id], ['name'])[0] stop, days_xml = False, [] user_repr = ''' <user> <name>%s</name> %%s </user> ''' % (toxml(emp['name'])) today, tomor = month, month + one_day while today.month == month.month: #### Work hour calculation sql = ''' select action, att.name from hr_employee as emp inner join hr_attendance as att on emp.id = att.employee_id where att.name between %s and %s and emp.id = %s order by att.name ''' cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), employee_id)) attendences = cr.dictfetchall() wh = 0 # Fake sign ins/outs at week ends, to take attendances across week ends into account if attendences and attendences[0]['action'] == 'sign_out': attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) if attendences and attendences[-1]['action'] == 'sign_in': attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) # sum up the attendances' durations for att in attendences: dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') if att['action'] == 'sign_out': wh += (dt - ldt).hours ldt = dt
|
def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') if context is None: context = {} month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1) user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year] for employee_id in ids: emp = obj_emp.read(cr, uid, [employee_id], ['name'])[0] stop, days_xml = False, [] user_repr = ''' <user> <name>%s</name> %%s </user> ''' % (toxml(emp['name'])) today, tomor = month, month + one_day while today.month == month.month: #### Work hour calculation sql = ''' select action, att.name from hr_employee as emp inner join hr_attendance as att on emp.id = att.employee_id where att.name between %s and %s and emp.id = %s order by att.name ''' cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), employee_id)) attendences = cr.dictfetchall() wh = 0 # Fake sign ins/outs at week ends, to take attendances across week ends into account if attendences and attendences[0]['action'] == 'sign_out': attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) if attendences and attendences[-1]['action'] == 'sign_in': attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) # sum up the attendances' durations for att in attendences: dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') if att['action'] == 'sign_out': wh += (dt - ldt).hours ldt = dt
| 469,620
|
def _format_iban(string): ''' This function removes all characters from given 'string' that isn't a alpha numeric and converts it to lower case. ''' res = "" for char in string: if char.isalnum(): res += char.lower() return res
|
def _format_iban(string): ''' This function removes all characters from given 'string' that isn't a alpha numeric and converts it to lower case. ''' res = "" for char in string: if char.isalnum(): res += char.upper() return res
| 469,621
|
def check_iban(self, cr, uid, ids): ''' Check the IBAN number ''' for bank_acc in self.browse(cr, uid, ids): if not bank_acc.iban: continue iban = _format_iban(bank_acc.iban) if iban[:2] in _iban_len and len(iban) != _iban_len[iban[:2]]: return False #the four first digits have to be shifted to the end iban = iban[4:] + iban[:4] #letters have to be transformed into numbers (a = 10, b = 11, ...) iban2 = "" for char in iban: if char.isalpha(): iban2 += str(ord(char)-87) else: iban2 += char #iban is correct if modulo 97 == 1 if not int(iban2) % 97 == 1: return False return True
|
def check_iban(self, cr, uid, ids): ''' Check the IBAN number ''' for bank_acc in self.browse(cr, uid, ids): if not bank_acc.iban: continue iban = _format_iban(bank_acc.iban).lower() if iban[:2] in _iban_len and len(iban) != _iban_len[iban[:2]]: return False #the four first digits have to be shifted to the end iban = iban[4:] + iban[:4] #letters have to be transformed into numbers (a = 10, b = 11, ...) iban2 = "" for char in iban: if char.isalpha(): iban2 += str(ord(char)-87) else: iban2 += char #iban is correct if modulo 97 == 1 if not int(iban2) % 97 == 1: return False return True
| 469,622
|
def get_partner(self, cr, uid, from_email, context=None): """This function returns partner Id based on email passed @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 from_email: email address based on that function will search for the correct """ address_pool = self.pool.get('res.partner.address') res = { 'partner_address_id': False, 'partner_id': False } from_email = self.to_email(from_email)[0] address_ids = address_pool.search(cr, uid, [('email', '=', from_email)]) if address_ids: address = address_pool.browse(cr, uid, address_ids[0]) res['partner_address_id'] = address_ids[0] res['partner_id'] = address.partner_id.id
|
def get_partner(self, cr, uid, from_email, context=None): """This function returns partner Id based on email passed @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 from_email: email address based on that function will search for the correct """ address_pool = self.pool.get('res.partner.address') res = { 'partner_address_id': False, 'partner_id': False } from_email = self.to_email(from_email)[0] address_ids = address_pool.search(cr, uid, [('email', 'like', from_email)]) if address_ids: address = address_pool.browse(cr, uid, address_ids[0]) res['partner_address_id'] = address_ids[0] res['partner_id'] = address.partner_id.id
| 469,623
|
def compute(self, cr, uid, id, value, date_ref=False, context={}): if not date_ref: date_ref = datetime.now().strftime('%Y-%m-%d') pt = self.browse(cr, uid, id, context) amount = value result = [] for line in pt.line_ids: prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') if line.value == 'fixed': amt = round(line.value_amount, prec) elif line.value == 'procent': amt = round(value * line.value_amount, prec) elif line.value == 'balance': amt = round(amount, prec) if amt: next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days)) if line.days2 < 0: nyear = next_date.strftime("%Y") nmonth = str(int(next_date.strftime("%m"))% 12+2) nday = "1"
|
def compute(self, cr, uid, id, value, date_ref=False, context={}): if not date_ref: date_ref = datetime.now().strftime('%Y-%m-%d') pt = self.browse(cr, uid, id, context) amount = value result = [] for line in pt.line_ids: prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') if line.value == 'fixed': amt = round(line.value_amount, prec) elif line.value == 'procent': amt = round(value * line.value_amount, prec) elif line.value == 'balance': amt = round(amount, prec) if amt: next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days)) if line.days2 < 0: nyear = next_date.strftime("%Y") nmonth = str(int(next_date.strftime("%m"))% 12+1) nday = "1"
| 469,624
|
def compute(self, cr, uid, id, value, date_ref=False, context={}): if not date_ref: date_ref = datetime.now().strftime('%Y-%m-%d') pt = self.browse(cr, uid, id, context) amount = value result = [] for line in pt.line_ids: prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') if line.value == 'fixed': amt = round(line.value_amount, prec) elif line.value == 'procent': amt = round(value * line.value_amount, prec) elif line.value == 'balance': amt = round(amount, prec) if amt: next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days)) if line.days2 < 0: nyear = next_date.strftime("%Y") nmonth = str(int(next_date.strftime("%m"))% 12+2) nday = "1"
|
defcompute(self,cr,uid,id,value,date_ref=False,context={}):ifnotdate_ref:date_ref=datetime.now().strftime('%Y-%m-%d')pt=self.browse(cr,uid,id,context)amount=valueresult=[]forlineinpt.line_ids:prec=self.pool.get('decimal.precision').precision_get(cr,uid,'Account')ifline.value=='fixed':amt=round(line.value_amount,prec)elifline.value=='procent':amt=round(value*line.value_amount,prec)elifline.value=='balance':amt=round(amount,prec)ifamt:next_date=(datetime.strptime(date_ref,'%Y-%m-%d')+relativedelta(days=line.days))ifline.days2<0:nyear=next_date.strftime("%Y")nmonth=str(int(next_date.strftime("%m"))%12+2)nday="1"
| 469,625
|
def _check_concurrency(self, cr, ids, context): if not context: return if not (context.get(self.CONCURRENCY_CHECK_FIELD) and self._log_access): return check_clause = "(id = %s AND %s < COALESCE(write_date, create_date, now())::timestamp)" for sub_ids in cr.split_for_in_conditions(ids): ids_to_check = [] for id in sub_ids: id_ref = "%s,%s" % (self._name, id) update_date = context[self.CONCURRENCY_CHECK_FIELD].pop(id_ref, None) if update_date: ids_to_check.extend([id, update_date]) if not ids_to_check: continue cr.execute("SELECT 1 FROM %s WHERE %s" % (self._table, " OR ".join([check_clause]*(len(ids_to_check)/2))), tuple(ids_to_check)) if cr.fetchone(): raise except_orm('ConcurrencyException', _('Records were modified in the meanwhile'))
|
def _check_concurrency(self, cr, ids, context): if not context: return if not (context.get(self.CONCURRENCY_CHECK_FIELD) and self._log_access): return check_clause = "(id = %s AND %s < COALESCE(write_date, create_date, now())::timestamp)" for sub_ids in cr.split_for_in_conditions(ids): ids_to_check = [] for id in sub_ids: id_ref = "%s,%s" % (self._name, id) update_date = context[self.CONCURRENCY_CHECK_FIELD].pop(id_ref, None) if update_date: ids_to_check.extend([id, update_date]) if not ids_to_check: continue cr.execute("SELECT 1 FROM %s WHERE %s" % (self._table, " OR ".join([check_clause]*(len(ids_to_check)/2))), tuple(ids_to_check)) if cr.fetchone(): raise except_orm('ConcurrencyException', _('Records were modified in the meanwhile'))
| 469,626
|
def get_lead_details(self, cr, uid, lead_id, context=None): body = [] lead_proxy = self.pool.get('crm.lead') lead = lead_proxy.browse(cr, uid, lead_id, context=context) if not lead.type or lead.type == 'lead': field_names = [ 'partner_name', 'title', 'function', 'street', 'street2', 'zip', 'city', 'country_id', 'state_id', 'email_from', 'phone', 'fax', 'mobile' ]
|
def get_lead_details(self, cr, uid, lead_id, context=None): body = [] lead_proxy = self.pool.get('crm.lead') lead = lead_proxy.browse(cr, uid, lead_id, context=context) if not lead.type or lead.type == 'lead': field_names = [ 'partner_name', 'title', 'function', 'street', 'street2', 'zip', 'city', 'country_id', 'state_id', 'email_from', 'phone', 'fax', 'mobile' ]
| 469,627
|
def upgrade_graph(graph, cr, module_list, force=None): if force is None: force = [] packages = [] len_graph = len(graph) for module in module_list: mod_path = get_module_path(module) terp_file = get_module_resource(module, '__openerp__.py') if not os.path.isfile(terp_file): terp_file = get_module_resource(module, '__terp__.py') if not mod_path or not terp_file: global not_loaded not_loaded.append(module) logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: not installable' % (module)) raise osv.osv.except_osv('Error!',"Module '%s' was not found" % (module,)) if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'): try: info = eval(tools.file_open(terp_file).read()) except: logger.notifyChannel('init', netsvc.LOG_ERROR, 'module %s: eval file %s' % (module, terp_file)) raise if info.get('installable', True): packages.append((module, info.get('depends', []), info)) dependencies = dict([(p, deps) for p, deps, data in packages]) current, later = set([p for p, dep, data in packages]), set() while packages and current > later: package, deps, data = packages[0] # if all dependencies of 'package' are already in the graph, add 'package' in the graph if reduce(lambda x, y: x and y in graph, deps, True): if not package in current: packages.pop(0) continue later.clear() current.remove(package) graph.addNode(package, deps) node = Node(package, graph) node.data = data for kind in ('init', 'demo', 'update'): if package in tools.config[kind] or 'all' in tools.config[kind] or kind in force: setattr(node, kind, True) else: later.add(package) packages.append((package, deps, data)) packages.pop(0) graph.update_from_db(cr) for package in later: unmet_deps = filter(lambda p: p not in graph, dependencies[package]) logger.notifyChannel('init', netsvc.LOG_ERROR, 'module %s: Unmet dependencies: %s' % (package, ', '.join(unmet_deps))) result = len(graph) - len_graph if result != len(module_list): logger.notifyChannel('init', netsvc.LOG_WARNING, 'Not all modules have loaded.') return result
|
def upgrade_graph(graph, cr, module_list, force=None): if force is None: force = [] packages = [] len_graph = len(graph) for module in module_list: mod_path = get_module_path(module) terp_file = get_module_resource(module, '__openerp__.py') if not terp_file or not os.path.isfile(terp_file): terp_file = get_module_resource(module, '__terp__.py') if not mod_path or not terp_file: global not_loaded not_loaded.append(module) logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: not installable' % (module)) raise osv.osv.except_osv('Error!',"Module '%s' was not found" % (module,)) if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'): try: info = eval(tools.file_open(terp_file).read()) except: logger.notifyChannel('init', netsvc.LOG_ERROR, 'module %s: eval file %s' % (module, terp_file)) raise if info.get('installable', True): packages.append((module, info.get('depends', []), info)) dependencies = dict([(p, deps) for p, deps, data in packages]) current, later = set([p for p, dep, data in packages]), set() while packages and current > later: package, deps, data = packages[0] # if all dependencies of 'package' are already in the graph, add 'package' in the graph if reduce(lambda x, y: x and y in graph, deps, True): if not package in current: packages.pop(0) continue later.clear() current.remove(package) graph.addNode(package, deps) node = Node(package, graph) node.data = data for kind in ('init', 'demo', 'update'): if package in tools.config[kind] or 'all' in tools.config[kind] or kind in force: setattr(node, kind, True) else: later.add(package) packages.append((package, deps, data)) packages.pop(0) graph.update_from_db(cr) for package in later: unmet_deps = filter(lambda p: p not in graph, dependencies[package]) logger.notifyChannel('init', netsvc.LOG_ERROR, 'module %s: Unmet dependencies: %s' % (package, ', '.join(unmet_deps))) result = len(graph) - len_graph if result != len(module_list): logger.notifyChannel('init', netsvc.LOG_WARNING, 'Not all modules have loaded.') return result
| 469,628
|
def _check_company(self, cr, uid, ids, context=None): return all(this.company_id in this.company_ids for this in self.browse(cr, uid, ids, context))
|
def _check_company(self, cr, uid, ids, context=None): return all(this.company_id in this.company_ids for this in self.browse(cr, uid, ids, context))
| 469,629
|
def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True
|
def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state != \'cancel\' AND sale.state != \'cancel\' AND inv.state <> \'paid\' AND rel.order_id = sale.id ' sale_clause = ', sale_order AS sale ' no_invoiced = True
| 469,630
|
def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True
|
def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True
| 469,631
|
def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True
|
def_invoiced_search(self,cursor,user,obj,name,args,context=None):ifcontextisNone:context={}ifnotlen(args):return[]clause=''no_invoiced=Falseforarginargs:ifarg[1]=='=':ifarg[2]:clause+='ANDinv.state=\'paid\''else:clause+='ANDinv.state<>\'paid\''no_invoiced=True
| 469,632
|
def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True
|
def _invoiced_search(self, cursor, user, obj, name, args, context=None): if context is None: context = {} if not len(args): return [] clause = '' no_invoiced = False for arg in args: if arg[1] == '=': if arg[2]: clause += 'AND inv.state = \'paid\'' else: clause += 'AND inv.state <> \'paid\'' no_invoiced = True
| 469,633
|
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]): cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id, id, product_id)) results = cr.dictfetchall() cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id, id, product_id)) results += cr.dictfetchall()
|
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None, lock=False): """ Attempt to find a quantity ``product_qty`` (in the product's default uom or the uom passed in ``context``) of product ``product_id`` in locations with id ``ids`` and their child locations. If ``lock`` is True, the stock.move lines of product with id ``product_id`` in the searched location will be write-locked using Postgres's "FOR UPDATE NOWAIT" option until the transaction is committed or rolled back, to prevent reservin twice the same products. If ``lock`` is True and the lock cannot be obtained (because another transaction has locked some of the same stock.move lines), a log line will be output and False will be returned, as if there was not enough stock. :param product_id: Id of product to reserve :param product_qty: Quantity of product to reserve (in the product's default uom or the uom passed in ``context``) :param lock: if True, the stock.move lines of product with id ``product_id`` in all locations (and children locations) with ``ids`` will be write-locked using postgres's "FOR UPDATE NOWAIT" option until the transaction is committed or rolled back. This is to prevent reserving twice the same products. :param context: optional context dictionary: it a 'uom' key is present it will be used instead of the default product uom to compute the ``product_qty`` and in the return value. :return: List of tuples in the form (qty, location_id) with the (partial) quantities that can be taken in each location to reach the requested product_qty (``qty`` is expressed in the default uom of the product), of False if enough products could not be found, or the lock could not be obtained (and ``lock`` was True). """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]): cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id, id, product_id)) results = cr.dictfetchall() cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id, id, product_id)) results += cr.dictfetchall()
| 469,634
|
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]): cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id, id, product_id)) results = cr.dictfetchall() cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id, id, product_id)) results += cr.dictfetchall()
|
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]): if lock: try: cr.execute("SAVEPOINT stock_location_product_reserve") cr.execute("""SELECT id FROM stock_move WHERE product_id=%s AND ( (location_dest_id=%s AND location_id<>%s AND state='done') OR (location_id=%s AND location_dest_id<>%s AND state in ('done', 'assigned')) ) FOR UPDATE of stock_move NOWAIT""", (product_id, id, id, id, id), log_exceptions=False) except Exception: cr.execute("ROLLBACK TO stock_location_product_reserve") logger = logging.getLogger('stock.location') logger.warn("Failed attempt to reserve %s x product %s, likely due to another transaction already in progress. Next attempt is likely to work. Detailed error available at DEBUG level.", product_qty, product_id) logger.debug("Trace of the failed product reservation attempt: ", exc_info=True) return False cr.execute("""SELECT product_uom, sum(product_qty) AS product_qty FROM stock_move WHERE location_dest_id=%s AND location_id<>%s AND product_id=%s AND state='done' GROUP BY product_uom """, (id, id, product_id)) results = cr.dictfetchall() cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id, id, product_id)) results += cr.dictfetchall()
| 469,635
|
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]): cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id, id, product_id)) results = cr.dictfetchall() cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id, id, product_id)) results += cr.dictfetchall()
|
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None): """ @param product_id: Id of product @param product_qty: Quantity of product @return: List of Values or False """ result = [] amount = 0.0 if context is None: context = {} for id in self.search(cr, uid, [('location_id', 'child_of', ids)]): cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id, id, product_id)) results = cr.dictfetchall() cr.execute("""SELECT product_uom,-sum(product_qty) AS product_qty FROM stock_move WHERE location_id=%s AND location_dest_id<>%s AND product_id=%s AND state in ('done', 'assigned') GROUP BY product_uom """, (id, id, product_id)) results += cr.dictfetchall()
| 469,636
|
def check_assign(self, cr, uid, ids, context=None): """ Checks the product type and accordingly writes the state. @return: No. of moves done """ done = [] count = 0 pickings = {} if context is None: context = {} for move in self.browse(cr, uid, ids, context=context): if move.product_id.type == 'consu': if move.state in ('confirmed', 'waiting'): done.append(move.id) pickings[move.picking_id.id] = 1 continue if move.state in ('confirmed', 'waiting'): res = self.pool.get('stock.location')._product_reserve(cr, uid, [move.location_id.id], move.product_id.id, move.product_qty, {'uom': move.product_uom.id}) if res: #_product_available_test depends on the next status for correct functioning #the test does not work correctly if the same product occurs multiple times #in the same order. This is e.g. the case when using the button 'split in two' of #the stock outgoing form self.write(cr, uid, [move.id], {'state':'assigned'}) done.append(move.id) pickings[move.picking_id.id] = 1 r = res.pop(0) cr.execute('update stock_move set location_id=%s, product_qty=%s where id=%s', (r[1], r[0], move.id))
|
def check_assign(self, cr, uid, ids, context=None): """ Checks the product type and accordingly writes the state. @return: No. of moves done """ done = [] count = 0 pickings = {} if context is None: context = {} for move in self.browse(cr, uid, ids, context=context): if move.product_id.type == 'consu': if move.state in ('confirmed', 'waiting'): done.append(move.id) pickings[move.picking_id.id] = 1 continue if move.state in ('confirmed', 'waiting'): res = self.pool.get('stock.location')._product_reserve(cr, uid, [move.location_id.id], move.product_id.id, move.product_qty, {'uom': move.product_uom.id}, lock=True) if res: #_product_available_test depends on the next status for correct functioning #the test does not work correctly if the same product occurs multiple times #in the same order. This is e.g. the case when using the button 'split in two' of #the stock outgoing form self.write(cr, uid, [move.id], {'state':'assigned'}) done.append(move.id) pickings[move.picking_id.id] = 1 r = res.pop(0) cr.execute('update stock_move set location_id=%s, product_qty=%s where id=%s', (r[1], r[0], move.id))
| 469,637
|
def action_apply(self, cr, uid, ids, context=None): this = self.browse(cr, uid, ids)[0] record_id = context and context.get('record_id', False) or False values={} values['name']=this.name values['user_id']=this.user_id and this.user_id.id values['categ_id']=this.category_id and this.category_id.id values['section_id']=this.section_id and this.section_id.id or False, values['description']=this.notes values['partner_id']=this.partner_id values['partner_address_id']=this.address_id.id phonecall_proxy = self.pool.get('crm.phonecall') phonecall_id = phonecall_proxy.create(cr, uid, values, context=context) value = { 'name': _('Phone Call'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'crm.phonecall', 'view_id': False, 'type': 'ir.actions.act_window', 'res_id': phonecall_id } return value
|
def action_apply(self, cr, uid, ids, context=None): this = self.browse(cr, uid, ids)[0] record_id = context and context.get('record_id', False) or False values={} values['name']=this.name values['user_id']=this.user_id and this.user_id.id values['categ_id']=this.category_id and this.category_id.id values['section_id']=this.section_id and this.section_id.id or False, values['description']=this.notes or '' values['partner_id']=this.partner_id.id values['partner_address_id']=this.address_id.id phonecall_proxy = self.pool.get('crm.phonecall') phonecall_id = phonecall_proxy.create(cr, uid, values, context=context) value = { 'name': _('Phone Call'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'crm.phonecall', 'view_id': False, 'type': 'ir.actions.act_window', 'res_id': phonecall_id } return value
| 469,638
|
def _name_get_resname(self, cr, uid, ids, *args): data = {} for resname in self.browse(cr, uid, ids,[]): model_object = resname.object_id res_id = resname.res_id if model_object and res_id: model_pool = self.pool.get(model_object.model) res = model_pool.read(cr, uid, res_id, ['name']) data[resname.id] = res['name'] else: data[resname.id] = False return data
|
def _name_get_resname(self, cr, uid, ids, *args): data = {} for resname in self.browse(cr, uid, ids,[]): model_object = resname.object_id res_id = resname.res_id if model_object and res_id: model_pool = self.pool.get(model_object.model) res = model_pool.read(cr, uid, res_id, ['name']) data[resname.id] = res['name'] else: data[resname.id] = False return data
| 469,639
|
def _do_split(self, cr, uid, data, context): move_obj = pooler.get_pool(cr.dbname).get('stock.move') pick_obj = pooler.get_pool(cr.dbname).get('stock.picking') delivery_obj = pooler.get_pool(cr.dbname).get('stock.delivery') pick = pick_obj.browse(cr, uid, [data['id']])[0] new_picking = None new_moves = [] complete, too_many, too_few = [], [], [] pool = pooler.get_pool(cr.dbname) for move in move_obj.browse(cr, uid, data['form'].get('moves',[])): if move.product_qty == data['form']['move%s' % move.id]: complete.append(move) elif move.product_qty > data['form']['move%s' % move.id]: too_few.append(move) else: too_many.append(move) # Average price computation if (pick.type == 'in') and (move.product_id.cost_method == 'average'): product_obj = pool.get('product.product') currency_obj = pool.get('res.currency') users_obj = pool.get('res.users') uom_obj = pool.get('product.uom') product = product_obj.browse(cr, uid, [move.product_id.id])[0] user = users_obj.browse(cr, uid, [uid])[0] qty = data['form']['move%s' % move.id] uom = data['form']['uom%s' % move.id] price = data['form']['price%s' % move.id] currency = data['form']['currency%s' % move.id] qty = uom_obj._compute_qty(cr, uid, uom, qty, product.uom_id.id) pricetype=pool.get('product.price.type').browse(cr,uid,user.company_id.property_valuation_price_type.id) if (qty > 0): new_price = currency_obj.compute(cr, uid, currency, user.company_id.currency_id.id, price) new_price = uom_obj._compute_price(cr, uid, uom, new_price, product.uom_id.id) if product.qty_available<=0: new_std_price = new_price else: # Get the standard price amount_unit=product.price_get(pricetype.field, context)[product.id] new_std_price = ((amount_unit * product.qty_available)\ + (new_price * qty))/(product.qty_available + qty) # Write the field according to price type field product_obj.write(cr, uid, [product.id], {pricetype.field: new_std_price}) move_obj.write(cr, uid, [move.id], {'price_unit': new_price}) for move in too_few: if not new_picking: new_picking = pick_obj.copy(cr, uid, pick.id, { 'name': pool.get('ir.sequence').get(cr, uid, 'stock.picking'), 'move_lines' : [], 'state':'draft', }) if data['form']['move%s' % move.id] != 0: new_obj = move_obj.copy(cr, uid, move.id, { 'product_qty' : data['form']['move%s' % move.id], 'product_uos_qty':data['form']['move%s' % move.id], 'picking_id' : new_picking, 'state': 'assigned', 'move_dest_id': False, 'partner_id': data['form']['partner_id%s' % pick.id], 'address_id': data['form']['address_id%s' % pick.id], 'price_unit': move.price_unit, }) delivery_id = delivery_obj.search(cr,uid, [('name','=',pick.name)]) if not delivery_id : delivery_id = delivery_obj.create(cr, uid, { 'name': pick.name, 'partner_id': data['form']['partner_id%s' % pick.id], 'date': move.date, 'product_delivered':[(6,0, [new_obj])], 'picking_id':move.picking_id.id }, context=context) if not isinstance(delivery_id, (int, long)): delivery_id=delivery_id[0] delivery_obj.write(cr, uid, [delivery_id], {'product_delivered': [(4, new_obj)]}) move_obj.write(cr, uid, [move.id], { 'product_qty' : move.product_qty - data['form']['move%s' % move.id], 'product_uos_qty':move.product_qty - data['form']['move%s' % move.id], # 'delivered_id':delivery_id }) if new_picking: move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking}) for move in too_many: move_obj.write(cr, uid, [move.id], { 'product_qty' : data['form']['move%s' % move.id], 'product_uos_qty': data['form']['move%s' % move.id], 'picking_id': new_picking, }) else: for move in too_many: move_obj.write(cr, uid, [move.id], { 'product_qty': data['form']['move%s' % move.id], 'product_uos_qty': data['form']['move%s' % move.id] }) # At first we confirm the new picking (if necessary) wf_service = netsvc.LocalService("workflow") if new_picking: wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr) # Then we finish the good picking if new_picking: pick_obj.write(cr, uid, [pick.id], {'backorder_id': new_picking}) pick_obj.action_move(cr, uid, [new_picking]) wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_done', cr) wf_service.trg_write(uid, 'stock.picking', pick.id, cr) else: pick_obj.action_move(cr, uid, [pick.id]) wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr) bo_name = '' if new_picking: bo_name = pick_obj.read(cr, uid, [new_picking], ['name'])[0]['name'] return {'new_picking':new_picking or False, 'back_order':bo_name}
|
def _do_split(self, cr, uid, data, context): move_obj = pooler.get_pool(cr.dbname).get('stock.move') pick_obj = pooler.get_pool(cr.dbname).get('stock.picking') delivery_obj = pooler.get_pool(cr.dbname).get('stock.delivery') pick = pick_obj.browse(cr, uid, [data['id']])[0] new_picking = None new_moves = [] complete, too_many, too_few = [], [], [] pool = pooler.get_pool(cr.dbname) for move in move_obj.browse(cr, uid, data['form'].get('moves',[])): if move.product_qty == data['form']['move%s' % move.id]: complete.append(move) elif move.product_qty > data['form']['move%s' % move.id]: too_few.append(move) else: too_many.append(move) # Average price computation if (pick.type == 'in') and (move.product_id.cost_method == 'average'): product_obj = pool.get('product.product') currency_obj = pool.get('res.currency') users_obj = pool.get('res.users') uom_obj = pool.get('product.uom') product = product_obj.browse(cr, uid, [move.product_id.id])[0] user = users_obj.browse(cr, uid, [uid])[0] qty = data['form']['move%s' % move.id] uom = data['form']['uom%s' % move.id] price = data['form']['price%s' % move.id] currency = data['form']['currency%s' % move.id] qty = uom_obj._compute_qty(cr, uid, uom, qty, product.uom_id.id) pricetype=pool.get('product.price.type').browse(cr,uid,user.company_id.property_valuation_price_type.id) if (qty > 0): new_price = currency_obj.compute(cr, uid, currency, user.company_id.currency_id.id, price) new_price = uom_obj._compute_price(cr, uid, uom, new_price, product.uom_id.id) if product.qty_available<=0: new_std_price = new_price else: # Get the standard price amount_unit=product.price_get(pricetype.field, context)[product.id] new_std_price = ((amount_unit * product.qty_available)\ + (new_price * qty))/(product.qty_available + qty) # Write the field according to price type field product_obj.write(cr, uid, [product.id], {pricetype.field: new_std_price}) move_obj.write(cr, uid, [move.id], {'price_unit': new_price}) for move in too_few: if not new_picking: new_picking = pick_obj.copy(cr, uid, pick.id, { 'name': pool.get('ir.sequence').get(cr, uid, 'stock.picking.in'), 'move_lines' : [], 'state':'draft', }) if data['form']['move%s' % move.id] != 0: new_obj = move_obj.copy(cr, uid, move.id, { 'product_qty' : data['form']['move%s' % move.id], 'product_uos_qty':data['form']['move%s' % move.id], 'picking_id' : new_picking, 'state': 'assigned', 'move_dest_id': False, 'partner_id': data['form']['partner_id%s' % pick.id], 'address_id': data['form']['address_id%s' % pick.id], 'price_unit': move.price_unit, }) delivery_id = delivery_obj.search(cr,uid, [('name','=',pick.name)]) if not delivery_id : delivery_id = delivery_obj.create(cr, uid, { 'name': pick.name, 'partner_id': data['form']['partner_id%s' % pick.id], 'date': move.date, 'product_delivered':[(6,0, [new_obj])], 'picking_id':move.picking_id.id }, context=context) if not isinstance(delivery_id, (int, long)): delivery_id=delivery_id[0] delivery_obj.write(cr, uid, [delivery_id], {'product_delivered': [(4, new_obj)]}) move_obj.write(cr, uid, [move.id], { 'product_qty' : move.product_qty - data['form']['move%s' % move.id], 'product_uos_qty':move.product_qty - data['form']['move%s' % move.id], # 'delivered_id':delivery_id }) if new_picking: move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking}) for move in too_many: move_obj.write(cr, uid, [move.id], { 'product_qty' : data['form']['move%s' % move.id], 'product_uos_qty': data['form']['move%s' % move.id], 'picking_id': new_picking, }) else: for move in too_many: move_obj.write(cr, uid, [move.id], { 'product_qty': data['form']['move%s' % move.id], 'product_uos_qty': data['form']['move%s' % move.id] }) # At first we confirm the new picking (if necessary) wf_service = netsvc.LocalService("workflow") if new_picking: wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr) # Then we finish the good picking if new_picking: pick_obj.write(cr, uid, [pick.id], {'backorder_id': new_picking}) pick_obj.action_move(cr, uid, [new_picking]) wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_done', cr) wf_service.trg_write(uid, 'stock.picking', pick.id, cr) else: pick_obj.action_move(cr, uid, [pick.id]) wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr) bo_name = '' if new_picking: bo_name = pick_obj.read(cr, uid, [new_picking], ['name'])[0]['name'] return {'new_picking':new_picking or False, 'back_order':bo_name}
| 469,640
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
| 469,641
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
| 469,642
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
| 469,643
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
| 469,644
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
| 469,645
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
|
def execute(self, cr, uid, ids, context=None): if context is None: context = {} super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
| 469,646
|
def _check_product_lot(self, cr, uid, ids): for move in self.browse(cr, uid, ids): if move.prodlot_id and (move.prodlot_id.product_id.id != move.product_id.id): return False return True
|
def _check_product_lot(self, cr, uid, ids): for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return True
| 469,647
|
def _module_nbr(self,cr,uid, ids, prop, unknow_none,context): cr.execute('SELECT category_id, COUNT(*) \ FROM ir_module_module \ WHERE category_id IN %(ids)s \ OR category_id IN (SELECT id \ FROM ir_module_category \ WHERE parent_id IN %(ids)s) \ GROUP BY category_id', {'ids': tuple(ids)} ) result = dict(cr.fetchall()) for id in ids: cr.execute('select id from ir_module_category where parent_id=%s', (id,)) result[id] = sum([result.get(c, 0) for (c,) in cr.fetchall()], result.get(id, 0)) return result
|
def _module_nbr(self,cr,uid, ids, prop, unknow_none, context): cr.execute('SELECT category_id, COUNT(*) \ FROM ir_module_module \ WHERE category_id IN %(ids)s \ OR category_id IN (SELECT id \ FROM ir_module_category \ WHERE parent_id IN %(ids)s) \ GROUP BY category_id', {'ids': tuple(ids)} ) result = dict(cr.fetchall()) for id in ids: cr.execute('select id from ir_module_category where parent_id=%s', (id,)) result[id] = sum([result.get(c, 0) for (c,) in cr.fetchall()], result.get(id, 0)) return result
| 469,648
|
def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context={}): res = dict.fromkeys(ids, '') for m in self.browse(cr, uid, ids): res[m.id] = self.get_module_info(m.name).get('version', '') return res
|
def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None): res = dict.fromkeys(ids, '') for m in self.browse(cr, uid, ids): res[m.id] = self.get_module_info(m.name).get('version', '') return res
| 469,649
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id['model'] if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass for key, value in res.iteritems() : for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context=None): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id['model'] if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass for key, value in res.iteritems() : for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
| 469,650
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id['model'] if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass for key, value in res.iteritems() : for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id.model if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass for key, value in res.iteritems() : for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
| 469,651
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id['model'] if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass for key, value in res.iteritems() : for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id['model'] if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass except Exception, e: self.__logger.warning('Unknown error while browsing %s[%s]', data_id.model, data_id.res_id, exc_info=True) pass for key, value in res.iteritems(): for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
| 469,652
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id['model'] if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass for key, value in res.iteritems() : for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
|
def _get_views(self, cr, uid, ids, field_name=None, arg=None, context={}): res = {} model_data_obj = self.pool.get('ir.model.data') view_obj = self.pool.get('ir.ui.view') report_obj = self.pool.get('ir.actions.report.xml') menu_obj = self.pool.get('ir.ui.menu') mlist = self.browse(cr, uid, ids, context=context) mnames = {} for m in mlist: mnames[m.name] = m.id res[m.id] = { 'menus_by_module':[], 'reports_by_module':[], 'views_by_module': [] } view_id = model_data_obj.search(cr,uid,[('module','in', mnames.keys()), ('model','in',('ir.ui.view','ir.actions.report.xml','ir.ui.menu'))]) for data_id in model_data_obj.browse(cr,uid,view_id,context): # We use try except, because views or menus may not exist try: key = data_id['model'] if key=='ir.ui.view': v = view_obj.browse(cr,uid,data_id.res_id) aa = v.inherit_id and '* INHERIT ' or '' res[mnames[data_id.module]]['views_by_module'].append(aa + v.name + '('+v.type+')') elif key=='ir.actions.report.xml': res[mnames[data_id.module]]['reports_by_module'].append(report_obj.browse(cr,uid,data_id.res_id).name) elif key=='ir.ui.menu': res[mnames[data_id.module]]['menus_by_module'].append(menu_obj.browse(cr,uid,data_id.res_id).complete_name) except KeyError, e: pass for key, value in res.iteritems() : for k, v in res[key].iteritems() : res[key][k] = "\n".join(sorted(v)) return res
| 469,653
|
def button_install(self, cr, uid, ids, context={}): return self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
|
def button_install(self, cr, uid, ids, context=None): return self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
| 469,654
|
def button_install_cancel(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state': 'uninstalled', 'demo':False}) return True
|
def button_install_cancel(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'uninstalled', 'demo':False}) return True
| 469,655
|
def button_uninstall(self, cr, uid, ids, context={}): for module in self.browse(cr, uid, ids): cr.execute('''select m.state,m.name from ir_module_module_dependency d join ir_module_module m on (d.module_id=m.id) where d.name=%s and m.state not in ('uninstalled','uninstallable','to remove')''', (module.name,)) res = cr.fetchall() if res: raise orm.except_orm(_('Error'), _('Some installed modules depend on the module you plan to Uninstall :\n %s') % '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res))) self.write(cr, uid, ids, {'state': 'to remove'}) return True
|
def button_uninstall(self, cr, uid, ids, context=None): for module in self.browse(cr, uid, ids): cr.execute('''select m.state,m.name from ir_module_module_dependency d join ir_module_module m on (d.module_id=m.id) where d.name=%s and m.state not in ('uninstalled','uninstallable','to remove')''', (module.name,)) res = cr.fetchall() if res: raise orm.except_orm(_('Error'), _('Some installed modules depend on the module you plan to Uninstall :\n %s') % '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res))) self.write(cr, uid, ids, {'state': 'to remove'}) return True
| 469,656
|
def button_uninstall_cancel(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state': 'installed'}) return True
|
def button_uninstall_cancel(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'installed'}) return True
| 469,657
|
def button_upgrade_cancel(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state': 'installed'}) return True
|
def button_upgrade_cancel(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'installed'}) return True
| 469,658
|
def _update_dependencies(self, cr, uid, id, depends=[]): for d in depends: cr.execute('INSERT INTO ir_module_module_dependency (module_id, name) values (%s, %s)', (id, d))
|
def _update_dependencies(self, cr, uid, id, depends=None): if depends is None: depends = [] for d in depends: cr.execute('INSERT INTO ir_module_module_dependency (module_id, name) values (%s, %s)', (id, d))
| 469,659
|
def _state(self, cr, uid, ids, name, args, context={}): result = {} mod_obj = self.pool.get('ir.module.module') for md in self.browse(cr, uid, ids): ids = mod_obj.search(cr, uid, [('name', '=', md.name)]) if ids: result[md.id] = mod_obj.read(cr, uid, [ids[0]], ['state'])[0]['state'] else: result[md.id] = 'unknown' return result
|
def _state(self, cr, uid, ids, name, args, context=None): result = {} mod_obj = self.pool.get('ir.module.module') for md in self.browse(cr, uid, ids): ids = mod_obj.search(cr, uid, [('name', '=', md.name)]) if ids: result[md.id] = mod_obj.read(cr, uid, [ids[0]], ['state'])[0]['state'] else: result[md.id] = 'unknown' return result
| 469,660
|
def SearchFontPath(font_file): for dirname in rl_config.TTFSearchPath: for root, dirs, files in os.walk(os.path.abspath(dirname)): for file_name in files: filename = os.path.join(root, file_name) extension = os.path.splitext(filename)[1] if extension.lower() in ['.ttf']: if file_name==font_file: return True return False
|
__foundFonts = [] def FindCustomFonts(): """Fill the __foundFonts list with those filenames, whose fonts can be found in the reportlab ttf font path. This process needs only be done once per loading of this module, it is cached. But, if the system admin adds some font in the meanwhile, the server must be restarted eventually. """ dirpath = [] global __foundFonts for dirname in rl_config.TTFSearchPath: for root, dirs, files in os.walk(os.path.abspath(dirname)): for file_name in files: filename = os.path.join(root, file_name) extension = os.path.splitext(filename)[1] if extension.lower() in ['.ttf']: if file_name==font_file: return True return False
| 469,661
|
def SearchFontPath(font_file): for dirname in rl_config.TTFSearchPath: for root, dirs, files in os.walk(os.path.abspath(dirname)): for file_name in files: filename = os.path.join(root, file_name) extension = os.path.splitext(filename)[1] if extension.lower() in ['.ttf']: if file_name==font_file: return True return False
|
def SearchFontPath(font_file): for dirname in rl_config.TTFSearchPath: abp = os.path.abspath(dirname) if os.path.isdir(abp): dirpath.append(abp) for k, (name, font, fname, mode) in enumerate(CustomTTFonts): if fname in __foundFonts: continue for d in dirpath: if os.path.exists(os.path.join(d, fname)): print "found font %s in %s" % (fname, d) __foundFonts.append(fname) break
| 469,662
|
def default_get(self, cr, uid, fields, context=None): """ Get default values @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for default value @param context: A standard dictionary @return: Default values of fields """
|
def default_get(self, cr, uid, fields, context=None): """ Get default values @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for default value @param context: A standard dictionary @return: Default values of fields """
| 469,663
|
def run(self): autho = authorizer.authorizer() ftpserver.FTPHandler.authorizer = autho ftpserver.max_cons = 300 ftpserver.max_cons_per_ip = 50 ftpserver.FTPHandler.abstracted_fs = abstracted_fs.abstracted_fs if PASSIVE_PORTS: ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS
|
def run(self): autho = authorizer.authorizer() ftpserver.FTPHandler.authorizer = autho ftpserver.max_cons = 300 ftpserver.max_cons_per_ip = 50 ftpserver.FTPHandler.abstracted_fs = abstracted_fs.abstracted_fs if PASSIVE_PORTS: ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS
| 469,664
|
def run(self): autho = authorizer.authorizer() ftpserver.FTPHandler.authorizer = autho ftpserver.max_cons = 300 ftpserver.max_cons_per_ip = 50 ftpserver.FTPHandler.abstracted_fs = abstracted_fs.abstracted_fs if PASSIVE_PORTS: ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS
|
def run(self): autho = authorizer.authorizer() ftpserver.FTPHandler.authorizer = autho ftpserver.max_cons = 300 ftpserver.max_cons_per_ip = 50 ftpserver.FTPHandler.abstracted_fs = abstracted_fs.abstracted_fs if PASSIVE_PORTS: ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS
| 469,665
|
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary of function fields value. """ register_pool = self.pool.get('event.registration') res = {} for event in self.browse(cr, uid, ids, context): res[event.id] = {} for field in fields: res[event.id][field] = False state = [] if 'register_current' in fields: state += ['open', 'done'] if 'register_prospect' in fields: state.append('draft')
|
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary of function fields value. """ register_pool = self.pool.get('event.registration') res = {} for event in self.browse(cr, uid, ids, context): res[event.id] = {} for field in fields: res[event.id][field] = False state = [] if 'register_current' in fields: state += ['open', 'done'] if 'register_prospect' in fields: state.append('draft')
| 469,666
|
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary of function fields value. """ register_pool = self.pool.get('event.registration') res = {} for event in self.browse(cr, uid, ids, context): res[event.id] = {} for field in fields: res[event.id][field] = False state = [] if 'register_current' in fields: state += ['open', 'done'] if 'register_prospect' in fields: state.append('draft')
|
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary of function fields value. """ register_pool = self.pool.get('event.registration') res = {} for event in self.browse(cr, uid, ids, context): res[event.id] = {} for field in fields: res[event.id][field] = False state = [] if 'register_current' in fields: state += ['open', 'done'] if 'register_prospect' in fields: state.append('draft')
| 469,667
|
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary of function fields value. """ register_pool = self.pool.get('event.registration') res = {} for event in self.browse(cr, uid, ids, context): res[event.id] = {} for field in fields: res[event.id][field] = False state = [] if 'register_current' in fields: state += ['open', 'done'] if 'register_prospect' in fields: state.append('draft')
|
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary of function fields value. """ register_pool = self.pool.get('event.registration') res = {} for event in self.browse(cr, uid, ids, context): res[event.id] = {} for field in fields: res[event.id][field] = False state = [] if 'register_current' in fields: state += ['open', 'done'] if 'register_prospect' in fields: state.append('draft')
| 469,668
|
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
| 469,669
|
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
| 469,670
|
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
| 469,671
|
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)
| 469,672
|
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)
| 469,673
|
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
|
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
| 469,674
|
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
|
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
| 469,675
|
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
|
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
| 469,676
|
field_def = objmodel._columns[field_name]
|
field_def = objmodel._columns[field_name]
| 469,677
|
def _build_context(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} result['fiscalyear'] = data['form']['fiscalyear_id'] and data['form']['fiscalyear_id'] or False if data['form']['filter'] == 'filter_date': result['date_from'] = data['form']['date_from'] result['date_to'] = data['form']['date_to'] elif data['form']['filter'] == 'filter_period': if data['form']['period_from'] == False or data['form']['period_to'] == False: raise osv.except_osv(_('Error'),_('Select Start period and End period')) period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])['date_start'] period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])['date_stop'] cr.execute('SELECT id FROM account_period WHERE date_start >= %s AND date_stop <= %s', (period_date_start, period_date_stop)) result['periods'] = lambda x: x[0], cr.fetchall() return result
|
def _build_context(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} result['fiscalyear'] = data['form']['fiscalyear_id'] and data['form']['fiscalyear_id'] or False if data['form']['filter'] == 'filter_date': result['date_from'] = data['form']['date_from'] result['date_to'] = data['form']['date_to'] elif data['form']['filter'] == 'filter_period': if not data['form']['period_from'] or not data['form']['period_to']: raise osv.except_osv(_('Error'),_('Select Start period and End period')) period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])['date_start'] period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])['date_stop'] cr.execute('SELECT id FROM account_period WHERE date_start >= %s AND date_stop <= %s', (period_date_start, period_date_stop)) result['periods'] = lambda x: x[0], cr.fetchall() return result
| 469,678
|
def send_mail(self, cr, uid, ids, context=None): hr_evaluation_obj = self.pool.get('hr_evaluation.evaluation') if context is None: context = {} evaluation_data = self.read(cr, uid, ids, context=context)[0] for waiting_id in hr_evaluation_obj.browse(cr, uid, evaluation_data['evaluation_id'], context=context).survey_request_ids: if waiting_id.state == "waiting_answer" and waiting_id.user_to_review_id.work_email : msg = " Hello %s, \n\n Kindly post your response for %s survey. \n\n Thanks," %(waiting_id.user_to_review_id.name, waiting_id.survey_id.title) tools.email_send(tools.config['email_from'], [waiting_id.user_to_review_id.work_email],\ 'Reminder to fill up Survey', msg) return {'type': 'ir.actions.act_window_close'}
|
def send_mail(self, cr, uid, ids, context=None): hr_evaluation_interview_obj = self.pool.get('hr.evaluation.interview') if context is None: context = {} evaluation_data = self.read(cr, uid, ids, context=context)[0] for waiting_id in hr_evaluation_obj.browse(cr, uid, evaluation_data['evaluation_id'], context=context).survey_request_ids: if waiting_id.state == "waiting_answer" and waiting_id.user_to_review_id.work_email : msg = " Hello %s, \n\n Kindly post your response for %s survey. \n\n Thanks," %(waiting_id.user_to_review_id.name, waiting_id.survey_id.title) tools.email_send(tools.config['email_from'], [waiting_id.user_to_review_id.work_email],\ 'Reminder to fill up Survey', msg) return {'type': 'ir.actions.act_window_close'}
| 469,679
|
def send_mail(self, cr, uid, ids, context=None): hr_evaluation_obj = self.pool.get('hr_evaluation.evaluation') if context is None: context = {} evaluation_data = self.read(cr, uid, ids, context=context)[0] for waiting_id in hr_evaluation_obj.browse(cr, uid, evaluation_data['evaluation_id'], context=context).survey_request_ids: if waiting_id.state == "waiting_answer" and waiting_id.user_to_review_id.work_email : msg = " Hello %s, \n\n Kindly post your response for %s survey. \n\n Thanks," %(waiting_id.user_to_review_id.name, waiting_id.survey_id.title) tools.email_send(tools.config['email_from'], [waiting_id.user_to_review_id.work_email],\ 'Reminder to fill up Survey', msg) return {'type': 'ir.actions.act_window_close'}
|
def send_mail(self, cr, uid, ids, context=None): hr_evaluation_obj = self.pool.get('hr_evaluation.evaluation') if context is None: context = {} evaluation_data = self.read(cr, uid, ids, context=context)[0] current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id')) if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email : msg = " Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks," %(current_interview.user_to_review_id.name, current_interview.survey_id.title) tools.email_send(tools.config['email_from'], [current_interview.user_to_review_id.work_email],\ 'Reminder to fill up Survey', msg) return {'type': 'ir.actions.act_window_close'}
| 469,680
|
def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): def process_sql_file(cr, fp): queries = fp.read().split(';') for query in queries: new_query = ' '.join(query.split()) if new_query: cr.execute(new_query) def load_init_update_xml(cr, m, idref, mode, kind): for filename in package.data.get('%s_xml' % kind, []): logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading %s' % (m, filename)) _, ext = os.path.splitext(filename) fp = tools.file_open(opj(m, filename)) if ext == '.csv': noupdate = (kind == 'init') tools.convert_csv_import(cr, m, os.path.basename(filename), fp.read(), idref, mode=mode, noupdate=noupdate) elif ext == '.sql': process_sql_file(cr, fp) elif ext == '.yml': tools.convert_yaml_import(cr, m, fp, idref, mode=mode, **kwargs) else: tools.convert_xml_import(cr, m, fp, idref, mode=mode, **kwargs) fp.close() def load_demo_xml(cr, m, idref, mode): for xml in package.data.get('demo_xml', []): name, ext = os.path.splitext(xml) logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading %s' % (m, xml)) fp = tools.file_open(opj(m, xml)) if ext == '.csv': tools.convert_csv_import(cr, m, os.path.basename(xml), fp.read(), idref, mode=mode, noupdate=True) elif ext == '.yml': tools.convert_yaml_import(cr, m, fp, idref, mode=mode, noupdate=True, **kwargs) else: tools.convert_xml_import(cr, m, fp, idref, mode=mode, noupdate=True, **kwargs) fp.close() def load_data(cr, module_name, id_map, mode): _load_data(cr, module_name, id_map, mode, 'data') def load_demo(cr, module_name, id_map, mode): _load_data(cr, module_name, id_map, mode, 'demo') def load_test(cr, module_name, id_map, mode): cr.commit() if not tools.config.options['test_disable']: try: _load_data(cr, module_name, id_map, mode, 'test') except Exception, e: logging.getLogger('test').exception('Tests failed to execute in %s module %s', module_name) finally: if tools.config.options['test_commit']: cr.commit() else: cr.rollback() def _load_data(cr, module_name, id_map, mode, kind): noupdate = (kind == 'demo') for filename in package.data.get(kind, []): _, ext = os.path.splitext(filename) log.info("module %s: loading %s", module_name, filename) pathname = os.path.join(module_name, filename) file = tools.file_open(pathname) # TODO manage .csv file with noupdate == (kind == 'init') if ext == '.sql': process_sql_file(cr, file) elif ext == '.csv': noupdate = (kind == 'init') tools.convert_csv_import(cr, module_name, pathname, file.read(), id_map, mode, noupdate) elif ext == '.yml': tools.convert_yaml_import(cr, module_name, file, id_map, mode, noupdate) else: tools.convert_xml_import(cr, module_name, file, id_map, mode, noupdate) file.close() # **kwargs is passed directly to convert_xml_import if not status: status = {} status = status.copy() package_todo = [] statusi = 0 pool = pooler.get_pool(cr.dbname) migrations = MigrationManager(cr, graph) has_updates = False modobj = None logger.notifyChannel('init', netsvc.LOG_DEBUG, 'loading %d packages..' % len(graph)) for package in graph: logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading objects' % package.name) migrations.migrate_module(package, 'pre') register_class(package.name) modules = pool.instanciate(package.name, cr) if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): init_module_objects(cr, package.name, modules) cr.commit() for package in graph: status['progress'] = (float(statusi)+0.1) / len(graph) m = package.name mid = package.id if modobj is None: modobj = pool.get('ir.module.module') if modobj and perform_checks: modobj.check(cr, 1, [mid]) idref = {} status['progress'] = (float(statusi)+0.4) / len(graph) mode = 'update' if hasattr(package, 'init') or package.state == 'to install': mode = 'init' if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): has_updates = True for kind in ('init', 'update'): if package.state=='to upgrade': # upgrading the module information modobj.write(cr, 1, [mid], modobj.get_values_from_terp(package.data)) load_init_update_xml(cr, m, idref, mode, kind) load_data(cr, m, idref, mode) if hasattr(package, 'demo') or (package.dbdemo and package.state != 'installed'): status['progress'] = (float(statusi)+0.75) / len(graph) load_demo_xml(cr, m, idref, mode) load_demo(cr, m, idref, mode) cr.execute('update ir_module_module set demo=%s where id=%s', (True, mid)) # launch tests only in demo mode, as most tests will depend # on demo data. Other tests can be added into the regular # 'data' section, but should probably not alter the data, # as there is no rollback. load_test(cr, m, idref, mode) package_todo.append(package.name) migrations.migrate_module(package, 'post') if modobj: ver = release.major_version + '.' + package.data.get('version', '1.0') # Set new modules and dependencies modobj.write(cr, 1, [mid], {'state': 'installed', 'latest_version': ver}) cr.commit() # Update translations for all installed languages modobj.update_translations(cr, 1, [mid], None) cr.commit() package.state = 'installed' for kind in ('init', 'demo', 'update'): if hasattr(package, kind): delattr(package, kind) statusi += 1 cr.execute('select model from ir_model where state=%s', ('manual',)) for model in cr.dictfetchall(): pool.get('ir.model').instanciate(cr, 1, model['model'], {}) pool.get('ir.model.data')._process_end(cr, 1, package_todo) cr.commit() return has_updates
|
def load_module_graph(cr, graph, status=None, perform_checks=True, skip_cleanup=False, **kwargs): """Migrates+Updates or Installs all module nodes from ``graph`` :param graph: graph of module nodes to load :param status: status dictionary for keeping track of progress :param perform_checks: whether module descriptors should be checked for validity (prints warnings for same cases, and even raise osv_except if certificate is invalid) :param skip_cleanup: whether the auto-cleanup of records should be executed (unlinks any object that appears to be from one of the updated modules, but have not been loaded during last loading (i.e. records that seem to have been removed from the module). This is best left disabled when loading stand-alone modules that could contain records from dependent modules (i.e. other modules have put records in their namespace) """ def process_sql_file(cr, fp): queries = fp.read().split(';') for query in queries: new_query = ' '.join(query.split()) if new_query: cr.execute(new_query) def load_init_update_xml(cr, m, idref, mode, kind): for filename in package.data.get('%s_xml' % kind, []): logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading %s' % (m, filename)) _, ext = os.path.splitext(filename) fp = tools.file_open(opj(m, filename)) if ext == '.csv': noupdate = (kind == 'init') tools.convert_csv_import(cr, m, os.path.basename(filename), fp.read(), idref, mode=mode, noupdate=noupdate) elif ext == '.sql': process_sql_file(cr, fp) elif ext == '.yml': tools.convert_yaml_import(cr, m, fp, idref, mode=mode, **kwargs) else: tools.convert_xml_import(cr, m, fp, idref, mode=mode, **kwargs) fp.close() def load_demo_xml(cr, m, idref, mode): for xml in package.data.get('demo_xml', []): name, ext = os.path.splitext(xml) logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading %s' % (m, xml)) fp = tools.file_open(opj(m, xml)) if ext == '.csv': tools.convert_csv_import(cr, m, os.path.basename(xml), fp.read(), idref, mode=mode, noupdate=True) elif ext == '.yml': tools.convert_yaml_import(cr, m, fp, idref, mode=mode, noupdate=True, **kwargs) else: tools.convert_xml_import(cr, m, fp, idref, mode=mode, noupdate=True, **kwargs) fp.close() def load_data(cr, module_name, id_map, mode): _load_data(cr, module_name, id_map, mode, 'data') def load_demo(cr, module_name, id_map, mode): _load_data(cr, module_name, id_map, mode, 'demo') def load_test(cr, module_name, id_map, mode): cr.commit() if not tools.config.options['test_disable']: try: _load_data(cr, module_name, id_map, mode, 'test') except Exception, e: logging.getLogger('test').exception('Tests failed to execute in %s module %s', module_name) finally: if tools.config.options['test_commit']: cr.commit() else: cr.rollback() def _load_data(cr, module_name, id_map, mode, kind): noupdate = (kind == 'demo') for filename in package.data.get(kind, []): _, ext = os.path.splitext(filename) log.info("module %s: loading %s", module_name, filename) pathname = os.path.join(module_name, filename) file = tools.file_open(pathname) # TODO manage .csv file with noupdate == (kind == 'init') if ext == '.sql': process_sql_file(cr, file) elif ext == '.csv': noupdate = (kind == 'init') tools.convert_csv_import(cr, module_name, pathname, file.read(), id_map, mode, noupdate) elif ext == '.yml': tools.convert_yaml_import(cr, module_name, file, id_map, mode, noupdate) else: tools.convert_xml_import(cr, module_name, file, id_map, mode, noupdate) file.close() # **kwargs is passed directly to convert_xml_import if not status: status = {} status = status.copy() package_todo = [] statusi = 0 pool = pooler.get_pool(cr.dbname) migrations = MigrationManager(cr, graph) has_updates = False modobj = None logger.notifyChannel('init', netsvc.LOG_DEBUG, 'loading %d packages..' % len(graph)) for package in graph: logger.notifyChannel('init', netsvc.LOG_INFO, 'module %s: loading objects' % package.name) migrations.migrate_module(package, 'pre') register_class(package.name) modules = pool.instanciate(package.name, cr) if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): init_module_objects(cr, package.name, modules) cr.commit() for package in graph: status['progress'] = (float(statusi)+0.1) / len(graph) m = package.name mid = package.id if modobj is None: modobj = pool.get('ir.module.module') if modobj and perform_checks: modobj.check(cr, 1, [mid]) idref = {} status['progress'] = (float(statusi)+0.4) / len(graph) mode = 'update' if hasattr(package, 'init') or package.state == 'to install': mode = 'init' if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): has_updates = True for kind in ('init', 'update'): if package.state=='to upgrade': # upgrading the module information modobj.write(cr, 1, [mid], modobj.get_values_from_terp(package.data)) load_init_update_xml(cr, m, idref, mode, kind) load_data(cr, m, idref, mode) if hasattr(package, 'demo') or (package.dbdemo and package.state != 'installed'): status['progress'] = (float(statusi)+0.75) / len(graph) load_demo_xml(cr, m, idref, mode) load_demo(cr, m, idref, mode) cr.execute('update ir_module_module set demo=%s where id=%s', (True, mid)) # launch tests only in demo mode, as most tests will depend # on demo data. Other tests can be added into the regular # 'data' section, but should probably not alter the data, # as there is no rollback. load_test(cr, m, idref, mode) package_todo.append(package.name) migrations.migrate_module(package, 'post') if modobj: ver = release.major_version + '.' + package.data.get('version', '1.0') # Set new modules and dependencies modobj.write(cr, 1, [mid], {'state': 'installed', 'latest_version': ver}) cr.commit() # Update translations for all installed languages modobj.update_translations(cr, 1, [mid], None) cr.commit() package.state = 'installed' for kind in ('init', 'demo', 'update'): if hasattr(package, kind): delattr(package, kind) statusi += 1 cr.execute('select model from ir_model where state=%s', ('manual',)) for model in cr.dictfetchall(): pool.get('ir.model').instanciate(cr, 1, model['model'], {}) pool.get('ir.model.data')._process_end(cr, 1, package_todo) cr.commit() return has_updates
| 469,681
|
def _load_data(cr, module_name, id_map, mode, kind): noupdate = (kind == 'demo') for filename in package.data.get(kind, []): _, ext = os.path.splitext(filename) log.info("module %s: loading %s", module_name, filename) pathname = os.path.join(module_name, filename) file = tools.file_open(pathname) # TODO manage .csv file with noupdate == (kind == 'init') if ext == '.sql': process_sql_file(cr, file) elif ext == '.csv': noupdate = (kind == 'init') tools.convert_csv_import(cr, module_name, pathname, file.read(), id_map, mode, noupdate) elif ext == '.yml': tools.convert_yaml_import(cr, module_name, file, id_map, mode, noupdate) else: tools.convert_xml_import(cr, module_name, file, id_map, mode, noupdate) file.close()
|
def _load_data(cr, module_name, id_map, mode, kind): noupdate = (kind == 'demo') for filename in package.data.get(kind, []): _, ext = os.path.splitext(filename) log.info("module %s: loading %s", module_name, filename) pathname = os.path.join(module_name, filename) file = tools.file_open(pathname) # TODO manage .csv file with noupdate == (kind == 'init') if ext == '.sql': process_sql_file(cr, file) elif ext == '.csv': noupdate = (kind == 'init') tools.convert_csv_import(cr, module_name, pathname, file.read(), id_map, mode, noupdate) elif ext == '.yml': tools.convert_yaml_import(cr, module_name, file, id_map, mode, noupdate) else: tools.convert_xml_import(cr, module_name, file, id_map, mode, noupdate) file.close()
| 469,682
|
def test_finished(self, cr, uid, ids): """ Tests whether the move is in done or cancel state or not. @return: True or False """ move_ids = self.pool.get('stock.move').search(cr, uid, [('picking_id', 'in', ids)]) for move in self.pool.get('stock.move').browse(cr, uid, move_ids): if move.state not in ('done', 'cancel'): if move.product_qty != 0.0: return False else: move.write(cr, uid, [move.id], {'state': 'done'}) return True
|
def test_finished(self, cr, uid, ids): """ Tests whether the move is in done or cancel state or not. @return: True or False """ move_ids = self.pool.get('stock.move').search(cr, uid, [('picking_id', 'in', ids)]) for move in self.pool.get('stock.move').browse(cr, uid, move_ids): if move.state not in ('done', 'cancel'): if move.product_qty != 0.0: return False else: move.write({'state': 'done'}) return True
| 469,683
|
def default_get(self, cr, uid, fields, context={}): data = super(thunderbird_installer, self).default_get(cr, uid, fields, context) pdf_file = open(config['addons_path'] + "/thunderbird/doc/Installation Guide to OpenERP Thunderbid Plug-in.pdf", 'r') data['pdf_file'] = base64.encodestring(pdf_file.read()) file = open(config['addons_path'] + "/thunderbird/plugin/OpenERP_plugin-2.0.xpi", 'r') data['plugin_file'] = base64.encodestring(file.read()) return data
|
def default_get(self, cr, uid, fields, context={}): data = super(thunderbird_installer, self).default_get(cr, uid, fields, context) pdf_file = open(config['addons_path'] + "/thunderbird/doc/Installation Guide to OpenERP Thunderbid Plug-in.pdf", 'r') data['pdf_file'] = base64.encodestring(pdf_file.read()) file = open(config['addons_path'] + "/thunderbird/plugin/OpenERP_plugin-2.0.xpi", 'r') data['plugin_file'] = base64.encodestring(file.read()) return data
| 469,684
|
def generate_random_pass(): pass_chars = RANDOM_PASS_CHARACTERS[:] random.shuffle(pass_chars) return ''.join(pass_chars[0:10])
|
def generate_random_pass(): pass_chars = RANDOM_PASS_CHARACTERS[:] random.shuffle(pass_chars) return ''.join(pass_chars[0:10])
| 469,685
|
def generate_random_pass(): pass_chars = RANDOM_PASS_CHARACTERS[:] random.shuffle(pass_chars) return ''.join(pass_chars[0:10])
|
defdef default_get(self, cr, uid, fields, context=None): """ To get default values for the object. """ res = super(share_create, self).default_get(cr, uid, fields, context=context) if not context: context={} action_id = context.get('action_id', False) domain = context.get('domain', '[]') if 'action_id' in fields: res['action_id'] = action_id if 'domain' in fields: res['domain'] = domain return res generate_random_pass():def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. """ res = super(share_create, self).default_get(cr, uid, fields, context=context) if not context: context={} action_id = context.get('action_id', False) domain = context.get('domain', '[]') if 'action_id' in fields: res['action_id'] = action_id if 'domain' in fields: res['domain'] = domain return res pass_charsdef default_get(self, cr, uid, fields, context=None): """ To get default values for the object. """ res = super(share_create, self).default_get(cr, uid, fields, context=context) if not context: context={} action_id = context.get('action_id', False) domain = context.get('domain', '[]') if 'action_id' in fields: res['action_id'] = action_id if 'domain' in fields: res['domain'] = domain return res =def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. """ res = super(share_create, self).default_get(cr, uid, fields, context=context) if not context: context={} action_id = context.get('action_id', False) domain = context.get('domain', '[]') if 'action_id' in fields: res['action_id'] = action_id if 'domain' in fields: res['domain'] = domain return res RANDOM_PASS_CHARACTERS[:]def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. """ res = super(share_create, self).default_get(cr, uid, fields, context=context) if not context: context={} action_id = context.get('action_id', False) domain = context.get('domain', '[]') if 'action_id' in fields: res['action_id'] = action_id if 'domain' in fields: res['domain'] = domain return res random.shuffle(pass_chars)def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. """ res = super(share_create, self).default_get(cr, uid, fields, context=context) if not context: context={} action_id = context.get('action_id', False) domain = context.get('domain', '[]') if 'action_id' in fields: res['action_id'] = action_id if 'domain' in fields: res['domain'] = domain return res returndef default_get(self, cr, uid, fields, context=None): """ To get default values for the object. """ res = super(share_create, self).default_get(cr, uid, fields, context=context) if not context: context={} action_id = context.get('action_id', False) domain = context.get('domain', '[]') if 'action_id' in fields: res['action_id'] = action_id if 'domain' in fields: res['domain'] = domain return res ''.join(pass_chars[0:10])
| 469,686
|
def _build_contexts(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} period_obj = self.pool.get('account.period') fiscal_obj = self.pool.get('account.fiscalyear') result['fiscalyear'] = 'fiscalyear_id' in data['form'] and data['form']['fiscalyear_id'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['chart_account_id'] = 'chart_account_id' in data['form'] and data['form']['chart_account_id'] or False result_initial_bal = result.copy() if data['form']['filter'] == 'filter_date': result['date_from'] = data['form']['date_from'] result['date_to'] = data['form']['date_to'] result_initial_bal['date_from'] = '0001-01-01' result_initial_bal['date_to'] = (datetime.datetime.strptime(data['form']['date_from'], "%Y-%m-%d") + timedelta(days=-1)).strftime('%Y-%m-%d') elif data['form']['filter'] == 'filter_period': if not data['form']['period_from'] or not data['form']['period_to']: raise osv.except_osv(_('Error'),_('Select a starting and an ending period')) result['periods'] = self._build_periods(cr, uid, data['form']['period_from'], data['form']['period_to']) first_period = self.pool.get('account.period').search(cr, uid, [], order='date_start', limit=1)[0] result_initial_bal['periods'] = self._build_periods(cr, uid, first_period, data['form']['period_from']) else: fiscal_date_start = fiscal_obj.browse(cr, uid, [data['form']['fiscalyear_id']], context=context)[0].date_start result_initial_bal['empty_fy_allow'] = True #Improve me => there should be something generic in account.move.line -> query get result_initial_bal['fiscalyear'] = fiscal_obj.search(cr, uid, [('date_stop', '<', fiscal_date_start), ('state', '=', 'draft')], context=context) result_initial_bal['date_from'] = '0001-01-01' result_initial_bal['date_to'] = (datetime.datetime.strptime(fiscal_date_start, "%Y-%m-%d") + timedelta(days=-1)).strftime('%Y-%m-%d') return result, result_initial_bal
|
def _build_contexts(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} period_obj = self.pool.get('account.period') fiscal_obj = self.pool.get('account.fiscalyear') result['fiscalyear'] = 'fiscalyear_id' in data['form'] and data['form']['fiscalyear_id'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['chart_account_id'] = 'chart_account_id' in data['form'] and data['form']['chart_account_id'] or False result_initial_bal = result.copy() if data['form']['filter'] == 'filter_date': result['date_from'] = data['form']['date_from'] result['date_to'] = data['form']['date_to'] result_initial_bal['date_from'] = '0001-01-01' result_initial_bal['date_to'] = (datetime.datetime.strptime(data['form']['date_from'], "%Y-%m-%d") + timedelta(days=-1)).strftime('%Y-%m-%d') elif data['form']['filter'] == 'filter_period': if not data['form']['period_from'] or not data['form']['period_to']: raise osv.except_osv(_('Error'),_('Select a starting and an ending period')) result['periods'] = self._build_periods(cr, uid, data['form']['period_from'], data['form']['period_to']) first_period = self.pool.get('account.period').search(cr, uid, [], order='date_start', limit=1)[0] result_initial_bal['periods'] = self._build_periods(cr, uid, first_period, data['form']['period_from']) else: fiscal_date_start = fiscal_obj.browse(cr, uid, [data['form']['fiscalyear_id']], context=context)[0].date_start result_initial_bal['empty_fy_allow'] = True #Improve me => there should be something generic in account.move.line -> query get result_initial_bal['fiscalyear'] = fiscal_obj.search(cr, uid, [('date_stop', '<', fiscal_date_start), ('state', '=', 'draft')], context=context) result_initial_bal['date_from'] = '0001-01-01' result_initial_bal['date_to'] = (datetime.datetime.strptime(fiscal_date_start, "%Y-%m-%d") + timedelta(days=-1)).strftime('%Y-%m-%d') return result, result_initial_bal
| 469,687
|
def do_accept(self, cr, uid, ids, context=None, *args): """ Update state which value is accepted. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar attendee’s IDs. @return: True """ if not context: context = {} for vals in self.read(cr, uid, ids, context=context): user = vals.get('user_id') if user: ref = vals.get('ref', None) if ref: if ref.user_id.id != user[0]: defaults = {'user_id': user[0]} new_event = model_obj.copy(cr, uid, event, default=defaults, context=context) self.write(cr, uid, ids, {'state': 'accepted'}, context) return True
|
def do_accept(self, cr, uid, ids, context=None, *args): """ Update state which value is accepted. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar attendee’s IDs. @return: True """ if not context: context = {} for vals in self.browse(cr, uid, ids, context=context): user = vals.user_id if user: ref = vals.get('ref', None) if ref: if ref.user_id.id != user[0]: defaults = {'user_id': user[0]} new_event = model_obj.copy(cr, uid, event, default=defaults, context=context) self.write(cr, uid, ids, {'state': 'accepted'}, context) return True
| 469,688
|
def do_accept(self, cr, uid, ids, context=None, *args): """ Update state which value is accepted. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar attendee’s IDs. @return: True """ if not context: context = {} for vals in self.read(cr, uid, ids, context=context): user = vals.get('user_id') if user: ref = vals.get('ref', None) if ref: if ref.user_id.id != user[0]: defaults = {'user_id': user[0]} new_event = model_obj.copy(cr, uid, event, default=defaults, context=context) self.write(cr, uid, ids, {'state': 'accepted'}, context) return True
|
def do_accept(self, cr, uid, ids, context=None, *args): """ Update state which value is accepted. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar attendee’s IDs. @return: True """ if not context: context = {} for vals in self.read(cr, uid, ids, context=context): user = vals.get('user_id') if user: mod_obj = self.pool.get(vals.ref._name) if vals.ref: if vals.ref.user_id.id != user.id: defaults = {'user_id': user.id} new_event = mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) self.write(cr, uid, vals.id, {'state': 'accepted'}, context) return True
| 469,689
|
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
|
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
| 469,690
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
| 469,691
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
|
defset_context(self,objects,data,ids,report_type=None):PARTNER_REQUEST=''if(data['model']=='res.partner'):##Sionimprimedepuislespartenairesifids:#PARTNER_REQUEST="ANDline.partner_idIN("+','.join(map(str,ids))+")"PARTNER_REQUEST="ANDline.partner_idIN%s",(tuple(ids),)#Transformationdesdate##
| 469,692
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
| 469,693
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
| 469,694
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST =else: "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST =else: "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
| 469,695
|
def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires if ids: #PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")" PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),) # Transformation des date # #
|
defset_context(self,objects,data,ids,report_type=None):PARTNER_REQUEST=''if(data['model']=='res.partner'):##Sionimprimedepuislespartenairesifids:#PARTNER_REQUEST="ANDline.partner_idIN("+','.join(map(str,ids))+")"PARTNER_REQUEST="ANDline.partner_idIN%s",(tuple(ids),)#Transformationdesdate##
| 469,696
|
def lines(self, partner,data): full_account = [] if data['form']['reconcil'] : RECONCILE_TAG = " " else: RECONCILE_TAG = "AND l.reconcile_id IS NULL"
|
deflines(self,partner,data):full_account=[]ifdata['form']['reconcil']:RECONCILE_TAG=""else:RECONCILE_TAG="ANDl.reconcile_idISNULL"
| 469,697
|
def lines(self, partner,data): full_account = [] if data['form']['reconcil'] : RECONCILE_TAG = " " else: RECONCILE_TAG = "AND l.reconcile_id IS NULL"
|
def lines(self, partner,data): full_account = [] if data['form']['reconcil'] : RECONCILE_TAG = " " else: RECONCILE_TAG = "AND l.reconcile_id IS NULL"
| 469,698
|
def _sum_debit_partner(self, partner, data): result_tmp = 0.0 if data['form']['reconcil'] : RECONCILE_TAG = " " else: RECONCILE_TAG = "AND reconcile_id IS NULL" if self.date_lst and data['form']['initial_balance'] : self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line " \ "WHERE partner_id = %s " \ "AND account_id IN %s" \ "AND reconcile_id IS NULL " \ "AND date < %s " , (partner.id, tuple(self.account_ids), self.date_lst[0],)) contemp = self.cr.fetchone() if contemp != None: result_tmp = contemp[0] or 0.0 else: result_tmp = result_tmp + 0.0
|
def _sum_debit_partner(self, partner, data): result_tmp = 0.0 if data['form']['reconcil'] : RECONCILE_TAG = " " else: RECONCILE_TAG = "AND reconcile_id IS NULL" if self.date_lst and data['form']['initial_balance'] : self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line " \ "WHERE partner_id = %s " \ "AND account_id IN %s" \ "AND reconcile_id IS NULL " \ "AND date < %s " , (partner.id, tuple(self.account_ids), self.date_lst[0],)) contemp = self.cr.fetchone() if contemp != None: result_tmp = contemp[0] or 0.0 else: result_tmp = result_tmp + 0.0
| 469,699
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.