[REf] account_* clean

give rights to the Marketing user to read the event.registration.badge object

bzr revid: vth@tinyerp.com-20101013134645-tqxcms2ageteg1ik
This commit is contained in:
vth 2010-10-13 19:16:45 +05:30
parent f00296a0bd
commit 765584ec93
12 changed files with 65 additions and 65 deletions

View File

@ -2019,7 +2019,7 @@ class account_model(osv.osv):
}
_defaults = {
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date)s : Current Date\n\ne.g. My model on %(date)s'),
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s: To Specify Year \n%(month)s: To Specify Month \n%(date)s: Current Date\n\ne.g. My model on %(date)s'),
}
def generate(self, cr, uid, ids, datas={}, context=None):
move_ids = []
@ -2221,7 +2221,7 @@ class account_subscription_line(osv.osv):
account_subscription_line()
# ---------------------------------------------------------------
# Account Templates : Account, Tax, Tax Code and chart. + Wizard
# Account Templates: Account, Tax, Tax Code and chart. + Wizard
# ---------------------------------------------------------------
class account_tax_template(osv.osv):
@ -2394,7 +2394,7 @@ class account_chart_template(osv.osv):
'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'),
'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
}
account_chart_template()

View File

@ -146,7 +146,7 @@ class account_analytic_account(osv.osv):
FROM account_analytic_line \
WHERE account_id IN %s \
AND invoice_id IS NULL \
GROUP BY account_analytic_line.account_id" ,(parent_ids,))
GROUP BY account_analytic_line.account_id",(parent_ids,))
for account_id, lwd in cr.fetchall():
if account_id not in res:
res[account_id] = {}
@ -656,7 +656,7 @@ class account_analytic_account_summary_month(osv.osv):
if fields is None:
fields = self._columns.keys()
res_trans_obj = self.pool.get('ir.translation')
# construct a clause for the rules :
# construct a clause for the rules:
d1, d2, tables= self.pool.get('ir.rule').domain_get(cr, user, self._name)
# all inherited fields + all non inherited fields for which the attribute whose name is in load is True

View File

@ -37,7 +37,7 @@ def str2float(str):
def list2float(lst):
try:
return str2float((lambda s : s[:-3] + '.' + s[-3:])(lst))
return str2float((lambda s: s[:-3] + '.' + s[-3:])(lst))
except:
return 0.0
@ -48,7 +48,7 @@ class account_coda_import(osv.osv_memory):
'journal_id': fields.many2one('account.journal', 'Bank Journal', required=True),
'def_payable': fields.many2one('account.account', 'Default Payable Account', domain=[('type', '=', 'payable')], required=True, help= 'Set here the payable account that will be used, by default, if the partner is not found'),
'def_receivable': fields.many2one('account.account', 'Default Receivable Account', domain=[('type', '=', 'receivable')], required=True, help= 'Set here the receivable account that will be used, by default, if the partner is not found',),
'awaiting_account': fields.many2one('account.account', 'Default Account for Unrecognized Movement', domain=[('type', '=', 'liquidity')], required=True, help= 'Set here the default account that will be used, if the partner is found but does not have the bank account , or if he is domiciled'),
'awaiting_account': fields.many2one('account.account', 'Default Account for Unrecognized Movement', domain=[('type', '=', 'liquidity')], required=True, help= 'Set here the default account that will be used, if the partner is found but does not have the bank account, or if he is domiciled'),
'coda': fields.binary('Coda File', required=True),
'note':fields.text('Log'),
}
@ -81,7 +81,7 @@ class account_coda_import(osv.osv_memory):
err_log = "Errors:\n------\n"
nb_err=0
std_log=''
str_log1 = "Coda File is Imported : "
str_log1 = "Coda File is Imported: "
str_not=''
str_not1=''
@ -158,9 +158,9 @@ class account_coda_import(osv.osv_memory):
bank = partner_bank_obj.browse(cr, uid, bank_ids[0], context)
if line and bank.partner_id:
bank_statement_lines[st_line_name].update({'partner_id': bank.partner_id.id})
if bank_statement_lines[st_line_name]['amount'] < 0 :
if bank_statement_lines[st_line_name]['amount'] < 0:
bank_statement_lines[st_line_name].update({'account_id': bank.partner_id.property_account_payable.id})
else :
else:
bank_statement_lines[st_line_name].update({'account_id': bank.partner_id.property_account_receivable.id})
else:
nb_err += 1
@ -216,9 +216,9 @@ class account_coda_import(osv.osv_memory):
rec_id = self.pool.get('account.move.line').search(cr, uid, [('name', '=', name), ('reconcile_id', '=', False), ('account_id.reconcile', '=', True)])
if rec_id:
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line['partner_id'], journal_id=statement['journal_id'], price=abs(line['amount']), currency_id = journal.company_id.currency_id.id, ttype=(line['amount'] < 0 and 'payment' or 'receipt'), context=context)
voucher_res = { 'type':(line['amount'] < 0 and 'payment' or 'receipt') ,
voucher_res = { 'type':(line['amount'] < 0 and 'payment' or 'receipt'),
'name': line['name'],#line.name,
'partner_id': line['partner_id'] ,#line.partner_id.id,
'partner_id': line['partner_id'],#line.partner_id.id,
'journal_id': statement['journal_id'], #statement.journal_id.id,
'account_id': result.get('account_id', journal.default_credit_account_id.id),#line.account_id.id,
'company_id': journal.company_id.id,#statement.company_id.id,
@ -249,9 +249,9 @@ class account_coda_import(osv.osv_memory):
mv = self.pool.get('account.move.line').browse(cr, uid, rec_id[0], context=context)
if mv.partner_id:
line['partner_id'] = mv.partner_id.id
if line['amount'] < 0 :
if line['amount'] < 0:
line['account_id'] = mv.partner_id.property_account_payable.id
else :
else:
line['account_id'] = mv.partner_id.property_account_receivable.id
str_not1 = ''
if line.has_key('contry_name') and line.has_key('cntry_number'):
@ -269,28 +269,28 @@ class account_coda_import(osv.osv_memory):
})
str_not = "\n \n Account Number: %s \n Account Holder Name: %s " %(statement["acc_number"], statement["acc_holder"])
std_log += "\nStatement : %s , Date : %s, Starting Balance : %.2f , Ending Balance : %.2f \n"\
std_log += "\nStatement: %s, Date: %s, Starting Balance: %.2f, Ending Balance: %.2f \n"\
%(statement['name'], statement['date'], float(statement["balance_start"]), float(statement["balance_end_real"]))
bkst_list.append(bk_st_id)
except osv.except_osv, e:
cr.rollback()
nb_err += 1
err_log += '\n Application Error : ' + str(e)
err_log += '\n Application Error: ' + str(e)
raise # REMOVEME
except Exception, e:
cr.rollback()
nb_err += 1
err_log += '\n System Error : '+str(e)
err_log += '\n System Error: '+str(e)
raise # REMOVEME
except :
except:
cr.rollback()
nb_err+=1
err_log += '\n Unknown Error'
raise
err_log += '\n\nNumber of statements : '+ str(len(bkst_list))
err_log += '\nNumber of error :'+ str(nb_err) +'\n'
err_log += '\n\nNumber of statements: '+ str(len(bkst_list))
err_log += '\nNumber of error:'+ str(nb_err) +'\n'
account_coda_obj.create(cr, uid, {
'name': codafile,

View File

@ -93,8 +93,8 @@ class account_followup_stat(osv.osv):
sum(l.debit) as debit,
sum(l.credit) as credit,
sum(l.debit - l.credit) as balance,
a.type as account_type ,
l.company_id as company_id ,
a.type as account_type,
l.company_id as company_id,
l.blocked,
am.period_id as period_id
from
@ -111,7 +111,7 @@ class account_followup_stat(osv.osv):
l.company_id is not NULL and
l.blocked is not NULL
group by
l.partner_id, a.type , l.company_id ,l.blocked ,am.period_id
l.partner_id, a.type, l.company_id,l.blocked,am.period_id
)""")
account_followup_stat()

View File

@ -22,15 +22,16 @@
import pooler
import time
from report import report_sxw
from pychart import *
import StringIO
import tools
import os
theme.use_color = 1
theme.default_font_family = "Helvetica-Bold"
theme.default_font_size = 18
theme.default_line_width = 1.0
import tools
import os
class accounting_report_indicator(report_sxw.rml_parse):
@ -72,9 +73,9 @@ class accounting_report_indicator(report_sxw.rml_parse):
'disp_graph':obj_ind.disp_graph,
'disp_tree':obj_ind.disp_tree,
'note':obj_ind.note,
'level' : obj_ind.parent_id or 0,
'level': obj_ind.parent_id or 0,
'type':obj_ind.type,
'array_table' : False,
'array_table': False,
}
if obj_ind.parent_id:
for record in result:
@ -228,7 +229,6 @@ class accounting_report_indicator(report_sxw.rml_parse):
if intercall:
return True
self.count +=1
import os
path=tools.config['addons_path']+"/account_report/tmp_images/image"
dirname =tools.config['addons_path']+'/account_report/tmp_images/'

View File

@ -110,7 +110,7 @@ class account_voucher(osv.osv):
return context.get('narration', False)
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
if not ids:
return []
return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
@ -194,7 +194,7 @@ class account_voucher(osv.osv):
'state': 'draft',
'pay_now': 'pay_later',
'name': '',
'date' : time.strftime('%Y-%m-%d'),
'date': time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
'tax_id': _get_tax,
}
@ -585,9 +585,9 @@ class account_voucher(osv.osv):
raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
move = {
'name' : name,
'name': name,
'journal_id': inv.journal_id.id,
'narration' : inv.narration,
'narration': inv.narration,
'date':inv.date,
'ref':inv.reference,
'period_id': inv.period_id and inv.period_id.id or False
@ -621,7 +621,7 @@ class account_voucher(osv.osv):
'debit':debit,
'credit':credit,
'account_id':inv.account_id.id,
'move_id':move_id ,
'move_id':move_id,
'journal_id':inv.journal_id.id,
'period_id':inv.period_id.id,
'partner_id':inv.partner_id.id,
@ -690,7 +690,7 @@ class account_voucher(osv.osv):
move_line = {
'name': name,
'account_id': False,
'move_id': move_id ,
'move_id': move_id,
'partner_id': inv.partner_id.id,
'date': inv.date,
'credit': diff > 0 and diff or 0.0,

View File

@ -30,16 +30,16 @@ class rml_parse(report_sxw.rml_parse):
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
'strip_name' : self._strip_name,
'explode_name' : self._explode_name,
'strip_name': self._strip_name,
'explode_name': self._explode_name,
})
def comma_me(self, amount):
if not amount:
amount = 0.0
if type(amount) is float :
if type(amount) is float:
amount = str('%.2f'%amount)
else :
else:
amount = str(amount)
if (amount == '0'):
return ' '

View File

@ -74,7 +74,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
context.update({'move_line_ids': [line.id]})
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context)
voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt') ,
voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt'),
'name': line.name,
'partner_id': line.partner_id.id,
'journal_id': statement.journal_id.id,

View File

@ -304,7 +304,7 @@ class event_registration(osv.osv):
_columns = {
'name': fields.char('Summary', size=124, readonly=True, states={'draft': [('readonly', False)]}),
'email_cc': fields.text('CC', size=252 , readonly=False, states={'done': [('readonly', True)]}, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'email_cc': fields.text('CC', size=252, readonly=False, states={'done': [('readonly', True)]}, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'nb_register': fields.integer('Quantity', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Number of Registrations or Tickets"),
'event_id': fields.many2one('event.event', 'Event', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'partner_id': fields.many2one('res.partner', 'Partner', states={'done': [('readonly', True)]}),
@ -320,8 +320,8 @@ class event_registration(osv.osv):
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
'email_from': fields.char('Email', size=128, states={'done': [('readonly', True)]}, help="These people will receive email."),
'create_date': fields.datetime('Creation Date' , readonly=True),
'write_date': fields.datetime('Write Date' , readonly=True),
'create_date': fields.datetime('Creation Date', readonly=True),
'write_date': fields.datetime('Write Date', readonly=True),
'description': fields.text('Description', states={'done': [('readonly', True)]}),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
@ -347,7 +347,7 @@ class event_registration(osv.osv):
def _make_invoice(self, cr, uid, reg, lines, context=None):
""" Create Invoice from Invoice lines
@param reg : Model of Event Registration
@param reg: Model of Event Registration
@param lines: Ids of Invoice lines
"""
if context is None:
@ -410,13 +410,13 @@ class event_registration(osv.osv):
for val in invoices.values():
res = False
if grouped:
res = self._make_invoice(cr, uid, val[0][0], [v for k , v in val], context=context)
res = self._make_invoice(cr, uid, val[0][0], [v for k, v in val], context=context)
for k , v in val:
for k, v in val:
self.do_close(cr, uid, [k.id], context={'invoice_id': res})
else:
for k , v in val:
for k, v in val:
res = self._make_invoice(cr, uid, k, [v], context=context)
self.do_close(cr, uid, [k.id], context={'invoice_id': res})
if res: new_invoice_ids.append(res)
@ -571,7 +571,7 @@ class event_registration(osv.osv):
def onchange_contact_id(self, cr, uid, ids, contact, partner):
"""This function returns value of Badge Name , Badge Title based on Partner contact.
"""This function returns value of Badge Name, Badge Title based on Partner contact.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,

View File

@ -9,7 +9,6 @@
"access_crm_case_section_manager","crm.case.section manager","crm.model_crm_case_section","base.group_marketing_manager",1,1,1,1
"access_product_product","product.product.product manager","product.model_product_product","base.group_marketing_manager",1,1,1,1
"access_report_event_registration","report.event.registration","model_report_event_registration","base.group_marketing_manager",1,1,1,1
"access_event_registration_badge","event.registration.badge","model_event_registration_badge","base.res_groups_email_template_admin",1,1,1,1
"access_event_registration_badge","event.registration.badge","model_event_registration_badge","base.group_marketing_manager",1,1,1,1
"access_event_event_sale_salesman","event.event.sale","model_event_event","base.group_sale_salesman",1,0,0,0
"access_event_event_system","event.event system","model_event_event","base.group_system",1,0,0,0
@ -18,3 +17,4 @@
"access_account_account_invoice_system","account.account.invoice","account.model_account_invoice","base.group_system",1,0,0,0
"access_event_type_sytem","event.type system","model_event_type","base.group_system",1,1,1,1
"access_account_account_invoice_manager","account.account.invoice","account.model_account_invoice","base.group_marketing_manager",1,0,0,0
"access_event_registration_badge","event.registration.badge","model_event_registration_badge","base.res_groups_email_template_admin",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
9 access_crm_case_section_manager crm.case.section manager crm.model_crm_case_section base.group_marketing_manager 1 1 1 1
10 access_product_product product.product.product manager product.model_product_product base.group_marketing_manager 1 1 1 1
11 access_report_event_registration report.event.registration model_report_event_registration base.group_marketing_manager 1 1 1 1
access_event_registration_badge event.registration.badge model_event_registration_badge base.res_groups_email_template_admin 1 1 1 1
12 access_event_registration_badge event.registration.badge model_event_registration_badge base.group_marketing_manager 1 1 1 1
13 access_event_event_sale_salesman event.event.sale model_event_event base.group_sale_salesman 1 0 0 0
14 access_event_event_system event.event system model_event_event base.group_system 1 0 0 0
17 access_account_account_invoice_system account.account.invoice account.model_account_invoice base.group_system 1 0 0 0
18 access_event_type_sytem event.type system model_event_type base.group_system 1 1 1 1
19 access_account_account_invoice_manager account.account.invoice account.model_account_invoice base.group_marketing_manager 1 0 0 0
20 access_event_registration_badge event.registration.badge model_event_registration_badge base.res_groups_email_template_admin 1 0 0 0

View File

@ -81,11 +81,11 @@ class partner_event_registration(osv.osv_memory):
for current in self.browse(cr, uid, ids, context=context):
for partner in res_obj.browse(cr, uid, record_ids, context=context):
new_case = reg_obj.create(cr, uid, {
'name' : 'Registration',
'event_id' : current.event_id and current.event_id.id or False,
'unit_price' : current.unit_price,
'partner_id' : partner.id,
'partner_invoice_id' : partner.id,
'name': 'Registration',
'event_id': current.event_id and current.event_id.id or False,
'unit_price': current.unit_price,
'partner_id': partner.id,
'partner_invoice_id': partner.id,
'event_product': current.event_id.product_id.name,
'contact_id': contact_id,
'email_from': email,
@ -98,7 +98,7 @@ class partner_event_registration(osv.osv_memory):
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'event.registration',
'res_id' : new_case,
'res_id': new_case,
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']

View File

@ -37,13 +37,13 @@ STATE = [
]
STATE_PRIOR = {
'none' : 0,
'canceled' : 1,
'old' : 2,
'waiting' : 3,
'invoiced' : 4,
'free' : 6,
'paid' : 7
'none': 0,
'canceled': 1,
'old': 2,
'waiting': 3,
'invoiced': 4,
'free': 6,
'paid': 7
}
class membership_line(osv.osv):
@ -109,7 +109,7 @@ class membership_line(osv.osv):
)
''', (line.id,))
fetched = cr.fetchone()
if not fetched :
if not fetched:
res[line.id] = 'canceled'
continue
istate = fetched[0]
@ -137,7 +137,7 @@ class membership_line(osv.osv):
'membership_id': fields.many2one('product.product', string="Membership Product", required=True),
'date_from': fields.date('From', readonly=True),
'date_to': fields.date('To', readonly=True),
'date_cancel' : fields.date('Cancel date'),
'date_cancel': fields.date('Cancel date'),
'date': fields.date('Join Date'),
'member_price':fields.float('Member Price', digits_compute= dp.get_precision('Sale Price'), required=True),
'account_invoice_line': fields.many2one('account.invoice.line', 'Account Invoice line', readonly=True),
@ -344,7 +344,7 @@ class Partner(osv.osv):
}
_defaults = {
'free_member': False,
'membership_cancel' : False,
'membership_cancel': False,
}
def _check_recursion(self, cr, uid, ids):