rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
openoffice_report.register_openoffice_report( report.report_name, report.model ) | openoffice_report.openoffice_report( report.report_name, report.model ) | def update(self, cr, uid, ids, context={}): """Browse attachments and store .odt into pxgo_openoffixe_reprots/custom_reports directory. Also add or update ir.values data so they're shown on model views.""" for report in self.browse(cr, uid, ids): has_default = False |
add_ids = [] | def action_force_extraction(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) seg_obj = pool.get('dm.campaign.proposition.segment').browse(cr, uid, data['id']) if seg_obj.segmentation_id: cr.execute(seg_obj.segmentation_id.sql_query) address_ids = map(lambda x: x[0], cr.fetchall()) else: address_ids = []... | |
for sale in pool.get('sale.order').browse(cr, uid, sale_ids): address = sale.partner_invoice_id.id add_ids.append(address) pool.get('dm.customers_file').create(cr, uid, {'name': data['form']['name'], | address_ids = [sale.partner_invoice_id.id for sale in pool.get('sale.order').browse(cr, uid, sale_ids)] pool.get('dm.customers_file').create(cr, uid, {'name': data['form']['name'], | def action_force_extraction(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) seg_obj = pool.get('dm.campaign.proposition.segment').browse(cr, uid, data['id']) if seg_obj.segmentation_id: cr.execute(seg_obj.segmentation_id.sql_query) address_ids = map(lambda x: x[0], cr.fetchall()) else: address_ids = []... |
'address_ids': [[6, 0, add_ids]],}) | 'address_ids': [[6, 0, set(address_ids)]],}) | def action_force_extraction(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) seg_obj = pool.get('dm.campaign.proposition.segment').browse(cr, uid, data['id']) if seg_obj.segmentation_id: cr.execute(seg_obj.segmentation_id.sql_query) address_ids = map(lambda x: x[0], cr.fetchall()) else: address_ids = []... |
'datetime': fields.date('Date of Event'), 'start_date': fields.date('Start Date'), | 'datetime': fields.date('Date of Event', required=True), 'start_date': fields.date('Start Date', required=True), | def _call(self, cr, uid, ids=False, context={}): ''' Function called by the scheduler to process cases for date actions Only works on not done and cancelled cases ''' action_pool = model_pool = self.pool.get('ir.actions.server') if not ids: ids = self.search(cr, uid, [('state','=','done')]) |
'repeat':fields.boolean('Repeat Every Year', required=False), | 'repeat':fields.boolean('Repeat ?', required=False), | def _call(self, cr, uid, ids=False, context={}): ''' Function called by the scheduler to process cases for date actions Only works on not done and cancelled cases ''' action_pool = model_pool = self.pool.get('ir.actions.server') if not ids: ids = self.search(cr, uid, [('state','=','done')]) |
],'State', select=True, readonly=False), 'email':fields.char('Email Address', size=1024, required=True, readonly=False), | ],'Repeat Every', select=True, readonly=False), 'notify':fields.selection([ ('email','Email Address'), ('mobile','Mobile Number'), ],'Notify On', select=True, reduired=True), 'email':fields.char('Email / Mobile', size=1024, help="This can be any things, it can be email address or mobile according to usage of action"), | def _call(self, cr, uid, ids=False, context={}): ''' Function called by the scheduler to process cases for date actions Only works on not done and cancelled cases ''' action_pool = model_pool = self.pool.get('ir.actions.server') if not ids: ids = self.search(cr, uid, [('state','=','done')]) |
ids = self.search(cr, uid, [('date', '>=', now)], context=context) | ids = self.search(cr, uid, [('date', '<=', now)], context=context) | def execute(self, cr, uid, context=None): if context is None: context = {} |
raise except_osv('No price avaible !', 'No line matched this order in the choosed delivery grids !') | raise osv.except_osv('No price avaible !', 'No line matched this order in the choosed delivery grids !') | def get_price_from_picking(self, cr, uid, id, total, weight, volume, context={}): grid = self.browse(cr, uid, id, context) |
'desc_from_offer': lambda *a: True, | def get_campaign_purchase_line_ids(self , cr, uid, ids, context): result = {} for po in self.browse(cr, uid, ids, context): result[po.dm_campaign_purchase_line.id] =True return result.keys() | |
if not data.digital_number.isdigit(): | if data.digital_number and not data.digital_number.isdigit(): | def check_digital_no(self,cr, uid, ids): for data in self.browse(cr, uid, ids): if not data.digital_number.isdigit(): return False return True |
vals=pool_obj.get('account.move.line').read(cr, uid,line_id) vals['state']='draft' temp =vals['debit'] vals['debit']=vals['credit'] vals['credit']=temp del vals['id'] del vals['move_id'] vals['reconcile_id']= False if move_id: vals['move_id']=move_id for field in vals: if isinstance(vals[field],tuple): vals[field]=val... | vals=move_line_obj.read(cr, uid,line_id) new_ids.append(move_line_obj.copy(cr, uid, line_id, {'reconcile_id':False, 'reconcile_partial_id':False, 'blocked':False, 'move_id':move_id, 'state':'draft', 'debit':vals['credit'], 'credit':vals['debit'] })) new_move_ids.append(move_id) | def _open_lines(self, cr, uid, data, context): |
'domain': "[('id','in', ["+','.join(map(str,data['new_ids']))+"])]", | 'domain': "[('id','in', ["+','.join(map(str,new_move_ids))+"])]", | def _open_lines(self, cr, uid, data, context): |
class dm_campaign_purchase_line(osv.osv): _name = 'dm.campaign.purchase_line' _rec_name = 'product_id' def _get_uom_id(self, cr, uid, *args): cr.execute('select id from product_uom order by id limit 1') res = cr.fetchone() return res and res[0] or False def pline_doc_generate(self,cr, uid, ids, *args): "Generera... | def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} if not values: values = {} res = {} for id in ids: res[id] = [] cr.execute("select id from product_category where name='Direct Marketing'") direct_id = cr.fetchone() sql="select id,name from product_category ... | |
'state' : fields.function(_state_get, method=True, type='selection', selection=[ ('pending','Pending'), ('requested','Quotations Requested'), ('ordered','Ordered'), ('delivered','Delivered'), ], string='State', store = { 'purchase.order': (get_campaign_purchase_line_ids, ['state'], 10), }, readonly=True), } _defaults ... | def get_campaign_purchase_line_ids(self , cr, uid, ids, context): result = {} | |
logger.notifyChannel('kettle-connector', netsvc.LOG_INFO, "start kettle task : kettle log in " + str(kettle_dir) + '/nohup.out') | logger.notifyChannel('kettle-connector', netsvc.LOG_INFO, "start kettle task : kettle log in " + kettle_dir +"/" + log_file_name + '.log') | def execute_transformation(self, cr, uid, id, filter, log_file_name, attachment_id, context): transfo = self.browse(cr, uid, id, context) kettle_dir = transfo.server_id.kettle_dir filename = transfo.filename logger = netsvc.Logger() transformation_temp = open(kettle_dir + '/transformations/'+ filename, 'w') file_temp ... |
if pline.type == 'translation': trans_id = self.pool.get('dm.offer.translation').create(cr, uid, {'offer_id': pline.campaign_id.offer_id.id, 'date': pline.date_delivery, 'language_id': pline.campaign_id.lang_id.id, 'translator_id': po.partner_id.id, 'notes': pline.notes, }) | def _state_get(self, cr, uid, ids, name, args, context={}): result = {} for pline in self.browse(cr, uid, ids): delivered=False ordered=False if pline.purchase_order_ids: for po in pline.purchase_order_ids: if delivered: continue if po.shipped: result[pline.id]='delivered' delivered=True if pline.type == 'translation':... | |
if em_product: | if en_product: | def _add_child(cat_ids, categ): for child in categ.child_id: if child.id not in cat_ids: cat_ids.append(child.id) _add_child(cat_ids, child) |
if product.contrib != 0.0: webproduct['description'] = webproduct['description'] + " Recycling cost included." webproduct['short_description'] = webproduct['short_description'] + " Recycling cost included." webproduct['description:fr_FR'] = webproduct['description:fr_FR'] + " Contribution recyclage incluse." webproduct... | def _add_child(cat_ids, categ): for child in categ.child_id: if child.id not in cat_ids: cat_ids.append(child.id) _add_child(cat_ids, child) | |
'type': lambda *args: 'unpaid' | 'type': lambda *args: 'unpaid', 'company_id': lambda self, cr, uid, context: \ self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id, | def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.allounce.deduction.categoty.line') res = 0 ids = line_pool.search(cr, uid, [('category_id','=',id), ('to','>=',value),('from','<=',value)]) if not ids: ids = line_pool.search(cr, uid, [('category_id','=',id), ('from','<=',value)]) if... |
_name = "dm.campaign.proposition.segment" | def write(self, cr, uid, ids, vals, context=None): super(dm_address_segmentation, self).write(cr, uid, ids, vals, context) if isinstance(ids, (int, long)): ids = [ids] for i in ids: sql_query = self.set_address_criteria(cr, uid, i) super(dm_address_segmentation, self).write(cr, uid, i, {'sql_query': sql_query}) return ... | |
'segmentation_id':fields.many2one('dm.address.segmentation', | 'segmentations_id':fields.many2one('dm.address.segmentation', | def write(self, cr, uid, ids, vals, context=None): super(dm_address_segmentation, self).write(cr, uid, ids, vals, context) if isinstance(ids, (int, long)): ids = [ids] for i in ids: sql_query = self.set_address_criteria(cr, uid, i) super(dm_address_segmentation, self).write(cr, uid, i, {'sql_query': sql_query}) return ... |
so_vals = {} | def create(self, cr, uid, vals, context={}): if 'order_session_id' in vals and vals['order_session_id'] and \ ('state' in vals and vals['state']!= 'error' or True): country_id = 'country_id' in vals and vals['country_id'] or False message = self._check_filter(cr, uid, vals['order_session_id'], vals['segment_id'],countr... | |
if order.sale_order_id and order.state !='error': | if order.sale_order_id and order.state !='error' and so_vals: | def create(self, cr, uid, vals, context={}): if 'order_session_id' in vals and vals['order_session_id'] and \ ('state' in vals and vals['state']!= 'error' or True): country_id = 'country_id' in vals and vals['country_id'] or False message = self._check_filter(cr, uid, vals['order_session_id'], vals['segment_id'],countr... |
'date' : fields.related('crm_case_id', 'date', type='date', string="Date", store=True) | 'embassy_date' : fields.related('crm_case_id', 'date', type='date', string="Date", store=True) | def check_folder_line(self, cr, uid, ids): #CONSTRAINT: For each embassy Folder, it can only be one embassy_folder_line of each type. data_folder = self.browse(cr,uid,ids) list = [] for folder in data_folder: for line in folder.embassy_folder_line_ids: if line.type and line.type in list: return False list.append(line.t... |
"date": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S") } _order = "cci_missions_embassy_folder.date desc" | } _order = "cci_missions_embassy_folder.embassy_date desc" | def check_folder_line(self, cr, uid, ids): #CONSTRAINT: For each embassy Folder, it can only be one embassy_folder_line of each type. data_folder = self.browse(cr,uid,ids) list = [] for folder in data_folder: for line in folder.embassy_folder_line_ids: if line.type and line.type in list: return False list.append(line.t... |
pid = self.browse(cr, uid, ids[0], context).process_id.id self.pool.get('ir.cron').write(cr, uid, [pid], {'active':False}) | if self.browse(cr, uid, ids[0], context).process_id: pid = self.browse(cr, uid, ids[0], context).process_id.id self.pool.get('ir.cron').write(cr, uid, [pid], {'active':False}) | def stop_process(self, cr, uid, ids, context={}): pid = self.browse(cr, uid, ids[0], context).process_id.id self.pool.get('ir.cron').write(cr, uid, [pid], {'active':False}) self.write(cr, uid, ids, {'pstate':'stop'}) return True |
if partner.refuse_membership: | if partner_data.refuse_membership: | def _membership_state(self, cr, uid, ids, name, args, context=None): #the call to super is deactivated because of unresolved conflicts with the 5.0 version #of the membership module in state priorities. It is replaced by the ugly copy/paste below #res = super(res_partner, self)._membership_state(cr, uid, ids, name, arg... |
for line_id in dm_campaign_purchase_line_obj.search(cr, uid, [('campaign_id', '=', po.campaign_id.id)]): result[line_id] = True print "get_campaign_purchase_line_ids: ", result.keys() | for line in po.dm_campaign_purchase_line_ids: result[line.id] = True pass print "get_campaign_purchase_line_ids: po ids: ", ids print "get_campaign_purchase_line_ids: result: ", result.keys() | def get_campaign_purchase_line_ids(self , cr, uid, ids, context): result = {} |
'dm_campaign_purchase_line': fields.many2one('dm.campaign.purchase_line', 'DM Campaign Purchase Line'), | 'dm_campaign_purchase_line_ids': fields.many2many('dm.campaign.purchase_line', 'dm_campaign_purchase_line_purchase_order_rel', 'purchase_order_id', 'dm_campaign_purchase_line_id', 'Purchase Line') | def get_campaign_purchase_line_ids(self , cr, uid, ids, context): result = {} |
print 'key', key, "context['filter'][key]", context['filter'][key] | def execute_transformation(self, cr, uid, id, log_file_name, attachment_id, context): transfo = self.browse(cr, uid, id, context) kettle_dir = transfo.server_id.kettle_dir filename = transfo.filename logger = netsvc.Logger() transformation_temp = open(kettle_dir + '/transformations/'+ filename, 'w') file_temp = base64... | |
self.pool.get('ir.attachment').write(cr, uid, attachment_id, {'datas': base64.encodestring(open(kettle_dir +"/" + log_file_name + '.log', 'rb').read()), 'datas_fname': log_file_name + '.log', 'name' : prefixe_log_name + ' ' + log_file_name}, context) | self.pool.get('ir.attachment').write(cr, uid, [attachment_id], {'datas': base64.encodestring(open(kettle_dir +"/" + log_file_name + '.log', 'rb').read()), 'datas_fname': log_file_name + '.log', 'name' : prefixe_log_name + ' ' + log_file_name}, context) | def execute_transformation(self, cr, uid, id, log_file_name, attachment_id, context): transfo = self.browse(cr, uid, id, context) kettle_dir = transfo.server_id.kettle_dir filename = transfo.filename logger = netsvc.Logger() transformation_temp = open(kettle_dir + '/transformations/'+ filename, 'w') file_temp = base64... |
context['filter'].update({'AUTO_REP_file_in' : str(context['input_filename'])}) | context['filter'].update({'AUTO_REP_file_in' : str(context['input_filename']), 'AUTO_REP_file_in_name' : str(context['input_filename'].split('/').pop())}) | def start_kettle_task(self, cr, uid, ids, context=None): logger = netsvc.Logger() user = self.pool.get('res.users').browse(cr, uid, uid, context) for id in ids: context.update({'default_res_id' : id, 'default_res_model': 'kettle.task', 'start_date' : time.strftime('%d-%m-%Y %H:%M:%S')}) log_file_name = 'TASK LOG ' + co... |
self.pool.get('kettle.transformation').execute_transformation(cr, uid, id, log_file_name, attachment_id, context) | self.pool.get('kettle.transformation').execute_transformation(cr, uid, task['transformation_id'][0], log_file_name, attachment_id, context) | def start_kettle_task(self, cr, uid, ids, context=None): logger = netsvc.Logger() user = self.pool.get('res.users').browse(cr, uid, uid, context) for id in ids: context.update({'default_res_id' : id, 'default_res_model': 'kettle.task', 'start_date' : time.strftime('%d-%m-%Y %H:%M:%S')}) log_file_name = 'TASK LOG ' + co... |
self.attach_file_to_task(cr, uid, task['transformation_id'][0], context['input_filename'], '[FILE IN] FILE IMPORTED ' + context['start_date'], True, context) | self.attach_file_to_task(cr, uid, id, context['input_filename'], '[FILE IN] FILE IMPORTED ' + context['start_date'], True, context) | def start_kettle_task(self, cr, uid, ids, context=None): logger = netsvc.Logger() user = self.pool.get('res.users').browse(cr, uid, uid, context) for id in ids: context.update({'default_res_id' : id, 'default_res_model': 'kettle.task', 'start_date' : time.strftime('%d-%m-%Y %H:%M:%S')}) log_file_name = 'TASK LOG ' + co... |
required=True | required=False | def _total(self, cr, uid, ids, field_names, arg, context): res={} for line in self.browse(cr, uid, ids, context): res[line.id] = line.emp_deduction + line.comp_deduction return res |
ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('to','>=',value),('from','<=',value)]) | ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from_val','<=',value), ('to_val','>=',value)]) | def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.payslip.line.line') res = 0 ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('to','>=',value),('from','<=',value)]) if not ids: ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from','<=',value)]) if not ids: res =... |
ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from','<=',value)]) | ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from_val','<=',value)]) | def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.payslip.line.line') res = 0 ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('to','>=',value),('from','<=',value)]) if not ids: ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from','<=',value)]) if not ids: res =... |
res = 0 else: res = line_pool.browse(cr, uid, ids)[0].value | return 0 res = line_pool.browse(cr, uid, ids)[-1].value | def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.payslip.line.line') res = 0 ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('to','>=',value),('from','<=',value)]) if not ids: ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from','<=',value)]) if not ids: res =... |
'from': fields.float('From', digits=(16, int(config['price_accuracy']))), 'to': fields.float('To', digits=(16, int(config['price_accuracy']))), | 'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))), 'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))), | def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.payslip.line.line') res = 0 ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('to','>=',value),('from','<=',value)]) if not ids: ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from','<=',value)]) if not ids: res =... |
t = str(x[1]) | t = len(x) == 2 and str(x[1]) or '00' | def _get_decimal_value(self,amount): x = str(amount) x=x.split('.') t = str(x[1]) cir= ' '.join(map(lambda i : i , t)) return cir |
print "--- Enter List: ", list.name | def pline_doc_generate(self,cr, uid, ids, *args): "Genererates Documents (POs or Request fo Quotations) for Purchase Lines" plines = self.browse(cr, uid ,ids) | |
print result.keys() | def get_campaign_purchase_line_ids(self , cr, uid, ids, context): result = {} | |
fields['line_ids']['domain'] = ('id','in', line_ids) | fields['line_ids']['domain'] = [('id','in', line_ids)] | def _get_payment(self, cr, uid, data, context={}): pool = pooler.get_pool(cr.dbname) invoice = pool.get('account.invoice').browse(cr, uid, data['id'], context) if invoice.state in ['draft', 'proforma2', 'cancel']: raise wizard.except_wizard(_('Error !'), _('Can not Link payments if invoice is in draft/proforma/cancel')... |
site_id = self.pool.get('cci_mission.embassy_folder_line').browse(cr, uid, ids)[0].folder_id.site_id | folder_line_id = self.pool.get('cci_missions.embassy_folder_line').browse(cr, uid, ids) site_id = folder_line_id and folder_line_id[0].folder_id and folder_line_id[0].folder_id.site_id or False | def write(self, cr, uid, ids, vals, *args, **kwargs): site_id = self.pool.get('cci_mission.embassy_folder_line').browse(cr, uid, ids)[0].folder_id.site_id if vals.has_key('type'): prod_name = vals['type'] + str(' Product ') + site_id.name cr.execute('select id from product_template where name='"'%s'"''%str(prod_name)) ... |
prod_name = vals['type'] + str(' Product ') + site_id.name | prod_name = vals['type'] + str(' Product ') + (site_id and site_id.name or '') | def write(self, cr, uid, ids, vals, *args, **kwargs): site_id = self.pool.get('cci_mission.embassy_folder_line').browse(cr, uid, ids)[0].folder_id.site_id if vals.has_key('type'): prod_name = vals['type'] + str(' Product ') + site_id.name cr.execute('select id from product_template where name='"'%s'"''%str(prod_name)) ... |
cr.execute(query, (account.parent_left, account.parent_right, account.parent_left, account.parent_right, account.id)) | cr.execute(query, (account.parent_left or 0, account.parent_right or 0, account.parent_left or 0, account.parent_right or 0, account.id)) | def _check_parent_of_children(self, cr, uid, account, problems=[], context=None): """ Checks that for a parent account, every children has that account as its parent. """ query = """ SELECT id FROM account_account WHERE parent_left > %s and parent_right < %s AND COALESCE(parent_id,0) NOT IN (SELECT id FROM account_acco... |
cr.execute(query, (account.parent_left, account.parent_right)) | cr.execute(query, (account.parent_left or 0, account.parent_right or 0)) | def _check_child_of_parent(self, cr, uid, account, problems=[], context=None): """ Checks that for a child account, his parent has that account in its children. """ query = """ SELECT id FROM account_account WHERE parent_left < %s and parent_right > %s """ cr.execute(query, (account.parent_left, account.parent_right)) ... |
partner_category_obj = pooler.get_pool(self.cr.dbname).get('res.partner.category') if data['form']['category'] == 'Customer' or data['form']['category'] == 'Supplier' : cat_id=partner_category_obj.search(self.cr,self.uid,[('name','=',data['form']['category'])]) cat_id+=partner_category_obj.search(self.cr,self.uid,[('pa... | def set_context(self, objects, data, ids, report_type = None): partner_category_obj = pooler.get_pool(self.cr.dbname).get('res.partner.category') if data['form']['category'] == 'Customer' or data['form']['category'] == 'Supplier' : cat_id=partner_category_obj.search(self.cr,self.uid,[('name','=',data['form']['category'... | |
self.cr.execute('SELECT DISTINCT line.partner_id ' \ 'FROM account_move_line AS line, account_account AS account ' \ 'WHERE line.partner_id IS NOT NULL ' \ 'AND line.date >= %s ' \ 'AND line.date <= %s ' \ 'AND ' + line_query + ' ' \ 'AND line.account_id = account.id ' \ 'AND account.company_id = %s ' \ "AND partner_id... | def set_context(self, objects, data, ids, report_type = None): partner_category_obj = pooler.get_pool(self.cr.dbname).get('res.partner.category') if data['form']['category'] == 'Customer' or data['form']['category'] == 'Supplier' : cat_id=partner_category_obj.search(self.cr,self.uid,[('name','=',data['form']['category'... | |
"WHERE partner_id IN (" + self.partner_ids + ") " \ "AND account_id IN (" + self.account_ids + ") " \ | "WHERE " "account_id IN (" + self.account_ids + ") " \ "AND partner_id is not null " \ | def lines(self): if not self.partner_ids: return [] account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='l', context={'fiscalyear': self.datas['form']['fiscalyear']}) self.cr.execute( "SELECT p.ref, p.name, sum(debit) as d... |
'WHERE partner_id IN (' + self.partner_ids + ') ' \ 'AND account_id IN (' + self.account_ids + ') ' \ | 'WHERE ' \ 'account_id IN (' + self.account_ids + ') ' \ "AND partner_id is not null " \ | def _sum_debit(self): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='account_move_line', context={'fiscalyear': self.datas['form']['fiscalyear']}) self.cr.execute( 'SELECT sum(debit) ' \ '... |
'WHERE partner_id IN (' + self.partner_ids + ') ' \ 'AND account_id IN (' + self.account_ids + ') ' \ | 'WHERE ' 'account_id IN (' + self.account_ids + ') ' \ "AND partner_id is not null " \ | def _sum_credit(self): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='account_move_line', context={'fiscalyear': self.datas['form']['fiscalyear']}) self.cr.execute( 'SELECT sum(credit) ' \... |
'WHERE partner_id IN (' + self.partner_ids + ') ' \ 'AND account_id IN (' + self.account_ids + ') ' \ | 'WHERE ' \ 'account_id IN (' + self.account_ids + ') ' \ "AND partner_id is not null " \ | def _sum_litige(self): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='account_move_line', context={'fiscalyear': self.datas['form']['fiscalyear']}) self.cr.execute( 'SELECT sum(debit-credi... |
'WHERE partner_id IN (' + self.partner_ids + ') ' \ 'AND account_id IN (' + self.account_ids + ') ' \ | 'WHERE ' \ 'account_id IN (' + self.account_ids + ') ' \ "AND partner_id is not null " \ | def _sum_sdebit(self): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='account_move_line', context={'fiscalyear': self.datas['form']['fiscalyear']}) self.cr.execute( 'SELECT CASE WHEN sum(d... |
'WHERE partner_id IN (' + self.partner_ids + ') ' \ 'AND account_id IN (' + self.account_ids + ') ' \ | 'WHERE ' 'account_id IN (' + self.account_ids + ') ' \ "AND partner_id is not null " \ | def _sum_scredit(self): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='account_move_line', context={'fiscalyear': self.datas['form']['fiscalyear']}) self.cr.execute( 'SELECT CASE WHEN sum(... |
contract_ids = contract_obj.search(cr, uid, [('working_hours_per_day_id', '=', group_id)]) | contract_ids = contract_obj.search(cr, uid, [('working_hours', '=', group_id)]) | def action_create(self, cr, uid, ids, context=None): data = {} objs = [] value = {} my_dict = {} bjs = [] contract_obj = self.pool.get('hr.contract') evaluation_obj = self.browse(cr, uid, ids, context = context)[0] group_id = evaluation_obj.hr_timesheet_group_id.id contract_ids = contract_obj.search(cr, uid, [('working... |
'name': inv['name'] or '/', | 'name': linename or '/', | def action_move_create(self, cr, uid, ids, context=None): flag = membership_flag = False product_ids = [] move_obj = self.pool.get('account.move') move_line_obj = self.pool.get('account.move.line') data_invoice = self.browse(cr,uid,ids[0]) #raise an error if one of the account_invoice_line doesn't have an analytic entr... |
for i in line: i[2]['period_id'] = inv.period_id.id | def action_move_create(self, cr, uid, ids, context=None): flag = membership_flag = False product_ids = [] move_obj = self.pool.get('account.move') move_line_obj = self.pool.get('account.move.line') data_invoice = self.browse(cr,uid,ids[0]) #raise an error if one of the account_invoice_line doesn't have an analytic entr... | |
{'name': data['form']['group']}) | {'name': data['form']['new_group']}) | def _new_group(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) group_id = pool.get('dm.campaign.group').create(cr, uid, {'name': data['form']['group']}) context['group_id'] = group_id self._add_group(cr, uid, data, context) return {} |
'group': {'string': 'Group Name', 'type': 'char', | 'new_group': {'string': 'Group Name', 'type': 'char', | def _next(self, cr, uid, data, context): if not data['form']['group']: return 'error' return 'add' |
v1['id_creditor']= id_creditor[-10:] | v1['id_creditor']= '0' + id_creditor[-10:] | def _create_file(self, cr, uid, data, context): v1 = {} v2 = {} v3 = {} log='' log = Log() blank_space = ' ' seq = 0 inv_seq = 0 total = 0 inv_total = 0 invoice_data = '' pool = pooler.get_pool(cr.dbname) partner_obj = pool.get('res.partner') bank_obj = pool.get('res.partner.bank') invoice_obj = pool.get('account.inv... |
v1['id_sender']= id_sender[-10:] | v1['id_sender']= '0' + id_sender[-10:] | def _create_file(self, cr, uid, data, context): v1 = {} v2 = {} v3 = {} log='' log = Log() blank_space = ' ' seq = 0 inv_seq = 0 total = 0 inv_total = 0 invoice_data = '' pool = pooler.get_pool(cr.dbname) partner_obj = pool.get('res.partner') bank_obj = pool.get('res.partner.bank') invoice_obj = pool.get('account.inv... |
if report_data in ('plugin_error','plugin_missing','wrong_report_type') : | if report_data in ('plugin_error','plugin_missing','wrong_report_type','no_report_for_document') : | def generate_report(cr, uid, obj_id, file_type, report_type, context): pool = pooler.get_pool(cr.dbname) obj = pool.get('dm.campaign.document').browse(cr, uid, obj_id) message = [] if obj.mail_service_id.store_document: ir_att_obj = pool.get('ir.attachment') ir_att_ids = ir_att_obj.search(cr, uid, [('res_model', '=', '... |
partner_id= partner_id[0] user_id=user_id[0] | partner_id=partner_id and partner_id[0] or False user_id=user_id and user_id[0] or False | def _find_project_bug(self, cr, uid,lp_server=None,context={}): pool=pooler.get_pool(cr.dbname) case_stage= pool.get('crm.case.stage') categ_fix_id=case_stage.search(cr, uid, [('object_id.model','=','crm.project.bug'),('name','=','Fixed')])[0] categ_inv_id=case_stage.search(cr, uid, [('object_id.model','=','crm.project... |
invoice_id = self.pool.get('stock.picking').action_invoice_create(cr, uid, order.picking_ids) | invoice_id = self.pool.get('stock.picking').action_invoice_create(cr, uid, [picking.id for picking in order.picking_ids]) | def oe_status(self, cr, uid, order_id, paid = True, context = None): wf_service = netsvc.LocalService("workflow") order = self.browse(cr, uid, order_id, context) payment_settings = self.payment_code_to_payment_settings(cr, uid, order.ext_payment_method, context) if payment_settings: if payment_settings.check_if_paid a... |
'online': fields.boolean('Visible on website'), | def _uniq(seq): keys = {} for e in seq: keys[e] = 1 return keys.keys() | |
self.write(cr, uid, wi_id, {'state': 'error', | self.pool.get('dm.workitem').write(cr, uid, wi_id, {'state': 'error', | def _sale_order_process(self, cr, uid, sale_order_id): so = self.pool.get('sale.order').browse(cr, uid, sale_order_id) wf_service = netsvc.LocalService('workflow') |
msg = self._set_error(cr, uid, self.server[serverid]['id']) if (not self.server[serverid]['code'] and msg!='server_not_confirm') or (self.server[serverid]['code'] and msg in error_msg.keys()) : pooler.get_pool(cr.dbname).get('email.smtpclient.history').create \ (cr, uid, {'date_create':time.strftime('%Y-%m-%d %H:%M:%... | def test_verify_email(self, cr, uid, ids, toemail, test=False, code=False): serverid = ids[0] self.open_connection(cr, uid, ids, serverid) msg = self._set_error(cr, uid, self.server[serverid]['id']) | |
msg= self._set_error(cr, uid, email.server_id.id, context) if msg in error_msg.keys(): queue.write(cr, uid, [email.id], {'error':error_msg[msg], 'state':'error'}) continue else: self.smtpServer[email.server_id.id].sendmail(str(email.server_id.email), email.to, tools.ustr(email.serialized_message)) | self.smtpServer[email.server_id.id].sendmail(str(email.server_id.email), email.to, tools.ustr(email.serialized_message)) | def _send_emails(self, cr, uid, ids, context={}): fp = os.popen('ping www.google.com -c 1 -w 5',"r") if not fp.read(): return False queue = self.pool.get('email.smtpclient.queue') history = self.pool.get('email.smtpclient.history') queue.write(cr, uid, ids, {'state':'sending'}) error = [] sent = [] remove = [] open_se... |
self.filter_invoices(ininv, self.in_invoices, data['form'].get('order_by')) self.filter_invoices(outinv, self.out_invoices, data['form'].get('order_by')) self.filter_invoices(inref, self.in_refunds, data['form'].get('order_by')) self.filter_invoices(outref, self.out_refunds, data['form'].get('order_by')) | order_by = data.get('form') and data.get('form').get('order_by') or None self.filter_invoices(ininv, self.in_invoices, order_by) self.filter_invoices(outinv, self.out_invoices, order_by) self.filter_invoices(inref, self.in_refunds, order_by) self.filter_invoices(outref, self.out_refunds, order_by) | def set_context(self, objects, data, ids, report_type = None): """We do the grouping and proccessing of invoices""" invoice_obj = self.pool.get('account.invoice') |
def filter_invoices(self, list, dest, order_by='number'): | def filter_invoices(self, list, dest, order_by=None): | def filter_invoices(self, list, dest, order_by='number'): if not list : return tmp = {} # # Sort by invoice "number", "date + number" or "partner + reference" # if order_by=='date': list.sort(key=lambda inv: "%s_%s" % (inv.date_invoice, inv.number)) elif order_by=='partner': list.sort(key=lambda inv: "%s_%s" % (inv.par... |
else: | elif order_by=='number': | def filter_invoices(self, list, dest, order_by='number'): if not list : return tmp = {} # # Sort by invoice "number", "date + number" or "partner + reference" # if order_by=='date': list.sort(key=lambda inv: "%s_%s" % (inv.date_invoice, inv.number)) elif order_by=='partner': list.sort(key=lambda inv: "%s_%s" % (inv.par... |
city = post_code = address = False | city = post_code = address = country_code = '' | def _get_default_ad(self, addresses): city = post_code = address = False for ads in addresses: if ads.type == 'default': if ads.zip_id: city = ads.zip_id.city post_code = ads.zip_id.name if ads.street: address = ads.street if ads.street2: address += ads.street2 return city, post_code, address |
return city, post_code, address | if ads.country_id: country_code = ads.country_id.code return city, post_code, address, country_code | def _get_default_ad(self, addresses): city = post_code = address = False for ads in addresses: if ads.type == 'default': if ads.zip_id: city = ads.zip_id.city post_code = ads.zip_id.name if ads.street: address = ads.street if ads.street2: address += ads.street2 return city, post_code, address |
def get_campaings(self, cr, uid, context): document_id = self.dm_wiz_data['id'] pool = pooler.get_pool(cr.dbname) seg_obj = pool.get('dm.campaign.proposition.segment') seg_ids = seg_obj.search(cr, uid, []) seg_codes = seg_obj.read(cr, uid, seg_ids, ['code']) return [(item['id'], item['code']) for item in seg_codes] | def get_campaings(self, cr, uid, context): document_id = self.dm_wiz_data['id'] pool = pooler.get_pool(cr.dbname) seg_obj = pool.get('dm.campaign.proposition.segment') seg_ids = seg_obj.search(cr, uid, []) seg_codes = seg_obj.read(cr, uid, seg_ids, ['code']) return [(item['id'], item['code']) for item in seg_codes] | |
'segment_id': {'string': 'Select Segment', 'type': 'selection', 'selection': get_campaings,} | 'segment_id': {'string': 'Select Segment', 'type': 'many2one', 'relation': 'dm.campaign.proposition.segment',} | def get_campaings(self, cr, uid, context): document_id = self.dm_wiz_data['id'] pool = pooler.get_pool(cr.dbname) seg_obj = pool.get('dm.campaign.proposition.segment') seg_ids = seg_obj.search(cr, uid, []) seg_codes = seg_obj.read(cr, uid, seg_ids, ['code']) return [(item['id'], item['code']) for item in seg_codes] |
cr.commit() cr.close() | def rmdir(self, node): try: cr = pooler.get_db(node.context.dbname).cursor() uid = node.context.uid pool = pooler.get_pool(node.context.dbname) if isinstance(node, node_res_obj): object2 = node and pool.get(node.context.context['res_model']).browse(cr, uid, node.context.context['res_id']) or False obj = node.context._... | |
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False,company_id=False, partner_bank_id=False ): | def onchange_partner_id(self, cr, uid, ids, type, partner_id,\ date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False,company_id=False, partner_bank_id=False ): |
result = super(account_invoice, self).onchange_partner_id(cr,uid,ids,type,partner_id,date_invoice,payment_term,partner_bank_id) | result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank_id, company_id) | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False,company_id=False, partner_bank_id=False ): |
def onchange_company_id(self, cr, uid, ids, cpy_id, ptn_id, ptn_invoice_id): | def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id, ptn_invoice_id): | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False,company_id=False, partner_bank_id=False ): |
result = {'value': {'fiscal_position': False}} | result = super(account_invoice, self).onchange_company_id(cr, uid, ids, company_id, part_id, type, invoice_line, currency_id) | def onchange_company_id(self, cr, uid, ids, cpy_id, ptn_id, ptn_invoice_id): result = {'value': {'fiscal_position': False}} if not ptn_id or not cpy_id or not ptn_invoice_id: return result if result['value']['fiscal_position']: return result obj_company = self.pool.get('res.company').browse(cr, uid, [cpy_id])[0] c... |
if not ptn_id or not cpy_id or not ptn_invoice_id: | if not part_id or not company_id or not ptn_invoice_id: | def onchange_company_id(self, cr, uid, ids, cpy_id, ptn_id, ptn_invoice_id): result = {'value': {'fiscal_position': False}} if not ptn_id or not cpy_id or not ptn_invoice_id: return result if result['value']['fiscal_position']: return result obj_company = self.pool.get('res.company').browse(cr, uid, [cpy_id])[0] c... |
if result['value']['fiscal_position']: return result obj_company = self.pool.get('res.company').browse(cr, uid, [cpy_id])[0] | obj_company = self.pool.get('res.company').browse(cr, uid, [company_id])[0] | def onchange_company_id(self, cr, uid, ids, cpy_id, ptn_id, ptn_invoice_id): result = {'value': {'fiscal_position': False}} if not ptn_id or not cpy_id or not ptn_invoice_id: return result if result['value']['fiscal_position']: return result obj_company = self.pool.get('res.company').browse(cr, uid, [cpy_id])[0] c... |
fsc_pos_id = self.pool.get('account.fiscal.position.rule').search(cr, uid, [('company_id','=', cpy_id), ('from_country','=',from_country),('from_state','=',from_state),('to_country','=',to_country),('to_state','=',to_state),('use_invoice','=',True)]) | fsc_pos_id = self.pool.get('account.fiscal.position.rule').search(cr, uid, [('company_id','=', company_id), ('from_country','=',from_country),('from_state','=',from_state),('to_country','=',to_country),('to_state','=',to_state),('use_invoice','=',True)]) | def onchange_company_id(self, cr, uid, ids, cpy_id, ptn_id, ptn_invoice_id): result = {'value': {'fiscal_position': False}} if not ptn_id or not cpy_id or not ptn_invoice_id: return result if result['value']['fiscal_position']: return result obj_company = self.pool.get('res.company').browse(cr, uid, [cpy_id])[0] c... |
'product_qty': -bom_id.product_qty, | 'product_qty': bom_id.product_qty, | def do_reverse(self, cr, uid, ids, context={}): """ To check the product type @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ bom_obj = self.pool.get... |
'product_qty' : line.product_qty, | 'product_qty' : -line.product_qty, | def do_reverse(self, cr, uid, ids, context={}): """ To check the product type @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ bom_obj = self.pool.get... |
'product_uos_qty': line.product_uos_qty, | 'product_uos_qty': -line.product_uos_qty, | def do_reverse(self, cr, uid, ids, context={}): """ To check the product type @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ bom_obj = self.pool.get... |
bank_statement_lines[line[2:6] + st_line['name']]=st_line | bank_statement_lines[line[2:6]]=st_line | def _coda_parsing(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) codafile = data['form']['coda'] jur_id = data['form']['journal_id'] def_pay_acc = data['form']['def_payable'] def_rec_acc = data['form']['def_receivable'] str_log = "" err_log = "Errors:\n------\n" nb_err=0 std_log='' str_log1 = "Coda F... |
st_line_name = line[2:6] + st_line['name'] | st_line_name = line[2:6] | def _coda_parsing(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) codafile = data['form']['coda'] jur_id = data['form']['journal_id'] def_pay_acc = data['form']['def_payable'] def_rec_acc = data['form']['def_receivable'] str_log = "" err_log = "Errors:\n------\n" nb_err=0 std_log='' str_log1 = "Coda F... |
pass | if line[1] == '1': st_line_name = line[2:6] bank_statement_lines[st_line_name]['extra_note'] += line[40:113] elif line[1] == '2': st_line_name = line[2:6] bank_statement_lines[st_line_name]['extra_note'] += line[10:115] elif line[1] == '3': st_line_name = line[2:6] bank_statement_lines[st_line_name]['extra_note'] += li... | def _coda_parsing(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) codafile = data['form']['coda'] jur_id = data['form']['journal_id'] def_pay_acc = data['form']['def_payable'] def_rec_acc = data['form']['def_receivable'] str_log = "" err_log = "Errors:\n------\n" nb_err=0 std_log='' str_log1 = "Coda F... |
str_not1="Partner name:%s \n Partner Account Number:%s \n Communication:%s \n Value Date:%s \n Entry Date:%s \n"%(line["contry_name"],line["cntry_number"],line["free_comm"],line["val_date"][0],line["entry_date"][0]) | str_not1="Partner name:%s \n Partner Account Number:%s \n Communication:%s \n Value Date:%s \n Entry Date:%s \n"%(line["contry_name"],line["cntry_number"],line["free_comm"]+line['extra_note'],line["val_date"][0],line["entry_date"][0]) | def _coda_parsing(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) codafile = data['form']['coda'] jur_id = data['form']['journal_id'] def_pay_acc = data['form']['def_payable'] def_rec_acc = data['form']['def_receivable'] str_log = "" err_log = "Errors:\n------\n" nb_err=0 std_log='' str_log1 = "Coda F... |
_record_separator = '\n\b' | _record_separator = '\n\r' | def lengthmonth(year, month): if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))): return 29 return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] |
fields.append( certificate.digital_number or (certificate.type_id.id_letter + certificate.name.rpartition('/')[2].rjust(6,'0')) ) | fields.append( certificate.digital_number and str(int(certificate.digital_number)) or (certificate.type_id.id_letter + certificate.name.rpartition('/')[0].rpartition('/')[2] + certificate.name.rpartition('/')[2].rjust(6,'0')) ) | def make_lines(self,cr,uid,res_file, data): lines=[] |
fields.append( 'N' ) | fields.append( 'Y' ) | def make_lines(self,cr,uid,res_file, data): lines=[] |
origins_string += country_code.name + self._field_separator | origins_string += country_code.code + self._field_separator | def make_lines(self,cr,uid,res_file, data): lines=[] |
tran_obj.write(cr, uid, trans.id, {'value': value, 'need_review': False}) | tran_obj.write(cr, uid, [trans.id], {'value': value, 'need_review': False}) | def _translate(self, cr, uid, data, context={}): # Todo: # 1. should work for all language (arabic) # 2. test for all browser (xp,linux..) pool = pooler.get_pool(cr.dbname) tran_obj = pool.get('ir.translation') in_lang = 'en' ids = data['ids'] translation_data = tran_obj.browse(cr, uid, ids, context) for trans in... |
logger.notifyChannel('extdata_from_oevals', netsvc.DEBUG, "Error in import mapping: %r" % (each_mapping_line['out_function'],)) | logger.notifyChannel('extdata_from_oevals', netsvc.LOG_DEBUG, "Error in import mapping: %r" % (each_mapping_line['out_function'],)) | def extdata_from_oevals(self, cr, uid, external_referential_id, data_record, mapping_lines, defaults, context=None): if context is None: context = {} vals = {} #Dictionary for record for each_mapping_line in mapping_lines: #Build the space for expr space = { 'self':self, 'cr':cr, 'uid':uid, 'external_referential_id':ex... |
logger.notifyChannel('extdata_from_oevals', netsvc.DEBUG, "Mapping Context: %r" % (space,)) logger.notifyChannel('extdata_from_oevals', netsvc.DEBUG, "Exception: %r" % (e,)) | logger.notifyChannel('extdata_from_oevals', netsvc.LOG_DEBUG, "Mapping Context: %r" % (space,)) logger.notifyChannel('extdata_from_oevals', netsvc.LOG_DEBUG, "Exception: %r" % (e,)) | def extdata_from_oevals(self, cr, uid, external_referential_id, data_record, mapping_lines, defaults, context=None): if context is None: context = {} vals = {} #Dictionary for record for each_mapping_line in mapping_lines: #Build the space for expr space = { 'self':self, 'cr':cr, 'uid':uid, 'external_referential_id':ex... |
for record_data in self.read(cr, uid, ids, [], context): | for record_data in self.read_w_order(cr, uid, ids, [], context): | def ext_export(self, cr, uid, ids, external_referential_ids=[], defaults={}, context=None): if context is None: context = {} #external_referential_ids has to be a list logger = netsvc.Logger() write_ids = [] #Will record ids of records modified, not sure if will be used create_ids = [] #Will record ids of newly create... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.