*bugfixed: the partners displayed on the report wasn't good (tiny at work were written every where)
*when the wizard is run, all the invoices receive now a value for latest followup date and followup level (accordingly to the level of the account_move_line) *the email sending is implemented. The email is structured as the report *added a column for maturity date, in Financial Mngt\Periodical Processing\send followup\all receivable *in the many2many of the wizard in Financial Mngt\Periodical Processing\send followup, added a filter per account type == receivable bzr revid: qdp-f86c47df2d708c074e43717eb3f7441fe0247fac
This commit is contained in:
parent
7e13a86621
commit
b67274ad60
|
@ -37,8 +37,8 @@
|
|||
<field name="res_model">account_followup.followup</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Financial Management/Configuration/Payment Terms/Follow-Ups"
|
||||
<menuitem
|
||||
name="Financial Management/Configuration/Payment Terms/Follow-Ups"
|
||||
action="action_account_followup_definition_form"
|
||||
id="account_followup_menu"/>
|
||||
|
||||
|
@ -54,9 +54,9 @@
|
|||
<field name="name">Send followups</field>
|
||||
<field name="wiz_name">account_followup.followup.print.all</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Send Follow-Ups"
|
||||
action="action_account_followup_all_wizard"
|
||||
<menuitem
|
||||
name="Financial Management/Periodical Processing/Send Follow-Ups"
|
||||
action="action_account_followup_all_wizard"
|
||||
type="wizard"
|
||||
id="account_followup_wizard_menu"/>
|
||||
|
||||
|
@ -79,6 +79,7 @@
|
|||
<field name="debit" sum="Total debit"/>
|
||||
<field name="credit" sum="Total credit"/>
|
||||
<field name="state"/>
|
||||
<field name="date_maturity"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -107,7 +108,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<act_window name="Receivables & Payables"
|
||||
domain="[('partner_id', '=', active_id),('reconcile_id','=',False),('account_id.reconcile', '=', True)]"
|
||||
res_model="account.move.line"
|
||||
|
@ -121,9 +122,9 @@
|
|||
view="account_move_line_partner_tree"
|
||||
id="act_account_partner_account_move_all"/>
|
||||
|
||||
<menuitem
|
||||
action="act_account_partner_account_move_all"
|
||||
name="Financial Management/Periodical Processing/Send Follow-Ups/Receivable Entries"
|
||||
<menuitem
|
||||
action="act_account_partner_account_move_all"
|
||||
name="Financial Management/Periodical Processing/Send Follow-Ups/Receivable Entries"
|
||||
id="menu_account_move_open_unreconcile"/>
|
||||
|
||||
<act_window name="All payable entries"
|
||||
|
@ -133,9 +134,9 @@
|
|||
view="account_move_line_partner_tree"
|
||||
id="act_account_partner_account_move_payable_all"/>
|
||||
|
||||
<menuitem
|
||||
action="act_account_partner_account_move_payable_all"
|
||||
name="Financial Management/Periodical Processing/Send Follow-Ups/Payable Entries"
|
||||
<menuitem
|
||||
action="act_account_partner_account_move_payable_all"
|
||||
name="Financial Management/Periodical Processing/Send Follow-Ups/Payable Entries"
|
||||
id="menu_account_move_open_unreconcile_payable"/>
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="7,0" stop="7,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau6">
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
|
@ -35,26 +35,26 @@
|
|||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P11" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P15" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P16" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||
<paraStyle name="P17" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
|
||||
<paraStyle name="P18" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
|
||||
<paraStyle name="P17" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P18" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||
<paraStyle name="P19" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P20" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P20" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
|
@ -64,156 +64,158 @@
|
|||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P1">[[ repeatIn(ids_to_objects(data['form']['partner_ids'][0][2]),'o') ]] <font face="Times-Roman">[[ setLang(o.lang) ]]</font></para>
|
||||
<para style="P2">[[ repeatIn(ids_to_objects(data['form']['partner_ids']),'o') ]] <font face="Times-Roman">[[ setLang(o.lang) ]]</font></para>
|
||||
<blockTable colWidths="286.0,224.0" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P2">
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ o.name ]]</para>
|
||||
<para style="P13">[[ adr_get(o, 'invoice')['name'] ]]</para>
|
||||
<para style="P13">[[ adr_get(o, 'invoice')['street'] ]]</para>
|
||||
<para style="P13">[[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]]</para>
|
||||
<para style="P13">[[ adr_get(o, 'invoice')['country_id'][1] ]]</para>
|
||||
<para style="P13">
|
||||
<para style="P14">[[ o.name ]]</para>
|
||||
<para style="P3">[[ repeatIn(adr_get(o,'invoice'),'a' )]]</para>
|
||||
<para style="P15">[[ a['name'] ]]</para>
|
||||
<para style="P15">[[ a['street'] ]]</para>
|
||||
<para style="P15">[[ a['zip'] ]] </para>
|
||||
<para style="P15">[[ a['city'] ]]</para>
|
||||
<para style="P15">[[( a['country_id'] and a['country_id'][1]) or '']]</para>
|
||||
<para style="P15">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P13">VAT: [[ o.vat or removeParentNode('para') ]]</para>
|
||||
<para style="P15">VAT: [[ o.vat or removeParentNode('para') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P17">
|
||||
<para style="P1">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P18">
|
||||
<para style="P20">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P13"><font face="Times-Roman">Document</font><font face="Times-Roman">:</font> Customer account statement</para>
|
||||
<para style="P13">
|
||||
<para style="P15"><font face="Times-Roman">Document</font><font face="Times-Roman">:</font> Customer account statement</para>
|
||||
<para style="P15">
|
||||
<font face="Times-Roman">Date: </font>
|
||||
<font face="Times-Roman">[[ time.strftime('%d/%m/%Y') ]]</font>
|
||||
</para>
|
||||
<para style="P15"><font face="Times-Roman">Customer Ref:</font> [[ o.ref ]]</para>
|
||||
<para style="P16">
|
||||
<para style="P17"><font face="Times-Roman">Customer Ref:</font> [[ o.id ]]</para>
|
||||
<para style="P18">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P16">Dear Sir/Madam,</para>
|
||||
<para style="P16">
|
||||
<para style="P18">Dear Sir/Madam,</para>
|
||||
<para style="P18">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P16">Exception made if there was a mistake of ours, it seems that the following bills staid unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days.</para>
|
||||
<para style="P16">
|
||||
<para style="P18">Exception made if there was a mistake of ours, it seems that the following bills staid unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days.</para>
|
||||
<para style="P18">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P16">Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at (+32).10.68.94.39.</para>
|
||||
<para style="P16">
|
||||
<para style="P18">Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at (+32).10.68.94.39.</para>
|
||||
<para style="P18">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P16">Best regards.</para>
|
||||
<para style="P18">Best regards.</para>
|
||||
<para style="P19">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="59.0,137.0,65.0,58.0,60.0,57.0,56.0,19.0" style="Tableau3">
|
||||
<blockTable colWidths="59.0,137.0,65.0,58.0,60.0,57.0,56.0,19.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3">Date</para>
|
||||
<para style="P4">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Description</para>
|
||||
<para style="P4">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Ref</para>
|
||||
<para style="P4">Ref</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Maturity date</para>
|
||||
<para style="P4">Maturity date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Due</para>
|
||||
<para style="P5">Due</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Paid</para>
|
||||
<para style="P5">Paid</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Maturity</para>
|
||||
<para style="P5">Maturity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Li.</para>
|
||||
<para style="P5">Li.</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<para style="P6">
|
||||
<font face="Times-Roman">[[repeatIn(getLines(o), 'line') ]]</font>
|
||||
<font face="Times-Roman"> [[ line['date'] ]]</font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ line['name'] ]]</para>
|
||||
<para style="P7">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ line['ref'] ]]</para>
|
||||
<para style="P8">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ line['date_maturity'] ]]</para>
|
||||
<para style="P8">[[ line['date_maturity'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">[[ line['debit'] and '%.2f' % line['debit'] or '' ]]</para>
|
||||
<para style="P11">[[ line['debit'] and '%.2f' % line['debit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ line['credit'] and '%.2f' % line['credit'] or '' ]]</para>
|
||||
<para style="P9">[[ line['credit'] and '%.2f' % line['credit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and (line['debit'] - line['credit']) or '' ]]</para>
|
||||
<para style="P9">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and (line['debit'] - line['credit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ line['blocked'] and 'X' or '' ]]</para>
|
||||
<para style="P9">[[ line['blocked'] and 'X' or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="318.0,61.0,56.0,56.0,19.0" style="Tableau6">
|
||||
<blockTable colWidths="318.0,61.0,56.0,56.0,19.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">Sub-Total: </para>
|
||||
<para style="P12">Sub-Total: </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ '%.2f' % (reduce(lambda x,y: x+y['debit'], getLines(o), 0)) ]]</para>
|
||||
<para style="P12">[[ '%.2f' % (reduce(lambda x,y: x+y['debit'], getLines(o), 0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">
|
||||
<para style="P9">
|
||||
<font face="Times-Bold">[[ '%.2f' % (reduce(lambda x,y: x+y['credit'], getLines(o), 0)) ]]</font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">[[ reduce(lambda x,y: x+(y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0) ]]</para>
|
||||
<para style="P11">[[ reduce(lambda x,y: x+(y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P20">
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">Balance: </para>
|
||||
<para style="P12">Balance: </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ '%.2f' % (reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0)) ]]</para>
|
||||
<para style="P12">[[ '%.2f' % (reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P20">
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
|
@ -222,13 +224,12 @@
|
|||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P14">
|
||||
<para style="P16">
|
||||
<font face="Times-Roman">Total amount due: </font>
|
||||
<font face="Times-Roman">[[ '%.2f' % (reduce(lambda x,y: x+(y['debit']-y['credit']), getLines(o), 0)) ]] [[ company.currency_id.name]].</font>
|
||||
</para>
|
||||
<para style="P13">
|
||||
<para style="P15">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
|
@ -45,14 +45,18 @@ class report_rappel(report_sxw.rml_parse):
|
|||
|
||||
def _ids_to_objects(self, partners_ids):
|
||||
pool = pooler.get_pool(self.cr.dbname)
|
||||
partners = pool.get('res.partner').browse(self.cr, self.uid, partners_ids)
|
||||
return partners
|
||||
all_partners = []
|
||||
for partner in partners_ids:
|
||||
partners = pool.get('account_followup.stat').browse(self.cr, self.uid, partner[2])
|
||||
for par in partners:
|
||||
all_partners.append(par.name)
|
||||
return all_partners
|
||||
|
||||
def _adr_get(self, partner, type):
|
||||
res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
|
||||
res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address')
|
||||
adr = res_partner.address_get(self.cr, self.uid, [partner.id], [type])[type]
|
||||
return res_partner_address.read(self.cr, self.uid, [adr])[0]
|
||||
return res_partner_address.read(self.cr, self.uid, [adr])
|
||||
|
||||
def _lines_get(self, partner):
|
||||
moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
|
|
@ -30,6 +30,9 @@ import datetime
|
|||
import pooler
|
||||
import time
|
||||
|
||||
import tools
|
||||
from osv import fields, osv
|
||||
|
||||
_followup_wizard_date_form = """<?xml version="1.0"?>
|
||||
<form string="Select a date">
|
||||
<field name="date"/>
|
||||
|
@ -39,6 +42,20 @@ _followup_wizard_date_fields = {
|
|||
'date': {'string': 'Date', 'type': 'date', 'required': True},
|
||||
}
|
||||
|
||||
form = """<?xml version="1.0"?>
|
||||
<form string="Mail">
|
||||
<field name="mail_sent" colspan="4"/>
|
||||
<newline/>
|
||||
<newline/>
|
||||
<label string="Mail not sent to following Partners , Email not available !" colspan="4"/>
|
||||
<field name="mail_notsent" colspan="4" nolabel="1"/>
|
||||
</form>"""
|
||||
|
||||
fields = {
|
||||
'mail_sent': {'string':'Number of Mail sent', 'type':'char', 'readonly':True },
|
||||
'mail_notsent': {'string':'Error Messages', 'type':'text', 'readonly':True , 'nolabel':'1'},
|
||||
}
|
||||
|
||||
_followup_wizard_all_form = """<?xml version="1.0"?>
|
||||
<form string="Select partners" colspan="4">
|
||||
<notebook>
|
||||
|
@ -49,51 +66,68 @@ _followup_wizard_all_form = """<?xml version="1.0"?>
|
|||
<page string="Email confirmation">
|
||||
<label string="Not yet implemented !" colspan="4"/>
|
||||
<field name="email_conf" colspan="4"/>
|
||||
<field name="email_subject" colspan="4"/>
|
||||
<separator string="Email body" colspan="4"/>
|
||||
<field name="email_body" colspan="4" nolabel="1"/>
|
||||
<separator string="Legend" colspan="4"/>
|
||||
|
||||
|
||||
<label string="%(partner_name)s: Partner name" colspan="2"/>
|
||||
<label string="%(user_signature)s: Partner name" colspan="2"/>
|
||||
<label string="%(followup_level)s: Followup level" colspan="2"/>
|
||||
<label string="%(followup_amount)s: Followup level" colspan="2"/>
|
||||
<label string="%(followup_details)s: Followup level" colspan="2"/>
|
||||
<label string="%(followup_amount)s: Total Amount Due" colspan="2"/>
|
||||
<label string="%(user_signature)s: User name" colspan="2"/>
|
||||
<label string="%(company_name)s: User's Company name" colspan="2"/>
|
||||
<label string="%(line)s: Account Move lines" colspan="2"/>
|
||||
<label string="%(heading)s: Move line header" colspan="2"/>
|
||||
<label string="%(date)s: Current Date" colspan="2"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>"""
|
||||
|
||||
_followup_wizard_all_fields = {
|
||||
'partner_ids': {
|
||||
'string': "Partners",
|
||||
'type': 'many2many',
|
||||
'string': "Partners",
|
||||
'type': 'many2many',
|
||||
'relation': 'account_followup.stat',
|
||||
'domain':"[('account_type','=','receivable')]"
|
||||
},
|
||||
'email_conf': {
|
||||
'string': "Send email confirmation",
|
||||
'type': 'boolean',
|
||||
'string': "Send email confirmation",
|
||||
'type': 'boolean',
|
||||
},
|
||||
'email_subject' : {
|
||||
'string' : "Email Subject",
|
||||
'type' : "char",
|
||||
'size': 64,
|
||||
'default': 'Account Statement'
|
||||
},
|
||||
'email_body': {
|
||||
'string': "Email body",
|
||||
'type': 'text',
|
||||
'string': "Email body",
|
||||
'type': 'text',
|
||||
'default': '''
|
||||
Date : %(date)s
|
||||
|
||||
Dear %(partner_name)s,
|
||||
|
||||
Please find in attachment our reminder for a total amount due
|
||||
of %(followup_amount).2f EUR.
|
||||
Exception made if there was a mistake of ours, it seems that the following amount staid unpaid. Please, take appropriate
|
||||
measures in order to carry out this payment in the next 8 days.
|
||||
|
||||
The details are here:
|
||||
%(followup_details)s
|
||||
Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not
|
||||
hesitate to contact our accounting departement at (+32).10.68.94.39.
|
||||
|
||||
Best regards,
|
||||
|
||||
%(heading)s
|
||||
%(line)s
|
||||
|
||||
Total Amount due: %(followup_amount).2f EUR
|
||||
|
||||
%(followup_level)s
|
||||
Thanks,
|
||||
|
||||
--
|
||||
--
|
||||
%(user_signature)s
|
||||
%(company_name)s
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class followup_all_print(wizard.interface):
|
||||
def _update_partners(self, cr, uid, data, context):
|
||||
to_update = data['form']['to_update']
|
||||
|
@ -106,6 +140,74 @@ class followup_all_print(wizard.interface):
|
|||
data['form']['date'], int(id),))
|
||||
return {}
|
||||
|
||||
def _sendmail(self ,cr, uid, data, context):
|
||||
self._update_partners(cr, uid, data, context)
|
||||
mail_notsent = ''
|
||||
count = 0
|
||||
if data['form']['email_conf']:
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
data_user = pool.get('res.users').browse(cr,uid,uid)
|
||||
line_obj = pool.get('account_followup.stat')
|
||||
move_lines = line_obj.browse(cr,uid,data['form']['partner_ids'][0][2])
|
||||
partners = []
|
||||
dict_lines = {}
|
||||
for line in move_lines:
|
||||
partners.append(line.name)
|
||||
dict_lines[line.name.id] =line
|
||||
print partners
|
||||
for partner in partners:
|
||||
ids_lines = pool.get('account.move.line').search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable','payable'])])
|
||||
data_lines = pool.get('account.move.line').browse(cr,uid,ids_lines)
|
||||
followup_data = dict_lines[partner.id]
|
||||
dest = False
|
||||
if partner.address:
|
||||
for adr in partner.address:
|
||||
if adr.type=='contact':
|
||||
if adr.email:
|
||||
dest = [adr.email]
|
||||
if (not dest) and adr.type=='default':
|
||||
if adr.email:
|
||||
dest = [adr.email]
|
||||
print "dest: ", dest
|
||||
src = tools.config.options['smtp_user'] #'priteshmodi.eiffel@yahoo.co.in'
|
||||
body=data['form']['email_body']
|
||||
total_amt = followup_data.debit - followup_data.credit
|
||||
move_line = ''
|
||||
subtotal_due = 0.0
|
||||
subtotal_paid = 0.0
|
||||
subtotal_maturity = 0.0
|
||||
balance = 0.0
|
||||
l = '--------------------------------------------------------------------------------------------------------------------------'
|
||||
head = l+ '\n' + 'Date'.rjust(10) + '\t' + 'Description'.rjust(10) + '\t' + 'Ref'.rjust(10) + '\t' + 'Maturity date'.rjust(10) + '\t' + 'Due'.rjust(10) + '\t' + 'Paid'.rjust(10) + '\t' + 'Maturity'.rjust(10) + '\t' + 'Litigation'.rjust(10) + '\n' + l
|
||||
for i in data_lines:
|
||||
maturity = ''
|
||||
if i.date_maturity < time.strftime('%Y-%m-%d') and (i.debit - i.credit):
|
||||
maturity = i.debit - i.credit
|
||||
subtotal_due = subtotal_due + i.debit
|
||||
subtotal_paid = subtotal_paid + i.credit
|
||||
subtotal_maturity = subtotal_maturity + int(maturity)
|
||||
balance = balance + (i.debit - i.credit)
|
||||
move_line = move_line + (i.date).rjust(10) + '\t'+ (i.name).rjust(10) + '\t'+ (i.ref or '').rjust(10) + '\t' + (i.date_maturity or '').rjust(10) + '\t' + str(i.debit).rjust(10) + '\t' + str(i.credit).rjust(10) + '\t' + str(maturity).rjust(10) + '\t' + str(i.blocked).rjust(10) + '\n'
|
||||
move_line = move_line + l + '\n'+ '\t\t\t' + 'Sub total'.rjust(35) + '\t' + (str(subtotal_due) or '').rjust(10) + '\t' + (str(subtotal_paid) or '').rjust(10) + '\t' + (str(subtotal_maturity) or '').rjust(10)+ '\n'
|
||||
move_line = move_line + '\t\t\t' + 'Balance'.rjust(33) + '\t' + str(balance).rjust(10) + '\n' + l
|
||||
val = {
|
||||
'partner_name':partner.name,
|
||||
'followup_amount':total_amt,
|
||||
'user_signature':data_user.name,
|
||||
'company_name':data_user.company_id.name,
|
||||
'line':move_line,
|
||||
'heading': head,
|
||||
'date':time.strftime('%Y-%m-%d')
|
||||
}
|
||||
body = body%val
|
||||
sub = str(data['form']['email_subject'])
|
||||
if dest:
|
||||
tools.email_send(src,dest,sub,body)
|
||||
count = count + 1
|
||||
else:
|
||||
mail_notsent = mail_notsent + partner.name + ','
|
||||
return {'mail_notsent' : str(mail_notsent) , 'mail_sent' : str(count)}
|
||||
|
||||
def _get_partners(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
cr.execute(
|
||||
|
@ -126,7 +228,7 @@ class followup_all_print(wizard.interface):
|
|||
fups = {}
|
||||
fup_ids = pool.get('account_followup.followup').search(cr, uid, [])
|
||||
if not fup_ids:
|
||||
raise wizard.except_wizard('No Follow up Defined',
|
||||
raise wizard.except_wizard('No Follow up Defined',
|
||||
'You must define at least one follow up for your company !')
|
||||
fup_id = fup_ids[0]
|
||||
|
||||
|
@ -148,9 +250,13 @@ class followup_all_print(wizard.interface):
|
|||
|
||||
partner_list = []
|
||||
to_update = {}
|
||||
for partner_id, followup_line_id, date, id in move_lines:
|
||||
if (partner_id in partner_list) or (not partner_id):
|
||||
for partner_id, followup_line_id, date, id in move_lines:
|
||||
# if (partner_id in partner_list) or (not partner_id):
|
||||
# continue
|
||||
if not partner_id:
|
||||
continue
|
||||
if partner_id in partner_list:
|
||||
to_update[str(id)] = fups[followup_line_id][1]
|
||||
if followup_line_id not in fups:
|
||||
continue
|
||||
if date <= fups[followup_line_id][0].strftime('%Y-%m-%d'):
|
||||
|
@ -181,6 +287,7 @@ class followup_all_print(wizard.interface):
|
|||
'state': [
|
||||
('end','Cancel'),
|
||||
('print','Print Follow Ups'),
|
||||
('sendmail','Send Mail')
|
||||
]
|
||||
},
|
||||
},
|
||||
|
@ -190,6 +297,13 @@ class followup_all_print(wizard.interface):
|
|||
'report':'account_followup.followup.print',
|
||||
'state':'end'},
|
||||
},
|
||||
'sendmail': {
|
||||
'actions': [_sendmail],
|
||||
'result': {'type': 'form',
|
||||
'arch': form,
|
||||
'fields': fields,
|
||||
'state':[('end','Ok')]},
|
||||
},
|
||||
}
|
||||
|
||||
followup_all_print('account_followup.followup.print.all')
|
||||
|
|
Loading…
Reference in New Issue