[IMP] currencies in mails + minor

bzr revid: jco@openerp.com-20121206164006-tx2paj5ybek6aupa
This commit is contained in:
Josse Colpaert 2012-12-06 17:40:06 +01:00
parent f67c93855a
commit bd2d663b22
8 changed files with 36 additions and 59 deletions

View File

@ -75,7 +75,7 @@ class followup_line(osv.osv):
Exception made if there was a mistake of ours, it seems that the following amount stays unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days. Exception made if there was a mistake of ours, it seems that the following amount stays unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days.
Would your payment have been carried out after this mail was sent, please ignore this message. Do not hesitate to contact our accounting department at (+32).10.68.94.39. Would your payment have been carried out after this mail was sent, please ignore this message. Do not hesitate to contact our accounting department.
Best Regards, Best Regards,
""", """,
@ -180,10 +180,7 @@ class res_partner(osv.osv):
root.insert(0, first_node[0]) root.insert(0, first_node[0])
res['arch'] = etree.tostring(doc, encoding="utf-8") res['arch'] = etree.tostring(doc, encoding="utf-8")
return res return res
# def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None):
# if order and order[0] == '':
# pass
def _get_latest(self, cr, uid, ids, names, arg, context=None, company_id=None): def _get_latest(self, cr, uid, ids, names, arg, context=None, company_id=None):
res={} res={}
@ -328,10 +325,6 @@ class res_partner(osv.osv):
'payment_earliest_due_date': calc_date} 'payment_earliest_due_date': calc_date}
return res return res
def _search_unreconciled(self, cr, uid, obj, name, args, field, context=None):
pass
def _payment_overdue_search(self, cr, uid, obj, name, args, context=None): def _payment_overdue_search(self, cr, uid, obj, name, args, context=None):
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
if not args: if not args:
@ -343,8 +336,7 @@ class res_partner(osv.osv):
query = self.pool.get('account.move.line')._query_get(cr, uid, context=context) query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
cr.execute(('SELECT pid AS partner_id, SUM(bal2) FROM ' \ cr.execute(('SELECT pid AS partner_id, SUM(bal2) FROM ' \
'(SELECT CASE WHEN bal IS NOT NULL THEN bal ' \ '(SELECT CASE WHEN bal IS NOT NULL THEN bal ' \
'ELSE 0.0 END AS bal2, p.id as pid ' \ 'ELSE 0.0 END AS bal2, p.id as pid FROM ' \
' FROM ' \
'(SELECT (debit-credit) AS bal, partner_id ' \ '(SELECT (debit-credit) AS bal, partner_id ' \
'FROM account_move_line l ' \ 'FROM account_move_line l ' \
'WHERE account_id IN ' \ 'WHERE account_id IN ' \
@ -417,19 +409,18 @@ class res_partner(osv.osv):
_inherit = "res.partner" _inherit = "res.partner"
_columns = { _columns = {
'payment_responsible_id':fields.many2one('res.users', ondelete='set null', string='Follow-up Responsible', 'payment_responsible_id':fields.many2one('res.users', ondelete='set null', string='Follow-up Responsible',
help="Responsible for making sure the action happens. "), help="Optionally you can assign a user to this field, which will make him responsible for the action. "),
'payment_note':fields.text('Customer Payment Promise', help="Payment Note"), 'payment_note':fields.text('Customer Payment Promise', help="Payment Note"),
'payment_next_action':fields.text('Next Action', 'payment_next_action':fields.text('Next Action',
help="This is the next action to be taken. It will automatically be set when the partner gets a follow-up level that requires a manual action. "), help="This is the next action to be taken. It will automatically be set when the partner gets a follow-up level that requires a manual action. "),
'payment_next_action_date':fields.date('Next Action Date', 'payment_next_action_date':fields.date('Next Action Date',
help="This is when the manual follow-up is needed. " \ help="This is when the manual follow-up is needed. " \
"The date will be set to the current date when the partner gets a follow-up level that requires a manual action. Can be practical to set manually e.g. to follow up his payment. "), "The date will be set to the current date when the partner gets a follow-up level that requires a manual action. Can be practical to set manually e.g. to see if he keeps his promises. "),
'unreconciled_aml_ids':fields.one2many('account.move.line', 'partner_id', domain=['&', ('reconcile_id', '=', False), '&', 'unreconciled_aml_ids':fields.one2many('account.move.line', 'partner_id', domain=['&', ('reconcile_id', '=', False), '&',
('account_id.active','=', True), '&', ('account_id.type', '=', 'receivable'), ('state', '!=', 'draft')]), ('account_id.active','=', True), '&', ('account_id.type', '=', 'receivable'), ('state', '!=', 'draft')]),
'latest_followup_date':fields.function(_get_latest, method=True, type='date', string="Latest Follow-up Date", 'latest_followup_date':fields.function(_get_latest, method=True, type='date', string="Latest Follow-up Date",
help="Latest date that the follow-up level of the partner was changed", help="Latest date that the follow-up level of the partner was changed",
store=False, store=False, multi="latest"),
multi="latest"),
'latest_followup_level_id':fields.function(_get_latest, method=True, 'latest_followup_level_id':fields.function(_get_latest, method=True,
type='many2one', relation='account_followup.followup.line', string="Latest Follow-up Level", type='many2one', relation='account_followup.followup.line', string="Latest Follow-up Level",
help="The maximum follow-up level", help="The maximum follow-up level",

View File

@ -33,7 +33,6 @@
<filter string="Partners with Overdue Credits" domain="[('payment_amount_overdue', '>', 0.0)]" name="credits"/> <filter string="Partners with Overdue Credits" domain="[('payment_amount_overdue', '>', 0.0)]" name="credits"/>
<separator/> <separator/>
<filter string="Follow-ups To Do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d')), ('credit', '>', 0.0)]" name="todo"/> <filter string="Follow-ups To Do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d')), ('credit', '>', 0.0)]" name="todo"/>
<filter string="Future Follow-ups" domain="[('payment_next_action_date', '&gt;', time.strftime('%%Y-%%m-%%d')), ('credit', '>', 0.0)]"/>
<separator/> <separator/>
<filter string="No Responsible" domain="[('payment_responsible_id', '=', False)]"/> <filter string="No Responsible" domain="[('payment_responsible_id', '=', False)]"/>
<filter string="My Follow-ups" domain="[('payment_responsible_id','=', uid)]"/> <filter string="My Follow-ups" domain="[('payment_responsible_id','=', uid)]"/>

View File

@ -26,20 +26,15 @@ contact our accounting department.
</p> </p>
<br/> <br/>
Best Regards, Best Regards,
<br/>
<br/> <br/>
${user.name | h} ${user.name | h}
<br/> <br/>
<br/> <br/>
<%
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${followup_table | h} ${ctx['followup_table']}
<br/> <br/>
@ -74,19 +69,14 @@ Details of due payments is printed below.
<br/> <br/>
Best Regards, Best Regards,
<br/>
<br/> <br/>
${user.name | h} ${user.name | h}
<br/> <br/>
<br/> <br/>
<% ${ctx['followup_table']}
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${followup_table | h}
<br/> <br/>
@ -116,18 +106,13 @@ In case of any queries concerning this matter, do not hesitate to contact our ac
<br/> <br/>
Best Regards, Best Regards,
<br/> <br/>
<br/>
${user.name | h} ${user.name | h}
<br/> <br/>
<br/> <br/>
<% ${ctx['followup_table']}
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${object.followup_table(object, user) | h}
<br/> <br/>
@ -157,20 +142,13 @@ contact our accounting department.
</p> </p>
<br/> <br/>
Best Regards, Best Regards,
</br> <br/>
</br>
<br/> <br/>
${user.name | h} ${user.name | h}
<br/> <br/>
<br/> <br/>
<% ${ctx['followup_table']}
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${followup_table | h}
<br/> <br/>
</div> </div>

View File

@ -17,7 +17,7 @@ Unless full payment is made in next 8 days, then legal action for the recovery o
I trust that this action will prove unnecessary and details of due payments is printed below. I trust that this action will prove unnecessary and details of due payments is printed below.
In case of any queries concerning this matter, do not hesitate to contact our accounting department at [TEL NUMBER]. In case of any queries concerning this matter, do not hesitate to contact our accounting department.
Best Regards, Best Regards,
</field> </field>
@ -39,7 +39,7 @@ Unless full payment is made in next 8 days, then legal action for the recovery o
I trust that this action will prove unnecessary and details of due payments is printed below. I trust that this action will prove unnecessary and details of due payments is printed below.
In case of any queries concerning this matter, do not hesitate to contact our accounting department at [TEL NUMBER]. In case of any queries concerning this matter, do not hesitate to contact our accounting department.
Best Regards, Best Regards,
</field> </field>

View File

@ -76,9 +76,11 @@
To remind customers of paying their invoices, you can To remind customers of paying their invoices, you can
define different actions depending on how severely define different actions depending on how severely
overdue the customer is. These actions are bundled overdue the customer is. These actions are bundled
into folow-up levels that are triggered when the due into follow-up levels that are triggered when the due
date of the most overdue invoice has passed a certain date of an invoice has passed a certain
number of days. number of days. If there are other overdue invoices for the
same customer, the actions of the most
overdue invoice will be executed.
</p> </p>
<field name="followup_line"/> <field name="followup_line"/>
</form> </form>
@ -167,7 +169,7 @@
</tree> </tree>
</field> </field>
</record> </record>
<!--
<record id="view_move_line_form" model="ir.ui.view"> <record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form.followup</field> <field name="name">account.move.line.form.followup</field>
<field name="model">account.move.line</field> <field name="model">account.move.line</field>
@ -178,6 +180,6 @@
<field name="followup_date"/> <field name="followup_date"/>
</field> </field>
</field> </field>
</record>--> </record>
</data> </data>
</openerp> </openerp>

View File

@ -85,7 +85,7 @@ class report_rappel(report_sxw.rml_parse):
final_res = self._lines_get_with_partner(partner, company.id) final_res = self._lines_get_with_partner(partner, company.id)
followup_table = '' followup_table = ''
for currency_dict in final_res: for currency_dict in final_res:
currency_symbol = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id'].symbol currency = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id']
followup_table += ''' followup_table += '''
<table border="2" width=100%%> <table border="2" width=100%%>
<tr> <tr>
@ -95,7 +95,7 @@ class report_rappel(report_sxw.rml_parse):
<td>Amount (%s)</td> <td>Amount (%s)</td>
<td>Lit.</td> <td>Lit.</td>
</tr> </tr>
''' % (currency_symbol) ''' % (currency.symbol)
total = 0 total = 0
ctx = context ctx = context
for aml in currency_dict['line']: for aml in currency_dict['line']:
@ -107,8 +107,10 @@ class report_rappel(report_sxw.rml_parse):
if date <= ctx['current_date'] and aml['balance'] > 0: if date <= ctx['current_date'] and aml['balance'] > 0:
strbegin = "<TD><B>" strbegin = "<TD><B>"
strend = "</B></TD>" strend = "</B></TD>"
followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + aml['ref'] + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "</TR>" followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + \
total = self.formatLang(total, dp='Account', currency_obj=partner.company_id.currency_id) aml['ref'] + strend + strbegin + str(date) + strend + strbegin + \
str(aml['balance']) + strend + strbegin + block + strend + "</TR>"
total = self.formatLang(total, dp='Account', currency_obj=currency)
followup_table += '''<tr> </tr> followup_table += '''<tr> </tr>
</table> </table>
<center>Amount due: %s </center>''' % (total) <center>Amount due: %s </center>''' % (total)

View File

@ -198,7 +198,12 @@ class account_followup_print(osv.osv_memory):
ids = self.pool.get('res.partner').search(cr, uid, ['&', ('credit', '<=', 0.0), '&', ('id', 'not in', partner_list_ids), '|', ids = self.pool.get('res.partner').search(cr, uid, ['&', ('credit', '<=', 0.0), '&', ('id', 'not in', partner_list_ids), '|',
('payment_responsible_id', '!=', False), ('payment_responsible_id', '!=', False),
('payment_next_action_date', '!=', False)], context=context) ('payment_next_action_date', '!=', False)], context=context)
self.pool.get('res.partner').action_done(cr, uid, ids, context=context) parts = self.pool.get('res.partner').browse(cr, uid, ids, context=context)
newids = []
for part in parts:
if not part.unreconciled_aml_ids:
newids.append(part.id)
self.pool.get('res.partner').action_done(cr, uid, newids, context=context)
return len(ids) return len(ids)
def do_process(self, cr, uid, ids, context=None): def do_process(self, cr, uid, ids, context=None):

View File

@ -13,7 +13,7 @@
</group> </group>
<p class ="oe_grey"> <p class ="oe_grey">
This action will send follow-up emails, print the letters and This action will send follow-up emails, print the letters and
set the manual actions per customers. set the manual actions per customer, according to the follow-up levels defined.
</p> </p>
<footer> <footer>
<button name="do_process" string="Send emails and generate letters" type="object" class="oe_highlight"/> <button name="do_process" string="Send emails and generate letters" type="object" class="oe_highlight"/>