bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def _sum_credit_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(credit) " \ "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_credit_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(credit) " \ "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,700
|
def _sum_debit(self, data): if not self.ids: return 0.0 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 IN %s" \ "AND account_id IN %s" \ "AND reconcile_id IS NULL " \ "AND date < %s " , (tuple(self.partner_ids), 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(self, data): if not self.ids: return 0.0 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 IN %s" \ "AND account_id IN %s" \ "AND reconcile_id IS NULL " \ "AND date < %s " , (tuple(self.partner_ids), 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,701
|
def _sum_credit(self, data): if not self.ids: return 0.0 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(credit) " \ "FROM account_move_line " \ "WHERE partner_id IN %s" \ "AND account_id IN %s" \ "AND reconcile_id IS NULL " \ "AND date < %s " , (tuple(self.partner_ids), 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_credit(self, data): if not self.ids: return 0.0 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(credit) " \ "FROM account_move_line " \ "WHERE partner_id IN %s" \ "AND account_id IN %s" \ "AND reconcile_id IS NULL " \ "AND date < %s " , (tuple(self.partner_ids), 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,702
|
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
|
def _get_partners(self, data): if data['form']['result_selection'] == 'customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
| 469,703
|
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
|
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection'] == 'supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
| 469,704
|
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
|
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection'] == 'customer_supplier': return 'Receivable and Payable Accounts' return ''
| 469,705
|
def _field_create(self, cr, context={}): cr.execute("SELECT id FROM ir_model WHERE model=%s", (self._name,)) if not cr.rowcount: cr.execute('SELECT nextval(%s)', ('ir_model_id_seq',)) model_id = cr.fetchone()[0] cr.execute("INSERT INTO ir_model (id,model, name, info,state) VALUES (%s, %s, %s, %s, %s)", (model_id, self._name, self._description, self.__doc__, 'base')) else: model_id = cr.fetchone()[0] if 'module' in context: name_id = 'model_'+self._name.replace('.', '_') cr.execute('select * from ir_model_data where name=%s and res_id=%s and module=%s', (name_id, model_id, context['module'])) if not cr.rowcount: cr.execute("INSERT INTO ir_model_data (name,date_init,date_update,module,model,res_id) VALUES (%s, now(), now(), %s, %s, %s)", \ (name_id, context['module'], 'ir.model', model_id) )
|
def _field_create(self, cr, context={}): cr.execute("SELECT id FROM ir_model WHERE model=%s", (self._name,)) if not cr.rowcount: cr.execute('SELECT nextval(%s)', ('ir_model_id_seq',)) model_id = cr.fetchone()[0] cr.execute("INSERT INTO ir_model (id,model, name, info,state) VALUES (%s, %s, %s, %s, %s)", (model_id, self._name, self._description, self.__doc__, 'base')) elif k in cols: model_id = cr.fetchone()[0] if 'module' in context: name_id = 'model_'+self._name.replace('.', '_') cr.execute('select * from ir_model_data where name=%s and res_id=%s and module=%s', (name_id, model_id, context['module'])) if not cr.rowcount: cr.execute("INSERT INTO ir_model_data (name,date_init,date_update,module,model,res_id) VALUES (%s, now(), now(), %s, %s, %s)", \ (name_id, context['module'], 'ir.model', model_id) )
| 469,706
|
def init(self, cr): cr.execute(""" create or replace view report_timesheet_task_user as ( select ((r.id*12)+to_number(months.m_id,'99'))::integer as id, months.name as name, r.id as user_id, to_char(to_date(months.name, 'YYYY/MM/DD'),'YYYY') as year, to_char(to_date(months.name, 'YYYY/MM/DD'),'MM') as month from res_users r, (select to_char(p.date,'YYYY-MM-01') as name, to_char(p.date,'MM') as m_id from project_task_work p
|
def init(self, cr): tools.drop_view_if_exists(cr, 'report_timesheet_task_user') cr.execute(""" create or replace view report_timesheet_task_user as ( select ((r.id*12)+to_number(months.m_id,'99'))::integer as id, months.name as name, r.id as user_id, to_char(to_date(months.name, 'YYYY/MM/DD'),'YYYY') as year, to_char(to_date(months.name, 'YYYY/MM/DD'),'MM') as month from res_users r, (select to_char(p.date,'YYYY-MM-01') as name, to_char(p.date,'MM') as m_id from project_task_work p
| 469,707
|
def do_print(self, cr, uid, ids, context=None): if context is None: context = {} data = self.read(cr, uid, ids, [])[0] res = self._get_partners_followp(cr, uid, ids, context)['to_update'] to_update = res data['followup_id'] = 'followup_id' in context and context['followup_id'] or False date = 'date' in context and context['date'] or data['date'] for id in to_update.keys(): if to_update[id]['partner_id'] in data['partner_ids']: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], date, int(id),))
|
defdata.update({'date': context['date']}) do_print(self,data.update({'date': context['date']}) cr,data.update({'date': context['date']}) uid,data.update({'date': context['date']}) ids,data.update({'date': context['date']}) context=None):data.update({'date': context['date']}) ifdata.update({'date': context['date']}) contextdata.update({'date': context['date']}) isdata.update({'date': context['date']}) None:data.update({'date': context['date']}) contextdata.update({'date': context['date']}) =data.update({'date': context['date']}) {}data.update({'date': context['date']}) datadata.update({'date': context['date']}) =data.update({'date': context['date']}) self.read(cr,data.update({'date': context['date']}) uid,data.update({'date': context['date']}) ids,data.update({'date': context['date']}) [])[0]data.update({'date': context['date']}) resdata.update({'date': context['date']}) =data.update({'date': context['date']}) self._get_partners_followp(cr,data.update({'date': context['date']}) uid,data.update({'date': context['date']}) ids,data.update({'date': context['date']}) context)['to_update']data.update({'date': context['date']}) to_updatedata.update({'date': context['date']}) =data.update({'date': context['date']}) resdata.update({'date': context['date']}) data['followup_id']data.update({'date': context['date']}) =data.update({'date': context['date']}) 'followup_id'data.update({'date': context['date']}) indata.update({'date': context['date']}) contextdata.update({'date': context['date']}) anddata.update({'date': context['date']}) context['followup_id']data.update({'date': context['date']}) ordata.update({'date': context['date']}) Falsedata.update({'date': context['date']}) datedata.update({'date': context['date']}) =data.update({'date': context['date']}) 'date'data.update({'date': context['date']}) indata.update({'date': context['date']}) contextdata.update({'date': context['date']}) anddata.update({'date': context['date']}) context['date']data.update({'date': context['date']}) ordata.update({'date': context['date']}) data['date']data.update({'date': context['date']}) fordata.update({'date': context['date']}) iddata.update({'date': context['date']}) indata.update({'date': context['date']}) to_update.keys():data.update({'date': context['date']}) ifdata.update({'date': context['date']}) to_update[id]['partner_id']data.update({'date': context['date']}) indata.update({'date': context['date']}) data['partner_ids']:data.update({'date': context['date']}) cr.execute(data.update({'date': context['date']}) "UPDATEdata.update({'date': context['date']}) account_move_linedata.update({'date': context['date']}) "\data.update({'date': context['date']}) "SETdata.update({'date': context['date']}) followup_line_id=%s,data.update({'date': context['date']}) followup_date=%sdata.update({'date': context['date']}) "\data.update({'date': context['date']}) "WHEREdata.update({'date': context['date']}) id=%s",data.update({'date': context['date']}) (to_update[id]['level'],data.update({'date': context['date']}) date,data.update({'date': context['date']}) int(id),))
| 469,708
|
def do_print(self, cr, uid, ids, context=None): if context is None: context = {} data = self.read(cr, uid, ids, [])[0] res = self._get_partners_followp(cr, uid, ids, context)['to_update'] to_update = res data['followup_id'] = 'followup_id' in context and context['followup_id'] or False date = 'date' in context and context['date'] or data['date'] for id in to_update.keys(): if to_update[id]['partner_id'] in data['partner_ids']: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], date, int(id),))
|
defdo_print(self,cr,uid,ids,context=None):ifcontextisNone:context={}data=self.read(cr,uid,ids,[])[0]res=self._get_partners_followp(cr,uid,ids,context)['to_update']to_update=resdata['followup_id']='followup_id'incontextandcontext['followup_id']orFalsedate='date'incontextandcontext['date']ordata['date']foridinto_update.keys():ifto_update[id]['partner_id']indata['partner_ids']:cr.execute("UPDATEaccount_move_line"\"SETfollowup_line_id=%s,followup_date=%s"\"WHEREid=%s",(to_update[id]['level'],date,int(id),))
| 469,709
|
def _get_project(self, cr, uid, context): user = self.pool.get('res.users').browse(cr,uid,uid, context=context) if user.context_project_id: return user.context_project_id return False
|
def _get_project(self, cr, uid, context): user = self.pool.get('res.users').browse(cr,uid,uid, context=context) if user.context_project_id: return user.context_project_id.id return False
| 469,710
|
def _tag_act_window(self, cr, rec, data_node=None): name = rec.get('name','').encode('utf-8') xml_id = rec.get('id','').encode('utf8') self._test_xml_id(xml_id) type = rec.get('type','').encode('utf-8') or 'ir.actions.act_window' view_id = False if rec.get('view'): view_id = self.id_get(cr, 'ir.actions.act_window', rec.get('view','').encode('utf-8')) domain = rec.get('domain','').encode('utf-8') or '{}' context = rec.get('context','').encode('utf-8') or '{}' res_model = rec.get('res_model','').encode('utf-8') src_model = rec.get('src_model','').encode('utf-8') view_type = rec.get('view_type','').encode('utf-8') or 'form' view_mode = rec.get('view_mode','').encode('utf-8') or 'tree,form' usage = rec.get('usage','').encode('utf-8') limit = rec.get('limit','').encode('utf-8') auto_refresh = rec.get('auto_refresh','').encode('utf-8')
|
defuid = self.uid _tag_act_window(self,uid = self.uid cr,uid = self.uid rec,uid = self.uid data_node=None):uid = self.uid nameuid = self.uid =uid = self.uid rec.get('name','').encode('utf-8')uid = self.uid xml_iduid = self.uid =uid = self.uid rec.get('id','').encode('utf8')uid = self.uid self._test_xml_id(xml_id)uid = self.uid typeuid = self.uid =uid = self.uid rec.get('type','').encode('utf-8')uid = self.uid oruid = self.uid 'ir.actions.act_window'uid = self.uid view_iduid = self.uid =uid = self.uid Falseuid = self.uid ifuid = self.uid rec.get('view'):uid = self.uid view_iduid = self.uid =uid = self.uid self.id_get(cr,uid = self.uid 'ir.actions.act_window',uid = self.uid rec.get('view','').encode('utf-8'))uid = self.uid domainuid = self.uid =uid = self.uid rec.get('domain','').encode('utf-8')uid = self.uid oruid = self.uid '{}'uid = self.uid contextuid = self.uid =uid = self.uid rec.get('context','').encode('utf-8')uid = self.uid oruid = self.uid '{}'uid = self.uid res_modeluid = self.uid =uid = self.uid rec.get('res_model','').encode('utf-8')uid = self.uid src_modeluid = self.uid =uid = self.uid rec.get('src_model','').encode('utf-8')uid = self.uid view_typeuid = self.uid =uid = self.uid rec.get('view_type','').encode('utf-8')uid = self.uid oruid = self.uid 'form'uid = self.uid view_modeuid = self.uid =uid = self.uid rec.get('view_mode','').encode('utf-8')uid = self.uid oruid = self.uid 'tree,form'uid = self.uid uid = self.uid usageuid = self.uid =uid = self.uid rec.get('usage','').encode('utf-8')uid = self.uid limituid = self.uid =uid = self.uid rec.get('limit','').encode('utf-8')uid = self.uid auto_refreshuid = self.uid =uid = self.uid rec.get('auto_refresh','').encode('utf-8')
| 469,711
|
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context={}): domain = [] if product_id: domain += ['|',('product_id','=',product_id)] domain += [('product_id','=',False)] if partner_id: domain += ['|',('partner_id','=',partner_id)] domain += [('partner_id','=',False)] if user_id: domain += ['|',('user_id','=',uid)] domain += [('user_id','=',False)] if date: domain += ['|',('date_start','<=',date),('date_start','=',False)] domain += ['|',('date_stop','>=',date),('date_stop','=',False)] best_index = -1 res = False for rec in self.browse(cr, uid, self.search(cr, uid, domain, context=context), context=context): index = 0 if rec.product_id: index+=1 if rec.partner_id: index+=1 if rec.user_id: index+=1 if rec.date_start: index+=1 if rec.date_stop: index+=1 if index>best_index: res = rec best_index = index return res
|
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context={}): domain = [] if product_id: domain += ['|',('product_id','=',product_id)] domain += [('product_id','=',False)] if partner_id: domain += ['|',('partner_id','=',partner_id)] domain += [('partner_id','=',False)] if user_id: domain += ['|',('user_id','=',uid)] domain += [('user_id','=',False)] if date: domain += ['|',('date_start','<=',date),('date_start','=',False)] domain += ['|',('date_stop','>=',date),('date_stop','=',False)] best_index = -1 res = False for rec in self.browse(cr, uid, self.search(cr, uid, domain, context=context), context=context): index = 0 if rec.product_id: index+=1 if rec.partner_id: index+=1 if rec.user_id: index+=1 if rec.date_start: index+=1 if rec.date_stop: index+=1 if index>best_index: res = rec best_index = index return res
| 469,712
|
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, context={}): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, context) rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context) if rec: res_prod['value'].update({'account_analytic_id':rec.analytic_id.id}) else: res_prod['value'].update({'account_analytic_id':False}) return res_prod
|
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, context={}): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, context) rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context) if rec: res_prod['value'].update({'account_analytic_id':rec.analytic_id.id}) else: res_prod['value'].update({'account_analytic_id':False}) return res_prod
| 469,713
|
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, context={}): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, context) rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context) if rec: res_prod['value'].update({'account_analytic_id':rec.analytic_id.id}) else: res_prod['value'].update({'account_analytic_id':False}) return res_prod
|
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, context={}): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, context) rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context) if rec: res_prod['value'].update({'account_analytic_id':rec.analytic_id.id}) else: res_prod['value'].update({'account_analytic_id':False}) return res_prod
| 469,714
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
| 469,715
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
| 469,716
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
| 469,717
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
|
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.address_id and picking.address_id.partner_id or False rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id and partner_id.id, user, time.strftime('%Y-%m-%d'), context={}) if rec: return rec.analytic_id.id return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)
| 469,718
|
def invoice_line_create(self, cr, uid, ids, context={}): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) sale_line_obj = self.browse(cr, uid, ids[0], context) pool_inv_line = self.pool.get('account.invoice.line') for line in pool_inv_line.browse(cr, uid, create_ids, context): rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context) if rec: pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context) return create_ids
|
def invoice_line_create(self, cr, uid, ids, context={}): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) sale_line_obj = self.browse(cr, uid, ids[0], context) pool_inv_line = self.pool.get('account.invoice.line') for line in pool_inv_line.browse(cr, uid, create_ids, context): rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context) if rec: pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context) return create_ids
| 469,719
|
def invoice_line_create(self, cr, uid, ids, context={}): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) sale_line_obj = self.browse(cr, uid, ids[0], context) pool_inv_line = self.pool.get('account.invoice.line') for line in pool_inv_line.browse(cr, uid, create_ids, context): rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context) if rec: pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context) return create_ids
|
def invoice_line_create(self, cr, uid, ids, context={}): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) sale_line_obj = self.browse(cr, uid, ids[0], context) pool_inv_line = self.pool.get('account.invoice.line') for line in pool_inv_line.browse(cr, uid, create_ids, context): rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context) if rec: pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context) return create_ids
| 469,720
|
def invoice_line_create(self, cr, uid, ids, context={}): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) sale_line_obj = self.browse(cr, uid, ids[0], context) pool_inv_line = self.pool.get('account.invoice.line') for line in pool_inv_line.browse(cr, uid, create_ids, context): rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context) if rec: pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context) return create_ids
|
def invoice_line_create(self, cr, uid, ids, context={}): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) sale_line_obj = self.browse(cr, uid, ids[0], context) pool_inv_line = self.pool.get('account.invoice.line') for line in pool_inv_line.browse(cr, uid, create_ids, context): rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context) if rec: pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context) return create_ids
| 469,721
|
def _set_rrulestring(self, cr, uid, id, name, value, arg, context=None): """ Sets values of fields that defines event recurrence from the value of rrule string @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @param context: A standard dictionary for contextual values @return: dictionary of rrule value. """ if not context: context = {} cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\ mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\ day=0,select1='date',month_list=Null ,byday=Null where id=%%s" % (self._table), (id,))
|
def _set_rrulestring(self, cr, uid, id, name, value, arg, context=None): """ Sets values of fields that defines event recurrence from the value of rrule string @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @param context: A standard dictionary for contextual values @return: dictionary of rrule value. """ if not context: context = {} cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\ mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\ day=0,select1='date',month_list=Null ,byday=Null where id=%%s" % (self._table), (id,))
| 469,722
|
def _get_chart_account(cursor, user, account): if account.parent_id: chart_account = _get_chart_account(cursor, user, account.parent_id) else: chart_account = account return chart_account
|
def _get_chart_account(cursor, user, account): if account.parent_id: chart_account = _get_chart_account(cursor, user, account.parent_id) else: chart_account = account return chart_account
| 469,723
|
def _check_tracking(self, cr, uid, ids): """ Checks if production lot is assigned to stock move or not. @return: True or False """ for move in self.browse(cr, uid, ids): if move.picking_id and move.picking_id.type=="internal": return True if not move.prodlot_id and \ (move.state == 'done' and \ ( \ (move.product_id.track_production and move.location_id.usage=='production') or \ (move.product_id.track_production and move.location_dest_id.usage=='production') or \ (move.product_id.track_incoming and move.location_id.usage in ('supplier','internal')) or \ (move.product_id.track_outgoing and move.location_dest_id.usage in ('customer','internal')) \ )): return False return True
|
def _check_tracking(self, cr, uid, ids): """ Checks if production lot is assigned to stock move or not. @return: True or False """ for move in self.browse(cr, uid, ids): if not move.prodlot_id and \ (move.state == 'done' and \ ( \ (move.product_id.track_production and move.location_id.usage=='production') or \ (move.product_id.track_production and move.location_dest_id.usage=='production') or \ (move.product_id.track_incoming and move.location_id.usage in ('supplier','internal')) or \ (move.product_id.track_outgoing and move.location_dest_id.usage in ('customer','internal')) \ )): return False return True
| 469,724
|
def _check_tracking(self, cr, uid, ids): """ Checks if production lot is assigned to stock move or not. @return: True or False """ for move in self.browse(cr, uid, ids): if move.picking_id and move.picking_id.type=="internal": return True if not move.prodlot_id and \ (move.state == 'done' and \ ( \ (move.product_id.track_production and move.location_id.usage=='production') or \ (move.product_id.track_production and move.location_dest_id.usage=='production') or \ (move.product_id.track_incoming and move.location_id.usage in ('supplier','internal')) or \ (move.product_id.track_outgoing and move.location_dest_id.usage in ('customer','internal')) \ )): return False return True
|
def _check_tracking(self, cr, uid, ids): """ Checks if production lot is assigned to stock move or not. @return: True or False """ for move in self.browse(cr, uid, ids): if move.picking_id and move.picking_id.type=="internal": return True if not move.prodlot_id and \ (move.state == 'done' and \ ( \ (move.product_id.track_production and move.location_id.usage == 'production') or \ (move.product_id.track_production and move.location_dest_id.usage == 'production') or \ (move.product_id.track_incoming and move.location_id.usage == 'supplier') or \ (move.product_id.track_outgoing and move.location_dest_id.usage == 'customer') \ )): return False return True
| 469,725
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception: logging.getLogger('report').exception() yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception: logging.getLogger('report').exception() pass if (tagname is None) or (n.tag==tagname): yield n
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception, e: logging.getLogger('report').exception(e) yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception, e: logging.getLogger('report').exception(e) pass if (tagname is None) or (n.tag==tagname): yield n
| 469,726
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception: logging.getLogger('report').exception() yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception: logging.getLogger('report').exception() pass if (tagname is None) or (n.tag==tagname): yield n
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception, e: logging.getLogger('report').exception(e) yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception, e: logging.getLogger('report').exception(e) pass if (tagname is None) or (n.tag==tagname): yield n
| 469,727
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception: logging.getLogger('report').exception() yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception: logging.getLogger('report').exception() pass if (tagname is None) or (n.tag==tagname): yield n
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception, e: logging.getLogger('report').exception(e) yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception, e: logging.getLogger('report').exception(e) pass if (tagname is None) or (n.tag==tagname): yield n
| 469,728
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception: logging.getLogger('report').exception() yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception: logging.getLogger('report').exception() continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception: logging.getLogger('report').exception() pass if (tagname is None) or (n.tag==tagname): yield n
|
def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop'): for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): if n.get('rml_except', False): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 except GeneratorExit: yield n except Exception, e: logging.getLogger('report').exception(e) yield n else: yield n continue if self and self.localcontext and n.get('rml_except'): try: eval(n.get('rml_except'), {}, self.localcontext) except GeneratorExit: continue except Exception, e: logging.getLogger('report').exception(e) continue if self and self.localcontext and n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr or {}) yield n2 tagname = '' except GeneratorExit: pass except Exception, e: logging.getLogger('report').exception(e) pass if (tagname is None) or (n.tag==tagname): yield n
| 469,729
|
def _col_get(self, cr, user, context={}): result = [] cols = self.pool.get('account.move.line')._columns for col in cols: if col in ('period_id', 'journal_id'): continue
|
def _col_get(self, cr, user, context={}): result = [] cols = self.pool.get('account.move.line')._columns for col in cols: if col in ('period_id', 'journal_id'): continue
| 469,730
|
def _lang_data_get(self, cr, uid, lang_id): conv = localeconv() lang_obj=self.browse(cr,uid,lang_id) thousands_sep = lang_obj.thousands_sep or conv[monetary and 'mon_thousands_sep' or 'thousands_sep'] decimal_point = lang_obj.decimal_point grouping = lang_obj.grouping return (grouping, thousands_sep, decimal_point)
|
def _lang_data_get(self, cr, uid, lang_id, monetary=False): conv = localeconv() lang_obj=self.browse(cr,uid,lang_id) thousands_sep = lang_obj.thousands_sep or conv[monetary and 'mon_thousands_sep' or 'thousands_sep'] decimal_point = lang_obj.decimal_point grouping = lang_obj.grouping return (grouping, thousands_sep, decimal_point)
| 469,731
|
def format(self, cr, uid, ids, percent, value, grouping=False, monetary=False): """ Format() will return the language-specific output for float values"""
|
def format(self, cr, uid, ids, percent, value, grouping=False, monetary=False): """ Format() will return the language-specific output for float values"""
| 469,732
|
def _get_invoice_from_reconcile(self, cr, uid, ids, context=None): move = {} for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context): for line in r.line_partial_ids: move[line.move_id.id] = True for line in r.line_id: move[line.move_id.id] = True
|
def _get_invoice_from_reconcile(self, cr, uid, ids, context=None): move = {} for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context): for line in r.line_partial_ids: move[line.move_id.id] = True for line in r.line_id: move[line.move_id.id] = True
| 469,733
|
def default_get(self, cr, uid, fields_list, context=None): res = super(event_make_invoice, self).default_get(cr, uid, fields_list, context) return res
|
def default_get(self, cr, uid, fields_list, context=None): res = super(event_make_invoice, self).default_get(cr, uid, fields_list, context) return res
| 469,734
|
def make_invoice(self, cr, uid, ids, context={}):
|
def make_invoice(self, cr, uid, ids, context={}):
| 469,735
|
def make_invoice(self, cr, uid, ids, context={}):
|
def make_invoice(self, cr, uid, ids, context={}):
| 469,736
|
def make_invoice(self, cr, uid, ids, context={}):
|
def make_invoice(self, cr, uid, ids, context={}):
| 469,737
|
def make_invoice(self, cr, uid, ids, context={}):
|
def make_invoice(self, cr, uid, ids, context={}):
| 469,738
|
def _get_child_ids(self, cr, uid, ids, field_name, arg, context={}): result = {} for record in self.browse(cr, uid, ids, context): if record.child_parent_ids: result[record.id] = [x.id for x in record.child_parent_ids] else: result[record.id] = []
|
def _get_child_ids(self, cr, uid, ids, field_name, arg, context={}): result = {} for record in self.browse(cr, uid, ids, context): if record.child_parent_ids: result[record.id] = [x.id for x in record.child_parent_ids] else: result[record.id] = []
| 469,739
|
def get_digits(self, obj=None, f=None, dp=None): d = DEFAULT_DIGITS = 2 if dp: decimal_precision_obj = self.pool.get('decimal.precision') ids = decimal_precision_obj.search(self.cr, self.uid, [('name', '=', dp)]) if ids: d = decimal_precision_obj.browse(self.cr, self.uid, ids)[0].digits elif obj and f: d = getattr(obj._columns[f], 'digits', lambda x: ((16,DEFAULT_DIGITS)))(self.cr)[1] elif (hasattr(obj, '_field') and\ isinstance(obj._field, (float_class, function_class)) and\ obj._field.digits): d = obj._field.digits[1] or DEFAULT_DIGITS return d
|
def get_digits(self, obj=None, f=None, dp=None): d = DEFAULT_DIGITS = 2 if dp: decimal_precision_obj = self.pool.get('decimal.precision') ids = decimal_precision_obj.search(self.cr, self.uid, [('name', '=', dp)]) if ids: d = decimal_precision_obj.browse(self.cr, self.uid, ids)[0].digits elif obj and f: res_digits = getattr(obj._columns[f], 'digits', lambda x: ((16,DEFAULT_DIGITS))) if isinstance(res_digits, tuple): d = res_digits[1] else: d = res_digits(self.cr)[1] elif (hasattr(obj, '_field') and\ isinstance(obj._field, (float_class, function_class)) and\ obj._field.digits): d = obj._field.digits[1] or DEFAULT_DIGITS return d
| 469,740
|
def get_file(self, cr, uid, id, file_node, mode, context=None): if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise RuntimeError('media offline') ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') fpath = os.path.join(boo.path, ira.store_fname) if self._debug: self._doclog.debug("Trying to read \"%s\".."% fpath) return nodefd_file(file_node, path=fpath, mode=mode)
|
def get_file(self, cr, uid, id, file_node, mode, context=None): if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise RuntimeError('media offline') ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') fpath = os.path.join(boo.path, ira.store_fname) return nodefd_file(file_node, path=fpath, mode=mode)
| 469,741
|
def get_file(self, cr, uid, id, file_node, mode, context=None): if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise RuntimeError('media offline') ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') fpath = os.path.join(boo.path, ira.store_fname) if self._debug: self._doclog.debug("Trying to read \"%s\".."% fpath) return nodefd_file(file_node, path=fpath, mode=mode)
|
def get_file(self, cr, uid, id, file_node, mode, context=None): if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise RuntimeError('media offline') ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') fpath = os.path.join(boo.path, ira.store_fname) if self._debug: self._doclog.debug("Trying to read \"%s\".."% fpath) return nodefd_file(file_node, path=fpath, mode=mode)
| 469,742
|
def die(cond, msg): if cond: print msg sys.exit(1)
|
def die(cond, msg): if cond: print msg sys.exit(1)
| 469,743
|
def onchange_contact_id(self, cr, uid, ids, contact, partner): data ={} if not contact: return data
|
def onchange_contact_id(self, cr, uid, ids, contact, partner): data ={} if not contact: return data
| 469,744
|
def onchange_event(self, cr, uid, ids, event_id, partner_invoice_id): context={} if not event_id: return {'value': {'unit_price': False, 'event_product': False}} data_event = self.pool.get('event.event').browse(cr, uid, event_id) context['currency_id'] = data_event.currency_id.id if data_event.product_id: if not partner_invoice_id: unit_price=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id] return {'value': {'unit_price': unit_price, 'event_product': data_event.product_id.name, 'currency_id': data_event.currency_id.id}} data_partner = self.pool.get('res.partner').browse(cr, uid, partner_invoice_id) context.update({'partner_id': data_partner}) unit_price = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id] return {'value': {'unit_price': unit_price, 'event_product': data_event.product_id.name, 'currency_id': data_event.currency_id.id}} return {'value': {'unit_price': False, 'event_product': False}}
|
defif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} onchange_event(self,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} cr,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} uid,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} ids,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} event_id,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} partner_invoice_id):if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} context={}if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} ifif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} notif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} event_id:if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} returnif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'value':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'unit_price':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} False,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} 'event_product':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} False}}if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_eventif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} =if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} self.pool.get('event.event').browse(cr,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} uid,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} event_id)if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} context['currency_id']if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} =if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_event.currency_id.idif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} ifif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_event.product_id:if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} ifif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} notif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} partner_invoice_id:if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} unit_price=self.pool.get('product.product').price_get(cr,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} uid,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} [data_event.product_id.id],if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} context=context)[data_event.product_id.id]if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} returnif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'value':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'unit_price':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} unit_price,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} 'event_product':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_event.product_id.name,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} 'currency_id':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_event.currency_id.id}}if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_partnerif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} =if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} self.pool.get('res.partner').browse(cr,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} uid,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} partner_invoice_id)if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} context.update({'partner_id':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_partner})if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} unit_priceif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} =if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} self.pool.get('product.product')._product_price(cr,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} uid,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} [data_event.product_id.id],if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} False,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} False,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'pricelist':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_partner.property_product_pricelist.id})[data_event.product_id.id]if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} returnif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'value':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'unit_price':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} unit_price,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} 'event_product':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_event.product_id.name,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} 'currency_id':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} data_event.currency_id.id}}if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} returnif data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'value':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} {'unit_price':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} False,if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} 'event_product':if data_event.user_id.id: return {'value': {'user_id':data_event.user_id.id}} False}}
| 469,745
|
def setlast_tracking(self, cr, uid, ids, context=None): tracking_obj = self.pool.get('stock.tracking') tracking = context.get('tracking', False) last_track = [line.tracking_id.id for line in self.browse(cr, uid, ids)[0].picking_id.move_lines if line.tracking_id] if not last_track: last_track = tracking_obj.create(cr, uid, {}, context=context) else: last_track.sort() last_track = last_track[-1] self.write(cr, uid, ids, {'tracking_id': last_track}) return True
|
def setlast_tracking(self, cr, uid, ids, context=None): tracking_obj = self.pool.get('stock.tracking') for line in self.browse(cr, uid, ids, context=context): last_track = None if line.picking_id: tracking_ids = [l.tracking_id.id for l in line.picking_id.move_lines if l.tracking_id] if tracking_ids: last_track = max(tracking_ids) if not last_track: last_track = tracking_obj.create(cr, uid, {}, context=context) self.write(cr, uid, line.id, {'tracking_id': last_track}, context=context) return True
| 469,746
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
def_get_payment_term_lines(term_id,amount):term_pool=self.pool.get('account.payment.term')ifterm_idandamount:terms=term_pool.compute(cr,uid,term_id,amount)returntermsreturnFalse
| 469,747
|
def execute(self, query, params=None): if '%d' in query or '%f' in query: self.__logger.warn(query) self.__logger.warn("SQL queries cannot contain %d or %f anymore. " "Use only %s") if params: query = query.replace('%d', '%s').replace('%f', '%s')
|
def execute(self, query, params=None): if '%d' in query or '%f' in query: self.__logger.warn(query) self.__logger.warn("SQL queries cannot contain %d or %f anymore. " "Use only %s") if params: query = query.replace('%d', '%s').replace('%f', '%s')
| 469,748
|
def borrow(self, dsn): self._debug('Borrow connection to %r', dsn)
|
def borrow(self, dsn): self._debug('Borrow connection to %r', dsn)
| 469,749
|
def close_all(self, dsn): self._debug('Close all connections to %r', dsn) for i, (cnx, used) in tools.reverse_enumerate(self._connections): if dsn_are_equals(cnx.dsn, dsn): cnx.close() self._connections.pop(i)
|
def close_all(self, dsn): self.__logger.info('%r: Close all connections to %r', self, dsn) for i, (cnx, used) in tools.reverse_enumerate(self._connections): if dsn_are_equals(cnx.dsn, dsn): cnx.close() self._connections.pop(i)
| 469,750
|
def assign_partner(self, cr, uid, ids, context=None): ok = False for part in self.browse(cr, uid, ids, context=context): if not part.country_id: continue addr = ', '.join(filter(None, [part.street, (part.zip or '')+' '+(part.city or ''), part.state_id and part.state_id.name, part.country_id and part.country_id.name])) result = geo_find(addr.encode('utf8')) if result: self.write(cr, uid, [part.id], { 'partner_latitude': result[0], 'partner_longitude': result[1] }, context=context)
|
def assign_partner(self, cr, uid, ids, context=None): ok = False for part in self.browse(cr, uid, ids, context=context): if not part.country_id: continue addr = ', '.join(filter(None, [part.street, (part.zip or '')+' '+(part.city or ''), part.state_id and part.state_id.name, part.country_id and part.country_id.name])) result = geo_find(addr.encode('utf8')) if result: self.write(cr, uid, [part.id], { 'partner_latitude': result[0], 'partner_longitude': result[1] }, context=context)
| 469,751
|
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): if not journal_id: return {'value': {'currency': False}}
|
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None): if not journal_id: return {'value': {'currency': False}}
| 469,752
|
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
| 469,753
|
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
| 469,754
|
def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail """ hist_obj = self.pool.get('crm.case.history') res_ids = context and context.get('active_ids', []) or []
|
def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail """ hist_obj = self.pool.get('crm.case.history') res_ids = context and context.get('active_ids', []) or []
| 469,755
|
def __get_default_search_view(self, cr, uid, context=None):
|
def __get_default_search_view(self, cr, uid, context=None):
| 469,756
|
def encode(s): if isinstance(s, unicode): return s.encode('utf8') return s
|
def encode(s): if isinstance(s, unicode): return s.encode('utf8') return s
| 469,757
|
def on_change_paid(self, cr, uid, id, tax, account): return self._on_change( cr, uid, ids, tax, vals={'account_paid_id': account})
|
def on_change_paid(self, cr, uid, id, tax, account): return self._on_change( cr, uid, ids, tax, vals={'account_paid_id': account})
| 469,758
|
def send_welcome_email(self, cr, uid, id, context=None): logger= netsvc.Logger() user = self.pool.get('res.users').read(cr, uid, id, context=context) if not tools.config.get('smtp_server'): logger.notifyChannel('mails', netsvc.LOG_WARNING, _('"smtp_server" needs to be set to send mails to users')) return False if not tools.config.get('email_from'): logger.notifyChannel("mails", netsvc.LOG_WARNING, _('"email_from" needs to be set to send welcome mails ' 'to users')) return False if not user.get('email'): return False
|
def send_welcome_email(self, cr, uid, id, context=None): logger= netsvc.Logger() user = self.pool.get('res.users').read(cr, uid, id, context=context) if not tools.config.get('smtp_server'): logger.notifyChannel('mails', netsvc.LOG_WARNING, _('"smtp_server" needs to be set to send mails to users')) return False if not tools.config.get('email_from'): logger.notifyChannel("mails", netsvc.LOG_WARNING, _('"email_from" needs to be set to send welcome mails ' 'to users')) return False if not user.get('email'): return False
| 469,759
|
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ 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
|
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ 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,760
|
def create(self, cr, uid, ids, datas, context=None):
|
def create(self, cr, uid, ids, datas, context=None):
| 469,761
|
def create(self, cr, uid, ids, datas, context=None):
|
def create(self, cr, uid, ids, datas, context=None):
| 469,762
|
def trans_unrec(self, cr, uid, ids, context=None): obj_move_line = self.pool.get('account.move.line') obj_move_reconcile = self.pool.get('account.move.reconcile') if context is None: context = {} recs = obj_move_line.read(cr, uid, data['ids'], ['reconcile_id','reconcile_partial_id']) unlink_ids = [] full_recs = filter(lambda x: x['reconcile_id'], recs) rec_ids = [rec['reconcile_id'][0] for rec in full_recs] part_recs = filter(lambda x: x['reconcile_partial_id'], recs) part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs] unlink_ids += rec_ids unlink_ids += part_rec_ids
|
def trans_unrec(self, cr, uid, ids, context=None): obj_move_line = self.pool.get('account.move.line') obj_move_reconcile = self.pool.get('account.move.reconcile') if context is None: context = {} recs = obj_move_line.read(cr, uid, context['active_ids'], ['reconcile_id','reconcile_partial_id']) unlink_ids = [] full_recs = filter(lambda x: x['reconcile_id'], recs) rec_ids = [rec['reconcile_id'][0] for rec in full_recs] part_recs = filter(lambda x: x['reconcile_partial_id'], recs) part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs] unlink_ids += rec_ids unlink_ids += part_rec_ids
| 469,763
|
def _calc_amount(self, cr, uid, ids, prop, unknow_none, unknow_dict): res = {} for order in self.browse(cr, uid, ids): res[order.id] = 0 for oline in order.order_line: res[order.id] += oline.price_unit * oline.product_qty return res
|
def _calc_amount(self, cr, uid, ids, prop, unknow_none, unknow_dict): res = {} for order in self.browse(cr, uid, ids): res[order.id] = 0 for oline in order.order_line: res[order.id] += oline.price_unit * oline.product_qty return res
| 469,764
|
def action_invoice_create(self, cr, uid, ids, *args): res = False
|
def action_invoice_create(self, cr, uid, ids, *args): res = False
| 469,765
|
def format_mail(self, obj, body): data = { 'object_id': obj.id, 'object_subject': hasattr(obj, 'name') and obj.name or False, 'object_date': hasattr(obj, 'date') and obj.date or False, 'object_description': hasattr(obj, 'description') and obj.description or False, 'object_user': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.name) or '/', 'object_user_email': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.address_id and obj.user_id.address_id.email) or '/', 'object_user_phone': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.address_id and obj.user_id.address_id.phone) or '/', 'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/', 'partner_email': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and obj.partner_address_id.email) or '/', } return format_body(body % data)
|
def format_mail(self, obj, body): data = { 'object_id': obj.id, 'object_subject': hasattr(obj, 'name') and obj.name or False, 'object_date': hasattr(obj, 'date') and obj.date or False, 'object_description': hasattr(obj, 'description') and obj.description or False, 'object_user': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.name) or '/', 'object_user_email': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.address_id and obj.user_id.address_id.email) or '/', 'object_user_phone': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.address_id and obj.user_id.address_id.phone) or '/', 'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/', 'partner_email': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and obj.partner_address_id.email) or '/', } return format_body(body % data)
| 469,766
|
def _parent_compute(self, cr, uid, ids, name, args, context=None): if context is None: context = {} result = {} obj_dept = self.pool.get('hr.department') for user_id in ids: emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', user_id)]) cr.execute('SELECT emp.department_id FROM hr_employee AS emp \ JOIN resource_resource AS res ON res.id = emp.resource_id \ JOIN hr_department as dept ON dept.id = emp.department_id \ WHERE res.user_id = %s AND emp.department_id IS NOT NULL AND dept.manager_id IS NOT NULL', (user_id,)) ids_dept = [x[0] for x in cr.fetchall()] parent_ids = [] if ids_dept: data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'], context=context) parent_ids = map(lambda x: x['manager_id'][0], data_dept) cr.execute('SELECT res.user_id FROM hr_employee AS emp JOIN resource_resource AS res ON res.id=emp.resource_id \ WHERE emp.id IN %s', (tuple(parent_ids),)) parent_ids = [x[0] for x in cr.fetchall()] result[user_id] = parent_ids return result
|
def _parent_compute(self, cr, uid, ids, name, args, context=None): if context is None: context = {} result = {} obj_dept = self.pool.get('hr.department') for user_id in ids: emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', user_id)]) cr.execute('SELECT emp.department_id FROM hr_employee AS emp \ JOIN resource_resource AS res ON res.id = emp.resource_id \ JOIN hr_department as dept ON dept.id = emp.department_id \ WHERE res.user_id = %s AND emp.department_id IS NOT NULL AND dept.manager_id IS NOT NULL', (user_id,)) ids_dept = [x[0] for x in cr.fetchall()] parent_ids = [] if ids_dept: data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'], context=context) parent_ids = map(lambda x: x['manager_id'][0], data_dept) cr.execute('SELECT res.user_id FROM hr_employee AS emp JOIN resource_resource AS res ON res.id=emp.resource_id \ WHERE emp.id IN %s', (tuple(parent_ids),)) parent_ids = [x[0] for x in cr.fetchall() if x[0]] result[user_id] = parent_ids return result
| 469,767
|
def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail """ hist_obj = self.pool.get('crm.case.history') res_ids = context and context.get('active_ids', []) or []
|
def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail """ hist_obj = self.pool.get('crm.case.history') res_ids = context and context.get('active_ids', []) or []
| 469,768
|
def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail """ hist_obj = self.pool.get('crm.case.history') res_ids = context and context.get('active_ids', []) or []
|
def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail """ hist_obj = self.pool.get('crm.case.history') res_ids = context and context.get('active_ids', []) or []
| 469,769
|
def _register_hook(self, cr, uid, ids, context=None): if not context: context = {} for action_rule in self.browse(cr, uid, ids, context=context): model = action_rule.model_id.model obj_pool = self.pool.get(model) obj_pool.__setattr__('create', self._create(obj_pool.create, model, context=context)) obj_pool.__setattr__('write', self._write(obj_pool.write, model, context=context)) return True
|
def _register_hook(self, cr, uid, ids, context=None): if not context: context = {} for action_rule in self.browse(cr, uid, ids, context=context): model = action_rule.model_id.model obj_pool = self.pool.get(model) if not hasattr(obj_pool, 'base_action_ruled'): obj_pool.create = self._create(obj_pool.create, model, context=context) obj_pool.write = self._write(obj_pool.write, model, context=context) obj_pool.base_action_ruled = True return True
| 469,770
|
def _register_hook(self, cr, uid, ids, context=None): if not context: context = {} for action_rule in self.browse(cr, uid, ids, context=context): model = action_rule.model_id.model obj_pool = self.pool.get(model) obj_pool.__setattr__('create', self._create(obj_pool.create, model, context=context)) obj_pool.__setattr__('write', self._write(obj_pool.write, model, context=context)) return True
|
def_register_hook(self,cr,uid,ids,context=None):ifnotcontext:context={}foraction_ruleinself.browse(cr,uid,ids,context=context):model=action_rule.model_id.modelobj_pool=self.pool.get(model)obj_pool.__setattr__('create',self._create(obj_pool.create,model,context=context))obj_pool.__setattr__('write',self._write(obj_pool.write,model,context=context))returnTrue
| 469,771
|
def _lines_a(self, general_account_id, account_id, date1, date2): self.cr.execute("SELECT aal.id AS id, aal.name AS name, aal.code AS code, aal.amount AS balance, aal.date AS date, aaj.code AS cj, aal.unit_amount AS quantity \ FROM account_analytic_line AS aal, account_analytic_journal AS aaj \ WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) AND (aal.date>=%s) AND (aal.date<=%s) \ AND (aal.journal_id=aaj.id) \ ORDER BY aal.date, aaj.code, aal.code", (general_account_id, account_id, date1, date2)) res = self.cr.dictfetchall()
|
def _lines_a(self, general_account_id, account_id, date1, date2): self.cr.execute("SELECT aal.id AS id, aal.name AS name, aal.code AS code, aal.amount AS balance, aal.date AS date, aaj.code AS cj, aal.unit_amount AS quantity \ FROM account_analytic_line AS aal, account_analytic_journal AS aaj \ WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) AND (aal.date>=%s) AND (aal.date<=%s) \ AND (aal.journal_id=aaj.id) \ ORDER BY aal.date, aaj.code, aal.code", (general_account_id, account_id, date1, date2)) res = self.cr.dictfetchall()
| 469,772
|
def _centralise(self, cr, uid, move, mode, context=None): assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection if context is None: context = {}
|
def _centralise(self, cr, uid, move, mode, context=None): assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection if context is None: context = {}
| 469,773
|
def _get_root_calendar_directory(self, cr, uid, context=None): objid = self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'caldav', 'document_directory_calendars0') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_cal_dir.name except Exception: logger = logging.getLogger('document') logger.warning('Cannot set root directory for Calendars:', exc_info=True) return False return False
|
def _get_root_calendar_directory(self, cr, uid, context=None): objid = self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'document', 'dir_calendars') if not mid: return False root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] root_cal_dir = self.browse(cr,uid, root_id, context=context) return root_cal_dir.name except Exception: logger = logging.getLogger('document') logger.warning('Cannot set root directory for Calendars:', exc_info=True) return False return False
| 469,774
|
def get(self, cr, obj, ids, name, user=None, context=None, values=None): if not context: context = {} if not values: values = {} res = {} for r in values: res[r['id']] = r[name] for id in ids: res.setdefault(id, '') obj = obj.pool.get(self._obj) # build a dictionary of the form {'id_of_distant_resource': name_of_distant_resource} from orm import except_orm try: names = dict(obj.name_get(cr, user, filter(None, res.values()), context)) except except_orm: names = {} iids = filter(None, res.values()) for iiid in iids: names[iiid] = '// Access Denied //'
|
def get(self, cr, obj, ids, name, user=None, context=None, values=None): if not context: context = {} if not values: values = {} res = {} for r in values: res[r['id']] = r[name] for id in ids: res.setdefault(id, '') obj = obj.pool.get(self._obj) # build a dictionary of the form {'id_of_distant_resource': name_of_distant_resource} from orm import except_orm try: names = dict(obj.name_get(cr, user, filter(None, res.values()), context)) except except_orm: names = {} iids = filter(None, res.values()) for iiid in iids: names[iiid] = '// Access Denied //'
| 469,775
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['total_included'] return res
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} val=0.0 cur_obj = self.pool.get('res.currency') cur = order.pricelist_id.currency_id for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } val=0.0 cur_obj = self.pool.get('res.currency') cur = order.pricelist_id.currency_id for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['total_included'] return res
| 469,776
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['total_included'] return res
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: for c in self.pool.get('account.tax').compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.qty, line.product_id, line.order_id.partner_id)['taxes']: val += c['amount'] res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val) return res
| 469,777
|
def action_confirm(self, cr, uid, ids): """ Confirms production order. @return: Newly generated picking Id. """ picking_id = False proc_ids = [] seq_obj = self.pool.get('ir.sequence') pick_obj = self.pool.get('stock.picking') move_obj = self.pool.get('stock.move') proc_obj = self.pool.get('procurement.order') wf_service = netsvc.LocalService("workflow") for production in self.browse(cr, uid, ids): if not production.product_lines: self.action_compute(cr, uid, [production.id]) production = self.browse(cr, uid, [production.id])[0] routing_loc = None pick_type = 'internal' address_id = False if production.bom_id.routing_id and production.bom_id.routing_id.location_id: routing_loc = production.bom_id.routing_id.location_id if routing_loc.usage <> 'internal': pick_type = 'out' address_id = routing_loc.address_id and routing_loc.address_id.id or False routing_loc = routing_loc.id pick_name = seq_obj.get(cr, uid, 'stock.picking.' + pick_type) picking_id = pick_obj.create(cr, uid, { 'name': pick_name, 'origin': (production.origin or '').split(':')[0] + ':' + production.name, 'type': pick_type, 'move_type': 'one', 'state': 'auto', 'address_id': address_id, 'auto_picking': self._get_auto_picking(cr, uid, production), 'company_id': production.company_id.id, })
|
def action_confirm(self, cr, uid, ids): """ Confirms production order. @return: Newly generated picking Id. """ picking_id = False proc_ids = [] seq_obj = self.pool.get('ir.sequence') pick_obj = self.pool.get('stock.picking') move_obj = self.pool.get('stock.move') proc_obj = self.pool.get('procurement.order') wf_service = netsvc.LocalService("workflow") for production in self.browse(cr, uid, ids): if not production.product_lines: self.action_compute(cr, uid, [production.id]) production = self.browse(cr, uid, [production.id])[0] routing_loc = None pick_type = 'internal' address_id = False if production.bom_id.routing_id and production.bom_id.routing_id.location_id: routing_loc = production.bom_id.routing_id.location_id if routing_loc.usage <> 'internal': pick_type = 'out' address_id = routing_loc.address_id and routing_loc.address_id.id or False routing_loc = routing_loc.id pick_name = seq_obj.get(cr, uid, 'stock.picking.' + pick_type) picking_id = pick_obj.create(cr, uid, { 'name': pick_production.name, 'origin': (production.origin or '').split(':')[0] + ':' + production.production.name, 'type': pick_type, 'move_type': 'one', 'state': 'auto', 'address_id': address_id, 'auto_picking': self._get_auto_picking(cr, uid, production), 'company_id': production.company_id.id, })
| 469,778
|
def _get_order(self, cr, uid, ids, context=None): if context is None: context = {} result = {} for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True return result.keys()
|
def _get_order(self, cr, uid, ids, context=None): if context is None: context = {} result = {} for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True return result.keys()
| 469,779
|
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=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=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,780
|
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=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=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,781
|
def result_get(self): return self.result
|
def result_get(self): return self.result
| 469,782
|
def result_get(self): return self.result
|
def result_get(self): return self.result
| 469,783
|
def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): seq_obj_name = 'stock.picking.' + vals['type'] vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) type_list = { 'out':_('Packing List'), 'in':_('Reception'), 'internal': _('Internal picking'), 'delivery': _('Delivery order') } new_id = super(stock_picking, self).create(cr, user, vals, context) if not vals.get('auto_picking', False): message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + _(" with origin")+" '" + (vals['origin'] or "n/a") + "' "+ _("is created.") self.log(cr, user, new_id, message) return new_id
|
def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): seq_obj_name = 'stock.picking.' + vals['type'] vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) type_list = { 'out':_('Packing List'), 'in':_('Reception'), 'internal': _('Internal picking'), 'delivery': _('Delivery order') } new_id = super(stock_picking, self).create(cr, user, vals, context) if not vals.get('auto_picking', False): message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + _(" with origin")+" '" + (vals.get('origin') or "n/a") + "' "+ _("is created.") self.log(cr, user, new_id, message) return new_id
| 469,784
|
def _check_date(self, cr, uid, ids): for rec in self.read(cr, uid, ids, ['number_of_days_temp','date_from','date_to']): if rec['number_of_days_temp'] < 0: return False date_from = time.strptime(rec['date_from'], '%Y-%m-%d %H:%M:%S') date_to = time.strptime(rec['date_to'], '%Y-%m-%d %H:%M:%S') if date_from > date_to: return False return True
|
def _check_date(self, cr, uid, ids): for rec in self.read(cr, uid, ids, ['number_of_days_temp','date_from','date_to', 'type']): if rec['number_of_days_temp'] < 0: return False date_from = time.strptime(rec['date_from'], '%Y-%m-%d %H:%M:%S') date_to = time.strptime(rec['date_to'], '%Y-%m-%d %H:%M:%S') if date_from > date_to: return False return True
| 469,785
|
def get_module_resource(module, *args): """Return the full path of a resource of the given module. @param module: the module @param args: the resource path components @return: absolute path to the resource """ a = get_module_path(module) if zipfile.is_zipfile( a +'.zip') : zip = zipfile.ZipFile( a + ".zip") files = ['/'.join(f.split('/')[1:]) for f in zip.namelist()] else: files = tools.osutil.listdir(a, True) for ar in args: if ar not in files: return False res = a and opj(a, *args) or False return res
|
def get_module_resource(module, *args): """Return the full path of a resource of the given module. @param module: the module @param args: the resource path components @return: absolute path to the resource """ a = get_module_path(module) if zipfile.is_zipfile( a +'.zip') : zip = zipfile.ZipFile( a + ".zip") files = [opj(a,'/'.join(f.split('/')[1:])) for f in zip.namelist()] if res in files: return res else: files = tools.osutil.listdir(a, True) for ar in args: if ar not in files: return False res = a and opj(a, *args) or False return res
| 469,786
|
def get_module_resource(module, *args): """Return the full path of a resource of the given module. @param module: the module @param args: the resource path components @return: absolute path to the resource """ a = get_module_path(module) if zipfile.is_zipfile( a +'.zip') : zip = zipfile.ZipFile( a + ".zip") files = ['/'.join(f.split('/')[1:]) for f in zip.namelist()] else: files = tools.osutil.listdir(a, True) for ar in args: if ar not in files: return False res = a and opj(a, *args) or False return res
|
def get_module_resource(module, *args): """Return the full path of a resource of the given module. @param module: the module @param args: the resource path components @return: absolute path to the resource """ a = get_module_path(module) if zipfile.is_zipfile( a +'.zip') : zip = zipfile.ZipFile( a + ".zip") files = ['/'.join(f.split('/')[1:]) for f in zip.namelist()] else: if os.path.isfile(res): return res return False
| 469,787
|
def _compute_day(self, cr, uid, ids, fields, args, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual values """ cal_obj = self.pool.get('resource.calendar') res_obj = self.pool.get('resource.resource')
|
def _compute_day(self, cr, uid, ids, fields, args, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual values """ cal_obj = self.pool.get('resource.calendar') res_obj = self.pool.get('resource.resource')
| 469,788
|
def do_close(self, cr, uid, ids, context=None): """ Close Task """ if context is None: context = {} request_pool = self.pool.get('res.request') for task in self.browse(cr, uid, ids, context=context): project = task.project_id if project: # Send request to project manager if project.warn_manager and project.user_id and (project.user_id.id != uid): request.create(cr, uid, { 'name': _("Task '%s' closed") % task.name, 'state': 'waiting', 'act_from': uid, 'act_to': project.user_id.id, 'ref_partner_id': task.partner_id.id, 'ref_doc1': 'project.task,%d'% (task.id,), 'ref_doc2': 'project.project,%d'% (project.id,), }) for parent_id in task.parent_ids: if parent_id.state in ('pending','draft'): reopen = True for child in parent_id.child_ids: if child.id != task.id and child.state not in ('done','cancelled'): reopen = False if reopen: self.do_reopen(cr, uid, [parent_id.id]) self.write(cr, uid, [task.id], {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0}) message = _('Task ') + " '" + task.name + "' "+ _("is Done.") self.log(cr, uid, task.id, message) return True
|
def do_close(self, cr, uid, ids, context=None): """ Close Task """ if context is None: context = {} request = self.pool.get('res.request') for task in self.browse(cr, uid, ids, context=context): project = task.project_id if project: # Send request to project manager if project.warn_manager and project.user_id and (project.user_id.id != uid): request.create(cr, uid, { 'name': _("Task '%s' closed") % task.name, 'state': 'waiting', 'act_from': uid, 'act_to': project.user_id.id, 'ref_partner_id': task.partner_id.id, 'ref_doc1': 'project.task,%d'% (task.id,), 'ref_doc2': 'project.project,%d'% (project.id,), }) for parent_id in task.parent_ids: if parent_id.state in ('pending','draft'): reopen = True for child in parent_id.child_ids: if child.id != task.id and child.state not in ('done','cancelled'): reopen = False if reopen: self.do_reopen(cr, uid, [parent_id.id]) self.write(cr, uid, [task.id], {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0}) message = _('Task ') + " '" + task.name + "' "+ _("is Done.") self.log(cr, uid, task.id, message) return True
| 469,789
|
def _set_attendee_data(self, cr, uid, id, name, value, arg, context): if not value: return eventdata = self.browse(cr, uid, id, context=context) att_len = len(eventdata.attendee_ids) if att_len == len(value.split(',')): return if att_len > len(value.split(',')): for attendee in eventdata.attendee_ids[len(value.split(',')):]: self.write(cr, uid, id, {'attendee_ids': [(3, attendee.id)]}) return attendee_obj = self.pool.get('calendar.attendee') for val in value.split(',')[att_len:]: attendee_id = attendee_obj.create(cr, uid, {'cn': val.strip()}) self.write(cr, uid, id, {'attendee_ids': [(4, attendee_id)]}) return
|
def _set_attendee_data(self, cr, uid, id, name, value, arg, context): if not value: return eventdata = self.browse(cr, uid, id, context=context) att_len = len(eventdata.attendee_ids) if att_len == len(value.split(',')): return if att_len > len(value.split(',')): for attendee in eventdata.attendee_ids[len(value.split(',')):]: self.write(cr, uid, id, {'attendee_ids': [(3, attendee.id)]}) return attendee_obj = self.pool.get('calendar.attendee') for val in value.split(',')[att_len:]: attendee_id = attendee_obj.create(cr, uid, {'cn': val.strip()}) self.write(cr, uid, id, {'attendee_ids': [(4, attendee_id)]}) return
| 469,790
|
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): if isinstance(ids, (str, int, long)): select = [ids] else: select = ids new_ids = [] for id in select: id = common.caldav_id2real_id(id) if not id in new_ids: new_ids.append(id) if 'case_id' in vals: vals['case_id'] = common.caldav_id2real_id(vals['case_id']) res = super(crm_meeting, self).write(cr, uid, new_ids, vals, context=context) self.do_alarm_create(cr, uid, ids) return res
|
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): if isinstance(ids, (str, int, long)): select = [ids] else: select = ids new_ids = [] for id in select: id = common.caldav_id2real_id(id) if not id in new_ids: new_ids.append(id) if 'case_id' in vals: vals['case_id'] = common.caldav_id2real_id(vals['case_id']) res = super(crm_meeting, self).write(cr, uid, new_ids, vals, context=context) self.do_alarm_create(cr, uid, new_ids) return res
| 469,791
|
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Function that is call when the partner of the invoice is changed it will retriev and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, uid, ids, type, partner_id, date_invoice, payment_term ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) if p.bank_ids: bank_id = p.bank_ids[0].id
|
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank=False, company_id=False): """ Function that is call when the partner of the invoice is changed it will retriev and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, uid, ids, type, partner_id, date_invoice, payment_term ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) if p.bank_ids: bank_id = p.bank_ids[0].id
| 469,792
|
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Function that is call when the partner of the invoice is changed it will retriev and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, uid, ids, type, partner_id, date_invoice, payment_term ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) if p.bank_ids: bank_id = p.bank_ids[0].id
|
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Function that is call when the partner of the invoice is changed it will retriev and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, uid, ids, type, partner_id, date_invoice, payment_term ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) if p.bank_ids: bank_id = p.bank_ids[0].id
| 469,793
|
def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = [] res = {} res_ids = [] obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] for ref_id in ref_ids: msg_new = dictcreate.get('message') ref = ref_id.split(',') model = ref[0] res_id = int(ref[1]) if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) if msg_ids and len(msg_ids): continue if model not in obj_list: res={} obj_attch = self.pool.get('ir.attachment') ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] sub = msg.get('subject','NO-SUBJECT').replace(' ','') if sub.strip() == '': sub = 'NO SBUJECT' fn = sub for c in ls: fn = fn.replace(c,'') if len(fn) > 64: l = 64 - len(fn) f = fn.split('-') fn = '-'.join(f[1:]) if len(fn) > 64: l = 64 - len(fn) f = fn.split('.') fn = f[0][0:l] + '.' + f[-1] fn = fn[:-4]+'.txt' res['res_model'] = model res['name'] = msg.get('subject','NO-SUBJECT') res['datas_fname'] = fn res['datas'] = base64.b64encode(msg.get('body')) res['res_id'] = res_id obj_attch.create(cr, uid, res) server_tools_pool.history_message(cr, uid, model, res_id, msg_new) res_ids.append(res_id) return len(res_ids)
|
def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = [] res = {} res_ids = [] obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] for ref_id in ref_ids: msg_new = dictcreate.get('message') ref = ref_id.split(',') model = ref[0] res_id = int(ref[1]) if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) if msg_ids and len(msg_ids): continue if model not in obj_list: res={} obj_attch = self.pool.get('ir.attachment') ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] sub = msg.get('subject','NO-SUBJECT').replace(' ','') if sub.strip() == '': sub = 'NO SBUJECT' fn = sub for c in ls: fn = fn.replace(c,'') if len(fn) > 64: l = 64 - len(fn) f = fn.split('-') fn = '-'.join(f[1:]) if len(fn) > 64: l = 64 - len(fn) f = fn.split('.') fn = f[0][0:l] + '.' + f[-1] fn = fn[:-4]+'.txt' res['res_model'] = model res['name'] = msg.get('subject','NO-SUBJECT') res['datas_fname'] = fn res['datas'] = base64.b64encode(msg.get('body')) res['res_id'] = res_id obj_attch.create(cr, uid, res) server_tools_pool.history_message(cr, uid, model, res_id, msg_new) res_ids.append(res_id) return len(res_ids)
| 469,794
|
def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = [] res = {} res_ids = [] obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] for ref_id in ref_ids: msg_new = dictcreate.get('message') ref = ref_id.split(',') model = ref[0] res_id = int(ref[1]) if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) if msg_ids and len(msg_ids): continue if model not in obj_list: res={} obj_attch = self.pool.get('ir.attachment') ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] sub = msg.get('subject','NO-SUBJECT').replace(' ','') if sub.strip() == '': sub = 'NO SBUJECT' fn = sub for c in ls: fn = fn.replace(c,'') if len(fn) > 64: l = 64 - len(fn) f = fn.split('-') fn = '-'.join(f[1:]) if len(fn) > 64: l = 64 - len(fn) f = fn.split('.') fn = f[0][0:l] + '.' + f[-1] fn = fn[:-4]+'.txt' res['res_model'] = model res['name'] = msg.get('subject','NO-SUBJECT') res['datas_fname'] = fn res['datas'] = base64.b64encode(msg.get('body')) res['res_id'] = res_id obj_attch.create(cr, uid, res) server_tools_pool.history_message(cr, uid, model, res_id, msg_new) res_ids.append(res_id) return len(res_ids)
|
def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = [] res = {} res_ids = [] obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] for ref_id in ref_ids: msg_new = dictcreate.get('message') ref = ref_id.split(',') model = ref[0] res_id = int(ref[1]) if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) if msg_ids and len(msg_ids): continue if model not in obj_list: res={} obj_attch = self.pool.get('ir.attachment') ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] sub = msg.get('subject','NO-SUBJECT').replace(' ','') if sub.strip() == '': sub = 'NO SBUJECT' fn = sub for c in ls: fn = fn.replace(c,'') if len(fn) > 64: l = 64 - len(fn) f = fn.split('-') fn = '-'.join(f[1:]) if len(fn) > 64: l = 64 - len(fn) f = fn.split('.') fn = f[0][0:l] + '.' + f[-1] fn = fn[:-4]+'.txt' res['res_model'] = model res['name'] = msg.get('subject','NO-SUBJECT') res['datas_fname'] = fn res['datas'] = base64.b64encode(msg.get('body')) res['res_id'] = res_id obj_attch.create(cr, uid, res) server_tools_pool.history_message(cr, uid, model, res_id, msg_new) res_ids.append(res_id) return len(res_ids)
| 469,795
|
def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = [] res = {} res_ids = [] obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] for ref_id in ref_ids: msg_new = dictcreate.get('message') ref = ref_id.split(',') model = ref[0] res_id = int(ref[1]) if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) if msg_ids and len(msg_ids): continue if model not in obj_list: res={} obj_attch = self.pool.get('ir.attachment') ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] sub = msg.get('subject','NO-SUBJECT').replace(' ','') if sub.strip() == '': sub = 'NO SBUJECT' fn = sub for c in ls: fn = fn.replace(c,'') if len(fn) > 64: l = 64 - len(fn) f = fn.split('-') fn = '-'.join(f[1:]) if len(fn) > 64: l = 64 - len(fn) f = fn.split('.') fn = f[0][0:l] + '.' + f[-1] fn = fn[:-4]+'.txt' res['res_model'] = model res['name'] = msg.get('subject','NO-SUBJECT') res['datas_fname'] = fn res['datas'] = base64.b64encode(msg.get('body')) res['res_id'] = res_id obj_attch.create(cr, uid, res) server_tools_pool.history_message(cr, uid, model, res_id, msg_new) res_ids.append(res_id) return len(res_ids)
|
def history_message(self, cr, uid, vals): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') message_id = msg.get('message-id', False) msg_pool = self.pool.get('mailgate.message') msg_ids = [] res = {} res_ids = [] obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] for ref_id in ref_ids: msg_new = dictcreate.get('message') ref = ref_id.split(',') model = ref[0] res_id = int(ref[1]) if message_id: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) if msg_ids and len(msg_ids): continue if model not in obj_list: res={} obj_attch = self.pool.get('ir.attachment') ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] sub = msg.get('subject','NO-SUBJECT').replace(' ','') if sub.strip() == '': sub = 'NO SBUJECT' fn = sub for c in ls: fn = fn.replace(c,'') if len(fn) > 64: l = 64 - len(fn) f = fn.split('-') fn = '-'.join(f[1:]) if len(fn) > 64: l = 64 - len(fn) f = fn.split('.') fn = f[0][0:l] + '.' + f[-1] fn = fn[:-4]+'.txt' res['res_model'] = model res['name'] = msg.get('subject','NO-SUBJECT') res['datas_fname'] = fn res['datas'] = base64.b64encode(msg.get('body')) res['res_id'] = res_id obj_attch.create(cr, uid, res) server_tools_pool.history_message(cr, uid, model, res_id, msg_new) res_ids.append(res_id) return len(res_ids)
| 469,796
|
def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: base = cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'base_amount':base}}
|
def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: base = cur_obj.compute(cr, uid, currency_id, company_currency, base*factor, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'base_amount':base}}
| 469,797
|
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False tax_sign = 1 if ids: tax_amount = self.read(cr, uid, ids[0], ['tax_amount'])['tax_amount'] if tax_amount < 0: tax_sign = -1 elif tax_amount == 0: tax_sign = 0 if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*tax_sign, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount': amount}}
|
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False factor = 1 if ids: tax_amount = self.read(cr, uid, ids[0], ['tax_amount'])['tax_amount'] if tax_amount < 0: tax_sign = -1 elif tax_amount == 0: tax_sign = 0 if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*tax_sign, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount': amount}}
| 469,798
|
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False tax_sign = 1 if ids: tax_amount = self.read(cr, uid, ids[0], ['tax_amount'])['tax_amount'] if tax_amount < 0: tax_sign = -1 elif tax_amount == 0: tax_sign = 0 if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*tax_sign, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount': amount}}
|
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency = False tax_sign = 1 if ids: factor = self.read(cr, uid, ids[0], ['factor_tax'])['factor_tax'] if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0] if currency_id and company_currency: amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*tax_sign, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount': amount}}
| 469,799
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.