rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
order_by_elements.append("%s %s" % (inner_clause, order_direction))
if isinstance(inner_clause, list): for clause in inner_clause: order_by_elements.append("%s %s" % (clause, order_direction)) else: order_by_elements.append("%s %s" % (inner_clause, order_direction))
def _generate_order_by(self, order_spec, query): """ Attempt to consruct an appropriate ORDER BY clause based on order_spec, which must be a comma-separated list of valid field names, optionally followed by an ASC or DESC direction.
field_search[2] = "'%"+str(search_value)+"%'"
field_search[2] = "'%%"+str(search_value)+"%%'"
def set_field_operator(self,field_name,field_type,search_operator,search_value): field_search = [field_name,search_operator,search_value] if search_operator == '=': if field_type=='many2one': field_search[1]='in' field_search[2] = "("+','.join([str(x) for x in search_value])+")" elif field_type in char_type or field_ty...
basic_alarm = meeting.alarm_id
def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') model_id = model_obj.search(cr, uid, [('model', '=', self._name)])[0]
cr.execute('Update crm_meeting set caldav_alarm_id=%s \ where id=%s' % (alarm_id, meeting.id))
cr.execute('Update crm_meeting set caldav_alarm_id=%s, \ alarm_id=%s where id=%s' % (alarm_id, basic_alarm.id, meeting.id))
def do_alarm_create(self, cr, uid, ids, context={}): alarm_obj = self.pool.get('calendar.alarm') model_obj = self.pool.get('ir.model') model_id = model_obj.search(cr, uid, [('model', '=', self._name)])[0]
self.do_alarm_create(cr, uid, new_ids)
if vals.get('alarm_id'): self.do_alarm_create(cr, uid, new_ids)
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) res = super(crm_meeting, self).write(cr, uid, new_ids, vals,...
resource_id = len(resource_ids) or resource_ids[0]
if len(resource_ids): resource_id = resource_ids[0]
def _compute_day(self, cr, uid, ids, fields, args, 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 va...
tsk.remaining_hours as remaining_hours
tsk.remaining_hours as remaining_hours, tsk.date_end as date_close
def init(self, cr): cr.execute(''' create or replace view report_closed_task as ( select tsk.id as id, tsk.sequence as sequence, tsk.name as name, tsk.project_id as project_id, tsk.user_id as user_id, tsk.date_deadline as date_deadline, tsk.planned_hours as planned_hours, tsk.delay_hours as delay_hours, tsk.progress as...
where (tsk.date_end <= CURRENT_DATE AND tsk.date_end > (CURRENT_DATE-15))
def init(self, cr): cr.execute(''' create or replace view report_closed_task as ( select tsk.id as id, tsk.sequence as sequence, tsk.name as name, tsk.project_id as project_id, tsk.user_id as user_id, tsk.date_deadline as date_deadline, tsk.planned_hours as planned_hours, tsk.delay_hours as delay_hours, tsk.progress as...
message = type_list.get(vals.get('type',_('Picking'))) + " '" + vals['name'] + "' "+ _("created.")
message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + "' "+ _("created.")
def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking') type_list = { 'out':_('Packing List'), 'in':_('Reception'), 'internal': _('Internal picking'), 'delivery': _('Delivery order') } if not vals.get(...
message = type_list.get(pick.type, _('Document')) + " '" + pick.name + "' "+ _("is ready to be processed.")
message = type_list.get(pick.type, _('Document')) + " '" + (pick.name or 'n/a') + "' "+ _("is ready to be processed.")
def action_assign_wkf(self, cr, uid, ids, context=None): for pick in self.browse(cr, uid, ids, context=context): type_list = { 'out':'Packing List', 'in':'Reception', 'internal': 'Internal picking', 'delivery': 'Delivery order' } message = type_list.get(pick.type, _('Document')) + " '" + pick.name + "' "+ _("is ready t...
html = soup.__str__()
html = unicode(soup)
def html2plaintext(html, body_id=None, encoding='utf-8'): ## (c) Fry-IT, www.fry-it.com, 2007 ## <peter@fry-it.com> ## download here: http://www.peterbe.com/plog/html2plaintext """ from an HTML text, convert the HTML to plain text. If @body_id is provided then this is the tag where the body (not necessarily <body>) s...
"SELECT '1' as type, '' as ref, '' as account_id, '' as account_name, '' as code, '' as name, sum(debit) as debit, sum(credit) as credit, " \
"SELECT '1' as type, '' as ref, l.account_id as account_id, '' as account_name, '' as code, '' as name, sum(debit) as debit, sum(credit) as credit, " \
def lines(self, data): full_account = [] result_tmp = 0.0 if self.date_lst: self.cr.execute( "SELECT p.ref,l.account_id,ac.name as account_name,ac.code as code ,p.name, sum(debit) as debit, sum(credit) as credit, " \ "CASE WHEN sum(debit) > sum(credit) " \ "THEN sum(debit) - sum(credit) " \ "ELSE 0 " \ "END AS sdebit, ...
debit += r['debit'] credit += r['credit'] res_init['credit'] = credit res_init['debit'] = debit res_init['type'] = 3 res_init['ref'] = '' res_init['code'] = '' res_init['name'] = 'Initial Balance' res_init['balance'] = debit - credit res_init['enlitige'] = 0.0
if final_init.get(r['account_id'], False): res_init = final_init[r['account_id']] debit += final_init[r['account_id']]['debit'] credit += final_init[r['account_id']]['credit'] res_init['credit'] = credit res_init['debit'] = debit res_init['type'] = 3 res_init['ref'] = '' res_init['code'] = '' res_init['name'] = 'Initia...
def lines(self, data): full_account = [] result_tmp = 0.0 if self.date_lst: self.cr.execute( "SELECT p.ref,l.account_id,ac.name as account_name,ac.code as code ,p.name, sum(debit) as debit, sum(credit) as credit, " \ "CASE WHEN sum(debit) > sum(credit) " \ "THEN sum(debit) - sum(credit) " \ "ELSE 0 " \ "END AS sdebit, ...
if self.soldeinit: subtotal_row.insert(0, res_init) return subtotal_row
if not self.soldeinit: return subtotal_row subtotal = copy.deepcopy(subtotal_row) init_acnt = [] for row in subtotal_row: if final_init and row.get('account_id', False) and not row['account_id'] in init_acnt: subtotal.insert(subtotal.index(row), final_init[row['account_id']]) init_acnt.append(row['account_id']) retur...
def lines(self, data): full_account = [] result_tmp = 0.0 if self.date_lst: self.cr.execute( "SELECT p.ref,l.account_id,ac.name as account_name,ac.code as code ,p.name, sum(debit) as debit, sum(credit) as credit, " \ "CASE WHEN sum(debit) > sum(credit) " \ "THEN sum(debit) - sum(credit) " \ "ELSE 0 " \ "END AS sdebit, ...
if self.soldeinit: date_init = (datetime.datetime.strptime(self.date_lst[0], "%Y-%m-%d") + timedelta(days=-1)).strftime('%Y-%m-%d') self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date < %s", (tuple(self.account_ids), date_init,)) temp_res += float(self.cr.fe...
def _sum_debit(self, data): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(sel...
if self.soldeinit: date_init = (datetime.datetime.strptime(self.date_lst[0], "%Y-%m-%d") + timedelta(days=-1)).strftime('%Y-%m-%d') self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date < %s", (tuple(self.account_ids), date_init,)) temp_res += float(self.cr.f...
def _sum_credit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] o...
if self.soldeinit: date_init = (datetime.datetime.strptime(self.date_lst[0], "%Y-%m-%d") + timedelta(days=-1)).strftime('%Y-%m-%d') self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date < %s", (tuple(self.account_ids), date_init,)) temp_res += float(sel...
def _sum_litige(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res ...
'type_id': fields.many2one ('project.task.type', 'Resolution', domain="[('object_id.model', '=', 'project.issue')]"),
'type_id': fields.many2one ('project.task.type', 'Resolution'),
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 st...
'account_collected_id': acc_template_ref[value['account_collected_id']], 'account_paid_id': acc_template_ref[value['account_paid_id']],
'account_collected_id': acc_template_ref.get(value['account_collected_id'], False), 'account_paid_id': acc_template_ref.get(value['account_paid_id'], False),
def execute(self, cr, uid, ids, context=None): obj_multi = self.browse(cr, uid, ids[0]) obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.templ...
domain = domain + ['|',('date_maturity','<',search_due_date),('date_maturity','=',False)]
domain = domain + ['|',('date_maturity','<=',search_due_date),('date_maturity','=',False)]
def search_entries(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line') mod_obj = self.pool.get('ir.model.data')
class mail_server(osv.osv):
class email_server(osv.osv):
def desperate_fixer(g): #print >>sys.stderr, "failed to clean up %s" % str(g.group()) return ' '
if server.type == 'imap': imap_server = None if server.is_ssl: imap_server = IMAP4_SSL(server.server, int(server.port)) else: imap_server = IMAP4(server.server, int(server.port)) imap_server.login(server.user, server.password) imap_server.select() result, data = imap_server.search(None, '(UNSEEN)') for num in data[0]....
try: if server.type == 'imap': imap_server = None if server.is_ssl: imap_server = IMAP4_SSL(server.server, int(server.port)) else: imap_server = IMAP4(server.server, int(server.port)) imap_server.login(server.user, server.password) imap_server.select() result, data = imap_server.search(None, '(UNSEEN)') for num in dat...
def fetch_mail(self, cr, uid, ids, context={}): fp = os.popen('ping www.google.com -c 1 -w 5',"r") if not fp.read(): logger.notifyChannel('imap', netsvc.LOG_WARNING, 'No address associated with hostname !')
mail_server()
email_server()
def fetch_mail(self, cr, uid, ids, context={}): fp = os.popen('ping www.google.com -c 1 -w 5',"r") if not fp.read(): logger.notifyChannel('imap', netsvc.LOG_WARNING, 'No address associated with hostname !')
all_journal = []
all_journal = [None]
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result fld = [] fields = {} flds = [] title = self.view_header_...
fields[field.field] = [journal.id]
fields[field.field] = [None, journal.id]
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result fld = [] fields = {} flds = [] title = self.view_header_...
if 'date_deadline' in val and 'duration' not in val:
if val.get('date_deadline', False) and 'duration' not in val:
def check_import(self, cr, uid, vals, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param vals: Get Values @param context: A standard dictionary for contextual values """ if not context: context = {} ids =...
'directory': fields.char('Directory',size=64,readonly=True), 'change_date': fields.datetime('Modified Date', readonly=True), 'file_size': fields.integer('File Size', readonly=True),
def init(self, cr): tools.drop_view_if_exists(cr, 'report_document_user') cr.execute(""" CREATE OR REPLACE VIEW report_document_user as ( SELECT min(f.id) as id, to_char(f.create_date, 'YYYY') as name, to_char(f.create_date, 'MM') as month, f.user_id as user_id, u.name as user, count(*) as nbr, d.name as directory, f.c...
'type':fields.char('Directory Type',size=64,readonly=True),
def init(self, cr): tools.drop_view_if_exists(cr, 'report_document_user') cr.execute(""" CREATE OR REPLACE VIEW report_document_user as ( SELECT min(f.id) as id, to_char(f.create_date, 'YYYY') as name, to_char(f.create_date, 'MM') as month, f.user_id as user_id, u.name as user, count(*) as nbr, d.name as directory, f.c...
'ean13': fields.char('EAN13', size=13),
'ean13': fields.char('EAN13', size=14),
def _product_partner_ref(self, cr, uid, ids, name, arg, context={}): res = {} for p in self.browse(cr, uid, ids, context): data = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context) if not data['variants']: data['variants'] = p.variants if not data['code']: data['code'] = p.code if not...
if len(partner.ean13) <> 13:
if len(partner.ean13) not in [13,14,8]:
def _check_ean_key(self, cr, uid, ids): for partner in self.browse(cr, uid, ids): if not partner.ean13: continue if len(partner.ean13) <> 13: return False try: int(partner.ean13) except: return False sum=0 for i in range(12): if is_pair(i): sum += int(partner.ean13[i]) else: sum += 3 * int(partner.ean13[i]) check = int...
sum=0 for i in range(12):
oddsum=0 evensum=0 total=0 eanvalue=partner.ean13 reversevalue = eanvalue[::-1] finalean=reversevalue[1:] for i in range(len(finalean)):
def _check_ean_key(self, cr, uid, ids): for partner in self.browse(cr, uid, ids): if not partner.ean13: continue if len(partner.ean13) <> 13: return False try: int(partner.ean13) except: return False sum=0 for i in range(12): if is_pair(i): sum += int(partner.ean13[i]) else: sum += 3 * int(partner.ean13[i]) check = int...
sum += int(partner.ean13[i])
oddsum += int(finalean[i])
def _check_ean_key(self, cr, uid, ids): for partner in self.browse(cr, uid, ids): if not partner.ean13: continue if len(partner.ean13) <> 13: return False try: int(partner.ean13) except: return False sum=0 for i in range(12): if is_pair(i): sum += int(partner.ean13[i]) else: sum += 3 * int(partner.ean13[i]) check = int...
sum += 3 * int(partner.ean13[i]) check = int(math.ceil(sum / 10.0) * 10 - sum) if check != int(partner.ean13[12]):
evensum += int(finalean[i]) total=(oddsum * 3) + evensum check = int(10 - math.ceil(total % 10.0)) if check != int(partner.ean13[-1]):
def _check_ean_key(self, cr, uid, ids): for partner in self.browse(cr, uid, ids): if not partner.ean13: continue if len(partner.ean13) <> 13: return False try: int(partner.ean13) except: return False sum=0 for i in range(12): if is_pair(i): sum += int(partner.ean13[i]) else: sum += 3 * int(partner.ean13[i]) check = int...
try: file_data = _to_unicode(fp.read()) finally: fp.close() return file_data
return _to_unicode(fp.read())
def _doIndexFile(self,fname): fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout try: file_data = _to_unicode(fp.read()) finally: fp.close() return file_data
try: file_data = _to_unicode( fp.read()) finally: fp.close() return file_data
return _to_unicode( fp.read())
def _doIndexFile(self,fname): fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout try: file_data = _to_unicode( fp.read()) finally: fp.close() return file_data
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)]) pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(partner_i...
property_obj = self.pool.get('ir.property') rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(partner_id)+''),('company_id','=',company_id)]) pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+s...
def onchange_partner_id(self, cr, uid, ids, type, partner_id,\ date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): invoice_addr_id = False contact_addr_id = False partner_payment_term = False acc_id = False bank_id = False fiscal_position = False
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)])
rec_pro_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_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): invoice_addr_id = False contact_addr_id = False partner_payment_term = False acc_id = False bank_id = False fiscal_position = False
pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = self.pool.get('ir.property').read(cr,uid,rec_pro_id,['name','value','res_id']) pay_line_data = self.pool.get('ir.property').read(cr,uid,pay_pro_id,['name','value','res_id'])
pay_pro_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = property_obj.read(cr,uid,rec_pro_id,['name','value','res_id']) pay_line_data = property_obj.read(cr,uid,pay_pro_id,['name','value','res_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): invoice_addr_id = False contact_addr_id = False partner_payment_term = False acc_id = False bank_id = False fiscal_position = False
rec_obj_acc=self.pool.get('account.account').browse(cr, uid, [rec_res_id]) pay_obj_acc=self.pool.get('account.account').browse(cr, uid, [pay_res_id])
account_obj = self.pool.get('account.account') rec_obj_acc = account_obj.browse(cr, uid, [rec_res_id]) pay_obj_acc = account_obj.browse(cr, uid, [pay_res_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): invoice_addr_id = False contact_addr_id = False partner_payment_term = False acc_id = False bank_id = False fiscal_position = False
rec_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) pay_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)...
property_obj = self.pool.get('ir.property') rec_pro_id = property_obj.search(cr, uid, [('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) pay_pro_id = property_obj.search(cr, uid, [('name','=','property_account_payable'),('res_id','=','res.partner,'+...
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val = {} dom = {} obj_journal = self.pool.get('account.journal') if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable...
rec_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_receivable'),('company_id','=',company_id)])
rec_pro_id = property_obj.search(cr, uid, [('name','=','property_account_receivable'),('company_id','=',company_id)])
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val = {} dom = {} obj_journal = self.pool.get('account.journal') if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable...
pay_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = self.pool.get('ir.property').read(cr, uid, rec_pro_id, ['name','value','res_id']) pay_line_data = self.pool.get('ir.property').read(cr, uid, pay_pro_id, ['name','value','res...
pay_pro_id = property_obj.search(cr, uid, [('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = property_obj.read(cr, uid, rec_pro_id, ['name','value','res_id']) pay_line_data = property_obj.read(cr, uid, pay_pro_id, ['name','value','res_id'])
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val = {} dom = {} obj_journal = self.pool.get('account.journal') if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable...
if not rec_res_id and not rec_res_id:
if not rec_res_id and not pay_res_id:
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val = {} dom = {} obj_journal = self.pool.get('account.journal') if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable...
result_id = self.pool.get('account.account').search(cr, uid, [('name','=',line.account_id.name),('company_id','=',company_id)])
result_id = account_obj.search(cr, uid, [('name','=',line.account_id.name),('company_id','=',company_id)])
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val = {} dom = {} obj_journal = self.pool.get('account.journal') if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable...
obj_l = self.pool.get('account.account').browse(cr, uid, inv_line[2]['account_id'])
obj_l = account_obj.browse(cr, uid, inv_line[2]['account_id'])
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val = {} dom = {} obj_journal = self.pool.get('account.journal') if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable...
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
fpos_obj = self.pool.get('account.fiscal.position') fpos = fposition_id and fpos_obj.browse(cr, uid, fposition_id) or False
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
in_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_income'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
property_obj = self.pool.get('ir.property') account_obj = self.pool.get('account.account') in_pro_id = property_obj.search(cr, uid, [('name','=','property_account_income'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
in_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_income_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)]) exp_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_expense'),('res_id','=','product.temp...
in_pro_id = property_obj.search(cr, uid, [('name','=','property_account_income_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)]) exp_pro_id = property_obj.search(cr, uid, [('name','=','property_account_expense'),('res_id','=','product.template,'+str(res.product_tmpl_id.i...
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
exp_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_expense_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
exp_pro_id = property_obj.search(cr, uid, [('name','=','property_account_expense_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
app_acc_in = self.pool.get('account.account').browse(cr, uid, in_pro_id)[0]
app_acc_in = account_obj.browse(cr, uid, in_pro_id)[0]
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
app_acc_exp = self.pool.get('account.account').browse(cr, uid, exp_pro_id)[0]
app_acc_exp = account_obj.browse(cr, uid, exp_pro_id)[0]
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
in_res_id=self.pool.get('account.account').search(cr, uid, [('name','=',app_acc_in.name),('company_id','=',company_id)]) exp_res_id=self.pool.get('account.account').search(cr, uid, [('name','=',app_acc_exp.name),('company_id','=',company_id)])
in_res_id = account_obj.search(cr, uid, [('name','=',app_acc_in.name),('company_id','=',company_id)]) exp_res_id = account_obj.search(cr, uid, [('name','=',app_acc_exp.name),('company_id','=',company_id)])
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
in_obj_acc=self.pool.get('account.account').browse(cr, uid, in_res_id) exp_obj_acc=self.pool.get('account.account').browse(cr, uid, exp_res_id)
in_obj_acc = account_obj.browse(cr, uid, in_res_id) exp_obj_acc = account_obj.browse(cr, uid, exp_res_id)
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
a = fpos_obj.map_account(cr, uid, fpos, a)
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
prod_pool=self.pool.get('product.product')
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
if not company_id and not currency_id:
if not company_id or not currency_id:
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): if context is None: context = {} company_id = context.get('company_id',False) if not partner_id: raise osv.excep...
if hasattr(res, 'section'):
if hasattr(res, 'section_id'):
def email_forward(self, cr, uid, model, res_ids, msg, email_error=False, context=None): """Sends an email to all people following the thread @param res_id: Id of the record of OpenObject model created from the email message @param msg: email.message.Message to forward @param email_error: Default Email address in case o...
msg['reply-to'] = res.section.email_from if not tools.misc._email_send(msg, openobject_id=res.id) and email_error:
msg['reply-to'] = res.section_id.reply_to smtp_from = self.to_email(msg['from']) if not tools.misc._email_send(smtp_from, message_forward, msg, openobject_id=res.id) and email_error:
def email_forward(self, cr, uid, model, res_ids, msg, email_error=False, context=None): """Sends an email to all people following the thread @param res_id: Id of the record of OpenObject model created from the email message @param msg: email.message.Message to forward @param email_error: Default Email address in case o...
tools.misc._email_send(msg, openobject_id=res.id)
tools.misc._email_send(smtp_from, self.to_email(email_error), msg, openobject_id=res.id)
def email_forward(self, cr, uid, model, res_ids, msg, email_error=False, context=None): """Sends an email to all people following the thread @param res_id: Id of the record of OpenObject model created from the email message @param msg: email.message.Message to forward @param email_error: Default Email address in case o...
if self.logo and (rml_head.find('company.logo')<0 or rml_head.find('<image')<0) and rml_head.find('<!--image')<0: rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="70" width="90" >[[company.logo]] </image> ''') if not self.logo and rml_head.find('company.logo')>=0: rml_head ...
def _add_header(self, rml_dom, header=1): if header==2: rml_head = self.rml_header2 else: rml_head = self.rml_header if self.logo and (rml_head.find('company.logo')<0 or rml_head.find('<image')<0) and rml_head.find('<!--image')<0: rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" ...
processed_rml = self.preprocess_rml(etree.XML(rml),report_xml.report_type)
processed_rml = etree.XML(rml)
def create_single_pdf(self, cr, uid, ids, data, report_xml, context=None): if not context: context={} logo = None context = context.copy() title = report_xml.name rml = report_xml.report_rml_content # if no rml file is found if not rml: return False rml_parser = self.parser(cr, uid, self.name2, context=context) objs = ...
rml_parser.set_context(objs, data, ids,report_xml.report_type)
rml_parser.set_context(objs, data, ids, mime_type)
def create_single_odt(self, cr, uid, ids, data, report_xml, context=None): if not context: context={} context = context.copy() report_type = report_xml.report_type context['parents'] = sxw_parents sxw_io = StringIO.StringIO(report_xml.report_sxw_content) sxw_z = zipfile.ZipFile(sxw_io, mode='r') rml = sxw_z.read('conte...
if report_type == 'odt':
if mime_type == 'odt':
def create_single_odt(self, cr, uid, ids, data, report_xml, context=None): if not context: context={} context = context.copy() report_type = report_xml.report_type context['parents'] = sxw_parents sxw_io = StringIO.StringIO(report_xml.report_sxw_content) sxw_z = zipfile.ZipFile(sxw_io, mode='r') rml = sxw_z.read('conte...
rml_dom = self.preprocess_rml(rml_dom,report_type) create_doc = self.generators[report_type]
rml_dom = self.preprocess_rml(rml_dom, mime_type) create_doc = self.generators[mime_type]
def create_single_odt(self, cr, uid, ids, data, report_xml, context=None): if not context: context={} context = context.copy() report_type = report_xml.report_type context['parents'] = sxw_parents sxw_io = StringIO.StringIO(report_xml.report_sxw_content) sxw_z = zipfile.ZipFile(sxw_io, mode='r') rml = sxw_z.read('conte...
return (final_op, report_type)
return (final_op, mime_type)
def create_single_odt(self, cr, uid, ids, data, report_xml, context=None): if not context: context={} context = context.copy() report_type = report_xml.report_type context['parents'] = sxw_parents sxw_io = StringIO.StringIO(report_xml.report_sxw_content) sxw_z = zipfile.ZipFile(sxw_io, mode='r') rml = sxw_z.read('conte...
if journal_id and company_id: company = self.pool.get('res.company').browse(cr, uid, company_id) journal_id = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal_id.currency:
if journal_id: journal = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal.currency:
def onchange_journal_id(self, cr, uid, ids, journal_id, company_id): result = {} if journal_id and company_id: company = self.pool.get('res.company').browse(cr, uid, company_id) journal_id = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal_id.currency: result = {'value': { 'currency_id': journal_...
'currency_id': journal_id.currency.id
'currency_id': journal.currency.id
def onchange_journal_id(self, cr, uid, ids, journal_id, company_id): result = {} if journal_id and company_id: company = self.pool.get('res.company').browse(cr, uid, company_id) journal_id = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal_id.currency: result = {'value': { 'currency_id': journal_...
else: result = {'value': { 'currency_id': company.currency_id.id
return result if company_id: company = self.pool.get('res.company').browse(cr, uid, company_id) result = {'value': { 'currency_id': company.currency_id.id
def onchange_journal_id(self, cr, uid, ids, journal_id, company_id): result = {} if journal_id and company_id: company = self.pool.get('res.company').browse(cr, uid, company_id) journal_id = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal_id.currency: result = {'value': { 'currency_id': journal_...
p.sale_id = ANY(%s) GROUP BY mp.state, p.sale_id''')
p.sale_id = ANY(%s) GROUP BY mp.state, p.sale_id''',(ids,))
def _picked_rate(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} if not ids: return {} res = {} for id in ids: res[id] = [0.0, 0.0] cr.execute('''SELECT p.sale_id,sum(m.product_qty), mp.state as mp_state FROM stock_move m LEFT JOIN stock_picking p on (p.id=m.picking_id) LEFT JOIN mrp_proc...
raise DAV_Error(405, str(e) or 'Not supported at this path')
raise DAV_Error(403, str(e) or 'Not supported at this path')
def _try_function(self, funct, args, opname='run function', cr=None, default_exc=DAV_Forbidden): """ Try to run a function, and properly convert exceptions to DAV ones. @objname the name of the operation being performed @param cr if given, the cursor to close at exceptions """ try: funct(*args) except DAV_Error: if c...
import traceback self.parent.log_error("GET typeError: %s", str(e)) self.parent.log_message("Exc: %s",traceback.format_exc()) raise DAV_Forbidden
return ''
def get_data(self,uri, rrange=None): self.parent.log_message('GET: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri) try: if not dbname: raise DAV_Error, 409 node = self.uri2object(cr, uid, pool, uri2) if not node: raise DAV_NotFound2(uri2) try: if rrange: self.parent.log_error("Doc get_data cannot use range") ...
sql =""" select rp.name from account_bank_statement_line as absl,res_partner as rp where absl.partner_id = rp.id and absl.pos_statement_id = %d"""%(statement['pos_statement_id']) self.cr.execute(sql) res = self.cr.dictfetchall() if res : return res[0]['name']
if statement['pos_statement_id']: sql =""" select rp.name from account_bank_statement_line as absl,res_partner as rp where absl.partner_id = rp.id and absl.pos_statement_id = %d"""%(statement['pos_statement_id']) self.cr.execute(sql) res = self.cr.dictfetchall() or {} return res and res[0]['name']
def _get_partner(self,statement): res = {} sql =""" select rp.name from account_bank_statement_line as absl,res_partner as rp where absl.partner_id = rp.id and absl.pos_statement_id = %d"""%(statement['pos_statement_id']) self.cr.execute(sql) res = self.cr.dictfetchall() if res : return res[0]['name'] else : return 0....
elif path is None:
elif self.path is None:
def full_path(self): """ Return the components of the full path for some node. The returned list only contains the names of nodes. """ if self.parent: s = self.parent.full_path() else: s = [] if isinstance(self.path,list): s+=self.path elif path is None: s.append('') else: s.append(self.path) return s #map(lambda x: '/...
return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
if not isinstance(res,list): res= [res] return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): start_date = arg[2] elif arg[1] in ('<', '<...
if dav_time <= wtime:
if float(dav_time) == float(wtime):
def match_dav_eprop(self, cr, match, ns, prop): if ns == "DAV:" and prop == "getetag": dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() tem, dav_time = tuple(match.split(':')) model, res_id = tuple(tem.split('_')) model_obj = dirobj.pool.get(model) model = model_obj.browse(cr, uid,...
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')]), 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True), 'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')],states={'done': [('readonly', True)]}), 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True,states={'done': [('readonly', True)]}), 'product_uom': f...
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 Tru...
'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."), 'location_dest_id': fields.many2one('stock.location', 'Destination Location', requi...
'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True,states={'done': [('readonly', True)]}, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."), 'location_dest_id': fields.many2one('stock.lo...
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 Tru...
'picking_id': fields.many2one('stock.picking', 'Picking List', select=True),
'picking_id': fields.many2one('stock.picking', 'Picking List', select=True,states={'done': [('readonly', 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 Tru...
def _get_company(self, cr, uid, ids, context={}):
def _get_company(self, cr, uid, context={}):
def _get_company(self, cr, uid, ids, context={}): user_pool = self.pool.get('res.users') company_pool = self.pool.get('res.company') user = user_pool.browse(cr, uid, uid, uid) company_id = user.company_id and user.company_id.id if not company_id: company_id = company_pool.search(cr, uid, [])[0]
user = user_pool.browse(cr, uid, uid, uid)
user = user_pool.browse(cr, uid, uid, context)
def _get_company(self, cr, uid, ids, context={}): user_pool = self.pool.get('res.users') company_pool = self.pool.get('res.company') user = user_pool.browse(cr, uid, uid, uid) company_id = user.company_id and user.company_id.id if not company_id: company_id = company_pool.search(cr, uid, [])[0]
def _get_cash_open_box_lines(self, cr, uid, ids, context={}):
def _get_cash_open_box_lines(self, cr, uid, context={}):
def _get_cash_open_box_lines(self, cr, uid, ids, context={}): res = [] curr = [1, 2, 5, 10, 20, 50, 100, 500] for rs in curr: dct = { 'pieces':rs, 'number':0 } res.append(dct) return res
return res def _get_cash_close_box_lines(self, cr, uid, ids, context={}):
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','cash')], context=context) if journal_ids: results = self.search(cr, uid, [('journal_id','in',journal_ids),('state','=','confirm')],context=context) if results: cash_st = self.browse(cr, uid, results, context)[0] for cash_line in cash_st.ending...
def _get_cash_open_box_lines(self, cr, uid, ids, context={}): res = [] curr = [1, 2, 5, 10, 20, 50, 100, 500] for rs in curr: dct = { 'pieces':rs, 'number':0 } res.append(dct) return res
res.append((0, 0, dct))
res.append(dct) return res def _get_cash_close_box_lines(self, cr, ids, uid, context={}): res = [] curr = [1, 2, 5, 10, 20, 50, 100, 500] for rs in curr: dct = { 'pieces':rs, 'number':0 } res.append((0,0,dct))
def _get_cash_close_box_lines(self, cr, uid, ids, context={}): res = [] curr = [1, 2, 5, 10, 20, 50, 100, 500] for rs in curr: dct = { 'pieces':rs, 'number':0 } res.append((0, 0, dct)) return res
'ending_details_ids':_get_cash_open_box_lines
'ending_details_ids':_get_default_cash_close_box_lines
def _get_cash_close_box_lines(self, cr, uid, ids, context={}): res = [] curr = [1, 2, 5, 10, 20, 50, 100, 500] for rs in curr: dct = { 'pieces':rs, 'number':0 } res.append((0, 0, dct)) return res
cr.execute("select id from account_bank_statement where journal_id=%s and user_id=%s and state=%s order by id desc limit 1", (statement.journal_id.id, uid, 'confirm')) rs = cr.fetchone() rs = rs and rs[0] or None if rs: if len(statement.starting_details_ids) > 0: sid = [] for line in statement.starting_details_ids: sid...
def button_open(self, cr, uid, ids, context=None):
{'login': email,
{'login': user.user_id.login,
def _create_result_lines(self, cr, uid, wizard_data, context=None): user_obj = self.pool.get('res.users') result_obj = self.pool.get('share.wizard.result.line') share_root_url = wizard_data.share_root_url format_url = '%(login)s' in share_root_url\ and '%(password)s' in share_root_url\ and '%(dbname)s' in share_root_ur...
'dbame': cr.dbname} if format_url else share_root_url
'dbname': cr.dbname} if format_url else share_root_url
def _create_result_lines(self, cr, uid, wizard_data, context=None): user_obj = self.pool.get('res.users') result_obj = self.pool.get('share.wizard.result.line') share_root_url = wizard_data.share_root_url format_url = '%(login)s' in share_root_url\ and '%(password)s' in share_root_url\ and '%(dbname)s' in share_root_ur...
(_check_duration, 'Error ! The duration of the Fiscal Year is invalid. ', ['date_stop'])
(_check_duration, 'Error ! The duration of the Fiscal Year is invalid. ', ['date_stop']), (_check_fiscal_year, 'Error ! This Fiscal Year overlaps an existing Fiscal Year',['date_start', 'date_stop'])
def _check_duration(self,cr,uid,ids): obj_fy=self.browse(cr,uid,ids[0]) if obj_fy.date_stop < obj_fy.date_start: return False return True
line = self.finalize_invoice_move_lines(self, cr, uid, inv, line)
line = self.finalize_invoice_move_lines(cr, uid, inv, line)
def action_move_create(self, cr, uid, ids, *args): """Creates invoice related analytics and financial move lines""" ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') context = {} for inv in self.browse(cr, uid, ids): if inv.move_id: continue
try: return self._login(db, login, password) except Exception, e: import logging logging.getLogger('netsvc').exception('Could not authenticate') return Exception('Access Denied') def _login(self, db, login, password):
def login(self, db, login, password):
cr = pooler.get_db(db).cursor()
cr = None try: cr = pooler.get_db(db).cursor() return self._login(cr, db, login, password) except Exception, e: if cr: cr.close() import logging logging.getLogger('netsvc').exception('Could not authenticate') return Exception('Access Denied') def _login(self, cr, db, login, password):
def _login(self, db, login, password): if not password: return False if db is False: raise RuntimeError("Cannot authenticate to False db!")
def _process_wi_paper(self, cr, uid, activity, workitem, context=None):
def _process_wi_report(self, cr, uid, activity, workitem, context=None):
def _process_wi_paper(self, cr, uid, activity, workitem, context=None): service = netsvc.LocalService('report.%s'%activity.report_id.report_name) (report_data, format) = service.create(cr, uid, [], {}, {}) attach_vals = { 'name': '%s_%s_%s'%(activity.report_id.report_name, activity.name,workitem.partner_id.name), 'data...
result['periods'] = lambda x: x[0], cr.fetchall()
result['periods'] = map(lambda x: x[0], cr.fetchall())
def _build_context(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} period_obj = self.pool.get('account.period') result['fiscalyear'] = data['form']['fiscalyear_id'] and data['form']['fiscalyear_id'] or False if data['form']['filter'] == 'filter_date': result['date_from'] = data['fo...
quantity = context.get('quantity', 1)
quantity = context.get('quantity') or 1.0
def _product_price(self, cr, uid, ids, name, arg, context={}): res = {} quantity = context.get('quantity', 1) pricelist = context.get('pricelist', False) if pricelist: for id in ids: try: price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], id, quantity, context=context)[pricelist] except: price = 0...
if not self._user_allow(cr, uid, statement.id, context=context):
force_allow = context.get('force_allow',False) if not force_allow and not self._user_allow(cr, uid, statement.id, context=context):
def button_open(self, cr, uid, ids, context=None): """ Changes statement state to Running. @return: True """ if context is None: context = {} statement_pool = self.pool.get('account.bank.statement') for statement in statement_pool.browse(cr, uid, ids, context=context): vals = {}
val = {'partner_invoice_id': addr['invoice'], 'partner_order_id': addr['contact'], 'partner_shipping_id': addr['delivery'], 'payment_term': payment_term, 'fiscal_position': fiscal_position}
dedicated_salesman = part.user_id and part.user_id.id or False val = { 'partner_invoice_id': addr['invoice'], 'partner_order_id': addr['contact'], 'partner_shipping_id': addr['delivery'], 'payment_term': payment_term, 'fiscal_position': fiscal_position, 'user_id': dedicated_salesman, }
def onchange_partner_id(self, cr, uid, ids, part): if not part: return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'partner_order_id': False, 'payment_term': False, 'fiscal_position': False}} addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery', 'invoice', 'contact']) p...
raise osv.except_osv("Error", "There is no associate activitity for the campaign")
raise osv.except_osv("Error", "There is no activitity in the campaign")
def state_running_set(self, cr, uid, ids, *args): campaign = self.browse(cr, uid, ids[0]) if not campaign.activity_ids : raise osv.except_osv("Error", "There is no associate activitity for the campaign") act_ids = [ act_id.id for act_id in campaign.activity_ids] act_ids = self.pool.get('marketing.campaign.activity').s...
raise osv.except_osv("Error", "There is no associate activitity for the campaign") segment_ids = self.pool.get('marketing.campaign.segment').search(cr, uid, [('campaign_id', '=', campaign.id), ('state', '=', 'draft')])
raise osv.except_osv("Error", "There is no starting activitity in the campaign")
def state_running_set(self, cr, uid, ids, *args): campaign = self.browse(cr, uid, ids[0]) if not campaign.activity_ids : raise osv.except_osv("Error", "There is no associate activitity for the campaign") act_ids = [ act_id.id for act_id in campaign.activity_ids] act_ids = self.pool.get('marketing.campaign.activity').s...
raise osv.except_osv("Error", "Camapign cannot be done before all segments are done")
raise osv.except_osv("Error", "Campaign cannot be marked as done before all segments are done")
def state_done_set(self, cr, uid, ids, *args): segment_ids = self.pool.get('marketing.campaign.segment').search(cr, uid, [('campaign_id', 'in', ids), ('state', '=', 'running')]) if segment_ids : raise osv.except_osv("Error", "Camapign cannot be done before all segments are done") self.write(cr, uid, ids, {'state': 'don...