account, account_followup: use payable/receivable account instead of the two define on the partner
bzr revid: ced-4fc4ef80f2a575e82c0d08bc7b3c186792b441a1
This commit is contained in:
parent
de82deea0a
commit
67d969e7ba
|
@ -1472,7 +1472,7 @@
|
|||
|
||||
|
||||
<act_window name="Unreconciled account entries"
|
||||
domain="[('partner_id', '=', active_id),('account_id','=','partner:'+str(active_id)),('reconcile_id','=',False)]"
|
||||
domain="[('partner_id', '=', active_id), ('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id','=',False)]"
|
||||
res_model="account.move.line"
|
||||
src_model="res.partner"
|
||||
id="act_account_partner_account_move_unreconciled"/>
|
||||
|
|
|
@ -51,13 +51,14 @@ class report_rappel(report_sxw.rml_parse):
|
|||
return adr_id and res_partner_address.read(self.cr, self.uid, [adr_id])[0] or False
|
||||
|
||||
def _lines_get(self, partner):
|
||||
part = pooler.get_pool(self.cr.dbname).get('res.partner')
|
||||
acc = partner.property_account_receivable[0]
|
||||
moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
movelines = moveline_obj.search(self.cr, self.uid, [('partner_id','=',partner.id), ('account_id','=',acc), ('state','=','valid'), ('date_maturity', '=', False)])
|
||||
movelines += moveline_obj.search(self.cr, self.uid, [('partner_id','=',partner.id), ('account_id','=',acc), ('state','=','valid'), ('date_maturity', '<=', time.strftime('%Y-%m-%d'))])
|
||||
movelines = moveline_obj.search(self.cr, self.uid,
|
||||
[('partner_id', '=', partner.id),
|
||||
('account_id.type', 'in', ['receivable', 'payable']),
|
||||
('state', '<>', 'draft'), ('reconcile_id', '=', False)])
|
||||
movelines = moveline_obj.read(self.cr, self.uid, movelines)
|
||||
return movelines
|
||||
|
||||
report_sxw.report_sxw('report.account.rappel', 'res.partner', 'addons/account/report/rappel.rml',parser=report_rappel)
|
||||
report_sxw.report_sxw('report.account.rappel', 'res.partner',
|
||||
'addons/account/report/rappel.rml', parser=report_rappel)
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@ class account_followup_stat(osv.osv):
|
|||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'account_type': fields.selection(_code_get, 'Account Type', required=True),
|
||||
'account_type': fields.selection(_code_get, 'Account Type', readonly=True),
|
||||
'date_move':fields.date('First move', readonly=True),
|
||||
'date_move_last':fields.date('Last move', readonly=True),
|
||||
'date_followup':fields.date('Latest followup', readonly=True),
|
||||
'followup_id': fields.many2one('account_followup.followup.line', 'Follow Ups', required=True, ondelete="cascade"),
|
||||
'followup_id': fields.many2one('account_followup.followup.line',
|
||||
'Follow Ups', readonly=True, ondelete="cascade"),
|
||||
'balance':fields.float('Balance', readonly=True),
|
||||
'debit':fields.float('Debit', readonly=True),
|
||||
'credit':fields.float('Credit', readonly=True),
|
||||
|
|
|
@ -84,18 +84,41 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_move_line_form">
|
||||
<field name="name">account.move.line.form.followup</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_created" position="after">
|
||||
<field name="followup_date"/>
|
||||
<field name="followup_line_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_move_line_tree">
|
||||
<field name="name">account.move.line.tree.followup</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="state" position="before">
|
||||
<field name="followup_date"/>
|
||||
<field name="followup_line_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window name="Unreconciled account entries"
|
||||
<act_window name="Receivables & Payables"
|
||||
domain="[('partner_id', '=', active_id),('reconcile_id','=',False),('account_id.reconcile', '=', True)]"
|
||||
res_model="account.move.line"
|
||||
src_model="res.partner"
|
||||
view="account_move_line_partner_tree"
|
||||
id="account.act_account_partner_account_move_unreconciled"/>
|
||||
|
||||
<act_window name="All receivable entries"
|
||||
domain="[('reconcile_id', '=', False),('account_id.type','=','receivable'),('partner_id', '=', active_id)]"
|
||||
domain="[('reconcile_id', '=', False),('account_id.type','=','receivable')]"
|
||||
res_model="account.move.line"
|
||||
src_model="res.partner"
|
||||
src_model=""
|
||||
view="account_move_line_partner_tree"
|
||||
id="act_account_partner_account_move_all"/>
|
||||
|
||||
|
@ -105,9 +128,9 @@
|
|||
id="menu_account_move_open_unreconcile"/>
|
||||
|
||||
<act_window name="All payable entries"
|
||||
domain="[('reconcile_id', '=', False),('account_id.type','=','payable'),('partner_id', '=', active_id)]"
|
||||
domain="[('reconcile_id', '=', False), ('account_id.type','=','payable')]"
|
||||
res_model="account.move.line"
|
||||
src_model="res.partner"
|
||||
src_model=""
|
||||
view="account_move_line_partner_tree"
|
||||
id="act_account_partner_account_move_payable_all"/>
|
||||
|
||||
|
|
|
@ -37,24 +37,24 @@
|
|||
</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="11.0" leading="14"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" 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-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P16" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P17" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P18" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P19" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P20" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||
<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="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="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="P19" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P20" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<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,7 +64,7 @@
|
|||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P1">[[ repeatIn(ids_to_objects(data['form']['partner_id']),'o') ]] <font face="Times-Roman">[[ setLang(o.lang) ]]</font></para>
|
||||
<para style="P1">[[ repeatIn(ids_to_objects(data['form']['partner_ids'][0][2]),'o') ]] <font face="Times-Roman">[[ setLang(o.lang) ]]</font></para>
|
||||
<blockTable colWidths="286.0,224.0" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -73,147 +73,147 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ o.name ]]</para>
|
||||
<para style="P4">[[ adr_get(o, 'invoice')['name'] ]]</para>
|
||||
<para style="P4">[[ adr_get(o, 'invoice')['street'] ]]</para>
|
||||
<para style="P4">[[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]]</para>
|
||||
<para style="P4">[[ adr_get(o, 'invoice')['country_id'][1] ]]</para>
|
||||
<para style="P4">
|
||||
<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">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">VAT: [[ o.vat or removeParentNode('para') ]]</para>
|
||||
<para style="P13">VAT: [[ o.vat or removeParentNode('para') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P5">
|
||||
<para style="P17">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P6">
|
||||
<para style="P18">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4"><font face="Times-Roman">Document</font><font face="Times-Roman">:</font> Customer account statement</para>
|
||||
<para style="P4">
|
||||
<para style="P13"><font face="Times-Roman">Document</font><font face="Times-Roman">:</font> Customer account statement</para>
|
||||
<para style="P13">
|
||||
<font face="Times-Roman">Date: </font>
|
||||
<font face="Times-Roman">[[ time.strftime('%d/%m/%Y') ]]</font>
|
||||
</para>
|
||||
<para style="P7"><font face="Times-Roman">Customer Ref:</font> [[ o.id ]]</para>
|
||||
<para style="P8">
|
||||
<para style="P15"><font face="Times-Roman">Customer Ref:</font> [[ o.id ]]</para>
|
||||
<para style="P16">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P8">Dear Sir/Madam,</para>
|
||||
<para style="P8">
|
||||
<para style="P16">Dear Sir/Madam,</para>
|
||||
<para style="P16">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P8">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="P8">
|
||||
<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">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P8">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="P8">
|
||||
<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">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P8">Best regards.</para>
|
||||
<para style="P9">
|
||||
<para style="P16">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">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P10">Date</para>
|
||||
<para style="P3">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Description</para>
|
||||
<para style="P3">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Ref</para>
|
||||
<para style="P3">Ref</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Maturity date</para>
|
||||
<para style="P3">Maturity date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">Due</para>
|
||||
<para style="P4">Due</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">Paid</para>
|
||||
<para style="P4">Paid</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">Maturity</para>
|
||||
<para style="P4">Maturity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">Li.</para>
|
||||
<para style="P4">Li.</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<para style="P5">
|
||||
<font face="Times-Roman">[[repeatIn(getLines(o), 'line') ]]</font>
|
||||
<font face="Times-Roman"> [[ line['date'] ]]</font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ line['name'] ]]</para>
|
||||
<para style="P6">[[ line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P14">[[ line['ref'] ]]</para>
|
||||
<para style="P7">[[ line['ref'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P14">[[ line['date_maturity'] ]]</para>
|
||||
<para style="P7">[[ line['date_maturity'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ line['debit'] and '%.2f' % line['debit'] or '' ]]</para>
|
||||
<para style="P10">[[ line['debit'] and '%.2f' % line['debit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">[[ line['credit'] and '%.2f' % line['credit'] or '' ]]</para>
|
||||
<para style="P8">[[ line['credit'] and '%.2f' % line['credit'] or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and (line['debit'] - line['credit']) or '' ]]</para>
|
||||
<para style="P8">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and (line['debit'] - line['credit']) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">[[ line['blocked'] and 'X' or '' ]]</para>
|
||||
<para style="P8">[[ line['blocked'] and 'X' or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="318.0,61.0,56.0,56.0,19.0" style="Tableau6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P17">Sub-Total: </para>
|
||||
<para style="P11">Sub-Total: </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P17">[[ '%.2f' % (reduce(lambda x,y: x+y['debit'], getLines(o), 0)) ]]</para>
|
||||
<para style="P11">[[ '%.2f' % (reduce(lambda x,y: x+y['debit'], getLines(o), 0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">
|
||||
<para style="P8">
|
||||
<font face="Times-Bold">[[ '%.2f' % (reduce(lambda x,y: x+y['credit'], getLines(o), 0)) ]]</font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ 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="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>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">
|
||||
<para style="P20">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P17">Balance: </para>
|
||||
<para style="P11">Balance: </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P17">[[ '%.2f' % (reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0)) ]]</para>
|
||||
<para style="P11">[[ '%.2f' % (reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P19">
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P17">
|
||||
<para style="P11">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">
|
||||
<para style="P20">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
|
@ -222,11 +222,11 @@
|
|||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P20">
|
||||
<para style="P14">
|
||||
<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="P4">
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
|
|
|
@ -44,8 +44,9 @@ class report_rappel(report_sxw.rml_parse):
|
|||
})
|
||||
|
||||
def _ids_to_objects(self, partners_ids):
|
||||
toto = pooler.get_pool(self.cr.dbname).get('res.partner').browse(self.cr, self.uid, partners_ids)
|
||||
return toto
|
||||
pool = pooler.get_pool(self.cr.dbname)
|
||||
partners = pool.get('res.partner').browse(self.cr, self.uid, partners_ids)
|
||||
return partners
|
||||
|
||||
def _adr_get(self, partner, type):
|
||||
res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
|
||||
|
@ -55,7 +56,13 @@ class report_rappel(report_sxw.rml_parse):
|
|||
|
||||
def _lines_get(self, partner):
|
||||
moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
movelines = moveline_obj.search(self.cr, self.uid, [('partner_id','=',partner.id), ('account_id','=','type:receivable'), ('reconcile_id','=',False),('state','<>','draft')])
|
||||
movelines = moveline_obj.search(self.cr, self.uid,
|
||||
[('partner_id', '=', partner.id),
|
||||
('account_id.type', '=', 'receivable'),
|
||||
('reconcile_id', '=', False), ('state', '<>', 'draft')])
|
||||
movelines = moveline_obj.read(self.cr, self.uid, movelines)
|
||||
return movelines
|
||||
report_sxw.report_sxw('report.account_followup.followup.print', 'res.partner', 'addons/account_followup/report/rappel.rml',parser=report_rappel)
|
||||
|
||||
report_sxw.report_sxw('report.account_followup.followup.print',
|
||||
'res.partner', 'addons/account_followup/report/rappel.rml',
|
||||
parser=report_rappel)
|
||||
|
|
|
@ -28,26 +28,28 @@
|
|||
import wizard
|
||||
import datetime
|
||||
import pooler
|
||||
import time
|
||||
|
||||
_followup_wizard_all_form = """<?xml version="1.0"?>
|
||||
<form string="Select partners" colspan="4">
|
||||
<notebook>
|
||||
<page string="FollowUp selection">
|
||||
<separator string="Select partners to remind" colspan="4"/>
|
||||
<field name="partner_ids" colspan="4" nolabel="1"/>
|
||||
</page><page string="Email confirmation">
|
||||
<label string="Not yet implemented !" colspan="4"/>
|
||||
<field name="email_conf" 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"/>
|
||||
</page>
|
||||
<page string="FollowUp selection">
|
||||
<separator string="Select partners to remind" colspan="4"/>
|
||||
<field name="partner_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Email confirmation">
|
||||
<label string="Not yet implemented !" colspan="4"/>
|
||||
<field name="email_conf" 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"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>"""
|
||||
|
||||
|
@ -84,41 +86,36 @@ Thanks,
|
|||
|
||||
|
||||
class followup_all_print(wizard.interface):
|
||||
def _update_partners(self, cr, uid, data, context):
|
||||
to_update = data['form']['to_update']
|
||||
for id in to_update.keys():
|
||||
cr.execute(
|
||||
"UPDATE account_move_line "\
|
||||
"SET followup_line_id=%d, followup_date=%s "\
|
||||
"WHERE id=%d",
|
||||
(to_update[id],
|
||||
time.strftime('%Y-%m-%d'), int(id),))
|
||||
return {}
|
||||
|
||||
def _get_partners(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
cr.execute(
|
||||
"SELECT distinct l.partner_id "\
|
||||
"FROM account_move_line AS l LEFT JOIN account_account AS a "\
|
||||
"SELECT l.partner_id, l.followup_line_id, l.date, l.id "\
|
||||
"FROM account_move_line AS l "\
|
||||
"LEFT JOIN account_account AS a "\
|
||||
"ON (l.account_id=a.id) "\
|
||||
"WHERE (l.reconcile_id IS NULL) "\
|
||||
"AND (a.type='receivable') "\
|
||||
"AND (l.state<>'draft') "\
|
||||
"AND (l.reconcile_id is NULL) "\
|
||||
"AND (l.partner_id is NOT NULL) "\
|
||||
"AND a.active ")
|
||||
ids = map(lambda x: x[0], cr.fetchall())
|
||||
return {'partner_ids': ids}
|
||||
|
||||
def _update_partners(self, cr, uid, data, context):
|
||||
partner_ids = data['form']['partner_ids'][0][2]
|
||||
if partner_ids:
|
||||
cr.execute(
|
||||
"SELECT l.partner_id, l.followup_line_id, l.date, l.id "\
|
||||
"FROM account_move_line AS l LEFT JOIN account_account AS a "\
|
||||
"ON (l.account_id=a.id) "\
|
||||
"WHERE (l.reconcile_id IS NULL) "\
|
||||
"AND (a.type='receivable') "\
|
||||
"AND (l.state<>'draft') "\
|
||||
"AND (l.reconcile_id is NULL) "\
|
||||
"AND partner_id in ("+','.join(map(str,partner_ids))+") "\
|
||||
"AND a.active "\
|
||||
"ORDER BY l.date")
|
||||
move_lines = cr.fetchall()
|
||||
else:
|
||||
move_lines = []
|
||||
"AND partner_id is NOT NULL "\
|
||||
"AND a.active "\
|
||||
"ORDER BY l.date")
|
||||
move_lines = cr.fetchall()
|
||||
|
||||
old = None
|
||||
fups = {}
|
||||
fup_ids = pooler.get_pool(cr.dbname).get('account_followup.followup').search(cr, uid, [])
|
||||
fup_ids = pool.get('account_followup.followup').search(cr, uid, [])
|
||||
if not fup_ids:
|
||||
raise wizard.except_wizard('No Follow up Defined',
|
||||
'You must define at least one follow up for your company !')
|
||||
|
@ -140,6 +137,7 @@ class followup_all_print(wizard.interface):
|
|||
fups[old] = (datetime.date(datetime.MAXYEAR, 12, 31), old)
|
||||
|
||||
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):
|
||||
continue
|
||||
|
@ -147,13 +145,9 @@ class followup_all_print(wizard.interface):
|
|||
continue
|
||||
if date <= fups[followup_line_id][0].strftime('%Y-%m-%d'):
|
||||
partner_list.append(partner_id)
|
||||
cr.execute(
|
||||
"UPDATE account_move_line "\
|
||||
"SET followup_line_id=%d, followup_date=%s "\
|
||||
"WHERE id=%d",
|
||||
(fups[followup_line_id][1],
|
||||
current_date.strftime('%Y-%m-%d'), id,))
|
||||
return {'partner_id': partner_list}
|
||||
to_update[str(id)] = fups[followup_line_id][1]
|
||||
return {'partner_ids': partner_list, 'to_update': to_update}
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions': [_get_partners],
|
||||
|
@ -165,7 +159,9 @@ class followup_all_print(wizard.interface):
|
|||
},
|
||||
'print': {
|
||||
'actions': [_update_partners],
|
||||
'result': {'type':'print', 'report':'account_followup.followup.print', 'state':'end'},
|
||||
'result': {'type': 'print',
|
||||
'report':'account_followup.followup.print',
|
||||
'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue