[IMP] fix functional fields, security

bzr revid: jco@openerp.com-20121120152959-oz4in39d77ny65xl
This commit is contained in:
Josse Colpaert 2012-11-20 16:29:59 +01:00
parent feaa99bdb4
commit c6080b4fe2
5 changed files with 33 additions and 28 deletions

View File

@ -203,29 +203,33 @@ class res_partner(osv.osv):
latest_date = False
latest_level = False
latest_level_without_lit = False
for aml in amls:
latest_days = False
latest_days_without_lit = False
for aml in amls:
#Give initial value
if latest_date == False:
latest_date = aml.followup_date
latest_level = aml.followup_line_id.id
latest_days = aml.followup_line_id.delay
if not aml.blocked:
latest_level_without_lit = latest_level
if aml.followup_line_id:
latest_level = aml.followup_line_id.id
latest_days = aml.followup_line_id.delay
if not aml.blocked and latest_level_without_lit == False and aml.followup_line_id:
latest_level_without_lit = aml.followup_line_id.id
latest_days_without_lit = aml.followup_line_id.delay
#If initial value < ...
if latest_date and latest_level:
if aml.followup_date > latest_date:
latest_date = aml.followup_date
if aml.followup_line_id.delay > latest_days:
if aml.followup_line_id and aml.followup_line_id.delay > latest_days:
latest_days = aml.followup_line_id.delay
latest_level = aml.followup_line_id.id
if not aml.blocked:
latest_level_without_lit = latest_level
res[partner.id] = {'latest_followup_date': latest_date,
if not aml.blocked and latest_level_without_lit and aml.followup_line_id and aml.followup_line_id.delay > latest_days_without_lit:
latest_days_without_lit = aml.followup_line_id.delay
latest_level_without_lit = aml.followup_line_id.id
res[partner.id] = {'latest_followup_date': latest_date,
'latest_followup_level_id': latest_level,
'latest_followup_level_id_without_lit': latest_level_without_lit}
return res
#Problems company id? / Method necessary?
def _get_next_followup_level_id(self, cr, uid, ids, name, arg, context=None):
res = {}
@ -323,7 +327,8 @@ class res_partner(osv.osv):
mtp = self.pool.get('email.template')
unknown_mails = 0
for partner in self.browse(cr, uid, partner_ids, context):
if partner.email != '' and partner.email != ' ':
print "Email", partner.email
if partner.email != False and partner.email != '' and partner.email != ' ':
if partner.latest_followup_level_id_without_lit and partner.latest_followup_level_id_without_lit.send_email and partner.latest_followup_level_id_without_lit.email_template_id.id != False :
mtp.send_mail(cr, uid, partner.latest_followup_level_id_without_lit.email_template_id.id, partner.id, context=context)
else :

View File

@ -134,13 +134,13 @@
<label for="payment_next_action" string="Next Follow-up Action"/>
<field name="payment_next_action_date" nolabel="1" class="oe_inline"/> <label string="-" attrs="{'invisible': ['|', ('payment_next_action_date', '=', False), ('payment_next_action', '=', False)]}"/>
<field name="payment_next_action" class="oe_inline" nolabel="1" string="Next Follow-up action" placeholder="e.g. Give a phonecall, Check if he paid, ..."/>
<span attrs="{'invisible':[('payment_responsible_id', '=', False)]}"> to be done by: </span> <field name="payment_responsible_id" placeholder="The user responsible for taking this action e.g. sales" class="oe_inline"/>
<span attrs="{'invisible':[('payment_responsible_id', '=', False)]}"> to be done by: </span> <field name="payment_responsible_id" placeholder="The user responsible for taking this action e.g. sales" class="oe_inline"/>
<span attrs="{'invisible':['|', ('payment_next_action_date', '!=', False), '|', ('payment_responsible_id', '!=', False), ('payment_next_action', '!=', False)]}">No action defined right now. </span>
<br/>
<button name="action_done" type="object" string="&#8627; Mark as Done"
help="This button will clear the action, the action date and the responsible. " class="oe_link"
attrs="{'invisible':['&amp;',('payment_next_action_date','=', False), '&amp;', ('payment_responsible_id','=', False), ('payment_next_action', '=', False)]}" />
attrs="{'invisible':['&amp;',('payment_next_action_date','=', False), '&amp;', ('payment_responsible_id','=', False), ('payment_next_action', '=', False)]}"
groups="res_security.group_partner_manager, account.group_account_user"/>
</p>
<!--attrs="{'invisible':['&amp;',('payment_next_action_date','=', False), '&amp;', ('payment_responsible_id','=', False), ('payment_next_action', '=', False)]}"-->
<group>

View File

@ -64,7 +64,7 @@
<field name="context">{'search_default_followup_level':1}</field>
<field name="search_view_id" ref="view_account_followup_stat_search"/>
</record>
<menuitem id="menu_finance_followup" parent="account.menu_finance" name="Follow-up" groups="account.group_account_user"/>
<menuitem id="menu_finance_followup" parent="account.menu_finance" name="Follow-up" groups="account.group_account_invoice"/>
<menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="menu_finance_followup" groups="account.group_account_user" name="Follow-ups Done Report" sequence="10"/>
</data>

View File

@ -167,7 +167,7 @@ class account_followup_print(osv.osv_memory):
if partner.max_followup_id.send_letter:
partner_ids_to_print.append(partner.id)
nbprints += 1
partner_obj.message_post(cr, uid, [partner.partner_id.id], body=_("Follow-up letter will be sent"), context=context)
partner_obj.message_post(cr, uid, [partner.partner_id.id], body=_("Follow-up letter will be sent"), context=context)
resulttext = resulttext + str(nbmails) + " emails sent (" + str(nbunknownmails) + " with unknown email) \n " + str(nbprints) + " letters in report \n " + str(nbmanuals) + " total manual action(s) assigned: \n \n"
needprinting = False
if nbprints > 0:
@ -178,7 +178,7 @@ class account_followup_print(osv.osv_memory):
action = partner_obj.do_partner_print(cr, uid, partner_ids_to_print, data, context)
result['needprinting'] = needprinting
result['resulttext'] = resulttext
result['action'] = action or {}
result['action'] = action or {}
return result
def do_update_followup_level(self, cr, uid, to_update, partner_list, date, context=None):

View File

@ -10,14 +10,13 @@
<group col="4">
<field name="followup_id" groups="base.group_multi_company"/>
<field name="date" groups="base.group_no_one"/>
</group>
<p class = "oe_grey">
This wizard will check the customers with overdue invoices and will execute the actions needed to
send to the customer according to the Follow-up Levels defined. By clicking on the button, the emails will be sent
a report will be generated for the letters. In the next screen you will see which actions were executed and be able to
print the letters if there are any. Also the manual actions will be set when needed.
</p>
<footer>
</group>
<p class ="oe_grey">
When you hit the button below, for every partner the most overdue invoice (without litigation) is checked.
If the amount of days overdue is greater or equal than the amount of days specified by a next follow-up level,
it will be updated to that next level and the actions of that level will be executed. (See Configuration > Follow-up Levels)
</p>
<footer>
<button name="do_process" string="Send emails and generate letters" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
@ -38,6 +37,7 @@
id="account_followup_print_menu"
parent="menu_finance_followup"
name = "Send Letters and Emails"
groups = "account.group_account_user"
sequence="2"/>
<record id="account_followup_stat_by_partner_search" model="ir.ui.view">