From 233a8f4e30332d937cd6022fcdaa0e58cc7e7294 Mon Sep 17 00:00:00 2001 From: Marc Cassuto Date: Tue, 5 Aug 2014 11:18:24 -0400 Subject: [PATCH] [ADD] new module account_partner_aged_statement --- .../__init__.py | 23 +++ .../__init__.pyc | Bin 0 -> 314 bytes .../__openerp__.py | 59 +++++++ .../partner_aged_statement.py | 71 ++++++++ .../partner_aged_statement.pyc | Bin 0 -> 1998 bytes .../partner_aged_statement_data.xml | 80 +++++++++ .../partner_aged_statement_report.xml | 27 +++ .../partner_aged_statement_view.xml | 21 +++ .../report/__init__.py | 20 +++ .../report/__init__.pyc | Bin 0 -> 306 bytes .../report/partner_aged_statement.mako | 164 ++++++++++++++++++ .../report/partner_aged_statement_report.py | 53 ++++++ .../report/partner_aged_statement_report.pyc | Bin 0 -> 1691 bytes 13 files changed, 518 insertions(+) create mode 100644 account_partner_aged_statement_webkit/__init__.py create mode 100644 account_partner_aged_statement_webkit/__init__.pyc create mode 100644 account_partner_aged_statement_webkit/__openerp__.py create mode 100644 account_partner_aged_statement_webkit/partner_aged_statement.py create mode 100644 account_partner_aged_statement_webkit/partner_aged_statement.pyc create mode 100644 account_partner_aged_statement_webkit/partner_aged_statement_data.xml create mode 100644 account_partner_aged_statement_webkit/partner_aged_statement_report.xml create mode 100644 account_partner_aged_statement_webkit/partner_aged_statement_view.xml create mode 100644 account_partner_aged_statement_webkit/report/__init__.py create mode 100644 account_partner_aged_statement_webkit/report/__init__.pyc create mode 100644 account_partner_aged_statement_webkit/report/partner_aged_statement.mako create mode 100644 account_partner_aged_statement_webkit/report/partner_aged_statement_report.py create mode 100644 account_partner_aged_statement_webkit/report/partner_aged_statement_report.pyc diff --git a/account_partner_aged_statement_webkit/__init__.py b/account_partner_aged_statement_webkit/__init__.py new file mode 100644 index 00000000..3057d1dc --- /dev/null +++ b/account_partner_aged_statement_webkit/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- + +############################################################################ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import ( + partner_aged_statement, + report, +) diff --git a/account_partner_aged_statement_webkit/__init__.pyc b/account_partner_aged_statement_webkit/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09ec56c48c110d3f67a597ba4966448a130f4855 GIT binary patch literal 314 zcmZvWO-ckY5QQr}AR@RE7oMOuZ7v`p2(Cm1dpDbqNov|?=Z91^!`#4?m+)Mk!V6g4 z{;Ukimlqzd@>ZXxC$H}xy@Q|C$bBP+E(Bh-f)OAp*eHk%Y#LC$fxcad9h9J*6MQZx zwsOL1?10`7TgHfq`ADpaC0Bk}QY>$HT(IP4)&7CrMCzv;QAcNqCeFIQyVvWQpOH!5 zPFq}$mN+=lxuASlbi#d?u_K%OK@WkobuLedyIn{&xnRfcyFp09uV?^5XP4ZKS literal 0 HcmV?d00001 diff --git a/account_partner_aged_statement_webkit/__openerp__.py b/account_partner_aged_statement_webkit/__openerp__.py new file mode 100644 index 00000000..59b0370b --- /dev/null +++ b/account_partner_aged_statement_webkit/__openerp__.py @@ -0,0 +1,59 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Savoir-faire Linux +# (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + +{ + 'name': 'Partner Aged Statement', + "version": "1.0", + 'author': 'Savoir-faire Linux', + 'website': 'http://www.savoirfairelinux.com', + 'depends': [ + 'account_financial_report_webkit_xls', + 'report_webkit', + 'base_headers_webkit', + 'mail', + ], + 'category': 'Accounting', + 'description': """ +Print & Send Partner Aged Statement by email +============================================ + +This module adds in the system : + * a new mail template "Aged Statement Letter"; + * the abitlity to print the partner aged statement; + * a button "Send by email" in the pricelist form view which load the template + and attache the pricelist to the email. + +So far the module does not drill down through pricelist items that are +based on another pricelist or based on purchase pricelists. + +Contributors +------------ +* Marc Cassuto (marc.cassuto@savoirfairelinux.com) + """, + 'data': [ + 'partner_aged_statement_report.xml', + 'partner_aged_statement_view.xml', + 'partner_aged_statement_data.xml', + ], + 'active': False, + 'installable': True +} diff --git a/account_partner_aged_statement_webkit/partner_aged_statement.py b/account_partner_aged_statement_webkit/partner_aged_statement.py new file mode 100644 index 00000000..80ef5991 --- /dev/null +++ b/account_partner_aged_statement_webkit/partner_aged_statement.py @@ -0,0 +1,71 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2010 - 2014 Savoir-faire Linux +# (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + +import time +from openerp.osv import orm + + +class PartnerAgedStatement(orm.Model): + _inherit = 'res.partner' + + def action_aged_statement_send(self, cr, uid, ids, context=None): + # This function opens a window to compose an email, + # with the partner aged statemen template message loaded by default + + # This option should only be used for a single id at a time. + assert len(ids) == 1 + + ir_model_data = self.pool.get('ir.model.data') + try: + template_id = ir_model_data.get_object_reference( + cr, uid, + 'account_partner_aged_statement_webkit', + 'email_template_aged_statement')[1] + except ValueError: + template_id = False + + try: + compose_form_id = ir_model_data.get_object_reference( + cr, uid, 'mail', 'email_compose_message_wizard_form')[1] + except ValueError: + compose_form_id = False + + ctx = dict(context) + ctx.update({ + 'default_model': 'res.partner', + 'default_res_id': ids[0], + 'default_use_template': bool(template_id), + 'default_template_id': template_id, + 'default_composition_mode': 'comment', + }) + # Full explanation of this return is here : + # http://stackoverflow.com/questions/12634031 + return { + 'type': 'ir.actions.act_window', + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'mail.compose.message', + 'views': [(compose_form_id, 'form')], + 'view_id': compose_form_id, + 'target': 'new', + 'context': ctx, + } diff --git a/account_partner_aged_statement_webkit/partner_aged_statement.pyc b/account_partner_aged_statement_webkit/partner_aged_statement.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e81929e60052f4a03b2c8bace8f5fa72b51a7f6 GIT binary patch literal 1998 zcmd5+$!;4*5Url!CQ7m;FVPYthz|jngE%(=28GNSWl z9Z;qy59mA~r9(0S%|n_h(k*&VbWQZjc}pZFgEpk?-*`?33QHEXWu5aQ%x6i>g{hy< zjGl19CN~A&*bl()Eq-^5!N4-KV+=^+Q}kXDOpGT3QRucY)W!{~Mq?^gxA4pS0>AqT z#+hgp(lzubx(vu25-a*u(TZs90YEcO-?i!L3tF{l-l7#wVJ;M4*B;T)yAJ(S98inf zblImmC8ZR12;@T1&vzx;q&qi~-G52`zLD&DN$%1LMqs~3s~*jJWFg!o-J=oQ)?0L> z`!wP$T0tW~Y=hn*y+b3tOZpy-KvcFz`abDB5cf$xXr_ml9+7?w0qEPOX+Se5_@vn% z;PjC65q1zhrqN{ZDMEH?C0}kAgRO^osZBQ23DWc>C`p=@i-O~IyyFBZjNK-O@zPve zTISEdY4XHoF>+gF$nYITZh=D>_{j}xTIN;hOq?6%pf+CGw@IzzDT?N9npvFFW|}NA zj=hH#1mb(Q$f%0gYF};}&IPn@9O8$!csE25=zD%h;1|cH+8|hLBJU*8v!=1K@=Og$IbLYg9Pzp;rcP zr3nhNL>&TtQqK&p0TgWB@Srbb;mH6;qVwE2Q;Wmj)pc2W2dlEoJdX&AGnnJ@Vr~Ga zHd9lZA~h_UeoV53X#~Zamr3RtjM}E`U0778l!kTzwF5!wjX0A{Svotdy{*OCcdOl4 z0_ihq>jrD=%S~GQc4F>}^twhQsFEy!mhzhcCh~*(4Xfx?nVTq26XzCOMw6G{M`v|8 zH|(Mpiwkp>C5~p3v0v?|E!9=qSYvF3 z7@K#`&!_(KZ8Z()Ay`N=GO + + + + + + + Aged Statement Letter + ${(user.email or '')|safe} + ${object.company_id.name} - Your aged balance + ${object.id or ''|safe} + + + + + ${(object.name or '').replace('/','_')} + + + +

Dear Sir/Madam,

+ +

Our records indicate that some payments on your account are still due. +
+ Please find in the attached document your aged balance +
+ If the amount has already been paid, please disregard this notice. + Otherwise, please forward us the total amount stated below. +

+ +

+   REFERENCES
+   Total overdue amount: ${object.credit} ${user.company_id.currency_id.name}
+

+ +

If you have any question, do not hesitate to contact us.

+

Best Regards,

+
+
+
+

+ ${user.company_id.name}

+
+
+ + % if user.company_id.street: + ${user.company_id.street}
+ % endif + % if user.company_id.street2: + ${user.company_id.street2}
+ % endif + % if user.company_id.city or user.company_id.zip: + ${user.company_id.zip} ${user.company_id.city}
+ % endif + % if user.company_id.country_id: + ${user.company_id.state_id and ('%s, ' % user.company_id.state_id.name) or ''} ${user.company_id.country_id.name or ''}
+ % endif +
+ % if user.company_id.phone: +
+ Phone:  ${user.company_id.phone} +
+ % endif + % if user.company_id.website: + + %endif +

+
+ + ]]>
+
+
+
diff --git a/account_partner_aged_statement_webkit/partner_aged_statement_report.xml b/account_partner_aged_statement_webkit/partner_aged_statement_report.xml new file mode 100644 index 00000000..9e7762c0 --- /dev/null +++ b/account_partner_aged_statement_webkit/partner_aged_statement_report.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/account_partner_aged_statement_webkit/partner_aged_statement_view.xml b/account_partner_aged_statement_webkit/partner_aged_statement_view.xml new file mode 100644 index 00000000..4f2a7cd4 --- /dev/null +++ b/account_partner_aged_statement_webkit/partner_aged_statement_view.xml @@ -0,0 +1,21 @@ + + + + + + + res.partner + + +
+
+
+
+
+ +
+
diff --git a/account_partner_aged_statement_webkit/report/__init__.py b/account_partner_aged_statement_webkit/report/__init__.py new file mode 100644 index 00000000..9fe8d055 --- /dev/null +++ b/account_partner_aged_statement_webkit/report/__init__.py @@ -0,0 +1,20 @@ +# -*- encoding: utf-8 -*- + +############################################################################### +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + +from . import partner_aged_statement_report diff --git a/account_partner_aged_statement_webkit/report/__init__.pyc b/account_partner_aged_statement_webkit/report/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4226b5bb522a8baa3aaf11b6faafae32f9f3fd36 GIT binary patch literal 306 zcmZ{gO-e&S4992MO%dF=b^kWcTtK8CxDqM8ott4g6JMvk`CyVq=@EJWFW|jAg%>bG zb>YI0{6a`b{$%-ed2#yq9Gv>Gh2*saT?xFnR+Caus~4@bU#Ov5N+W1N*TC0;Vk;-C z#*XL>v1N>y*iAD#vV?kW=>CG)hnKKLzkFcqEk4$hsZ*enO;@}8! zLAg^P;i1pilTH2zV_>k( + + + + + + <%! + def amount(text): + # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers) + return text.replace('-', '‑') + %> + + <%setLang(user.lang)%> + +
+
+
${_('Chart of Account')}
+
${_('Fiscal Year')}
+ <%doc> +
+ %if filter_form(data) == 'filter_date': + ${_('Dates Filter')} + %else: + ${_('Periods Filter')} + %endif +
+ + +
${_('Clearance Date')}
+
${_('Accounts Filter')}
+
${_('Target Moves')}
+ +
+ + <%doc> +
+
${ chart_account.name }
+
${ fiscalyear.name if fiscalyear else '-' }
+
+ ${_('From:')} + %if filter_form(data) == 'filter_date': + ${formatLang(start_date, date=True) if start_date else u'' } + %else: + ${start_period.name if start_period else u''} + %endif + ${_('To:')} + %if filter_form(data) == 'filter_date': + ${ formatLang(stop_date, date=True) if stop_date else u'' } + %else: + ${stop_period.name if stop_period else u'' } + %endif +
+
${ formatLang(date_until, date=True) }
+
+ %if partner_ids: + ${_('Custom Filter')} + %else: + ${ display_partner_account(data) } + %endif +
+
${ display_target_move(data) }
+
+
+ %for acc in objects: + %if acc.aged_lines: + + + + +
+
+
+ ## partner +
${_('Partner')}
+ ## code +
${_('code')}
+ ## balance +
${_('balance')}
+ ## Classifications + %for title in ranges_titles: +
${title}
+ %endfor +
+
+
+ %for partner_name, p_id, p_ref, p_name in acc.partners_order: + %if acc.aged_lines.get(p_id): +
+ <%line = acc.aged_lines[p_id]%> + <%percents = acc.aged_percents%> + <%totals = acc.aged_totals%> +
${partner_name}
+
${p_ref or ''}
+ +
${formatLang(line.get('balance') or 0.0) | amount}
+ %for classif in ranges: +
+ ${formatLang(line['aged_lines'][classif] or 0.0) | amount} +
+ %endfor +
+ %endif + %endfor +
+
${_('Total')}
+
+
${formatLang(totals['balance']) | amount}
+ %for classif in ranges: +
${formatLang(totals[classif]) | amount}
+ %endfor +
+ +
+
${_('Percents')}
+
+
+ %for classif in ranges: +
${formatLang(percents[classif]) | amount}%
+ %endfor +
+
+
+ + %endif + %endfor + + + +
+ + diff --git a/account_partner_aged_statement_webkit/report/partner_aged_statement_report.py b/account_partner_aged_statement_webkit/report/partner_aged_statement_report.py new file mode 100644 index 00000000..f954697c --- /dev/null +++ b/account_partner_aged_statement_webkit/report/partner_aged_statement_report.py @@ -0,0 +1,53 @@ +# -*- encoding: utf-8 -*- + +# ############################################################################## +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################### + + +import time +import operator +import itertools + +from openerp import pooler +from openerp.osv import orm +from openerp.report import report_sxw +from openerp.tools.translate import _ + +from openerp.addons.account_financial_report_webkit.report.aged_partner_balance import ( # noqa + AccountAgedTrialBalanceWebkit +) + + +class PartnerAgedStatementReport(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(PartnerAgedStatementReport, self).__init__(cr, uid, name, + context=context) + self.localcontext.update({ + 'time': time, + }) + + +report_sxw.report_sxw( + 'report.webkit.partner_aged_statement_report', + 'account.account', + ('addons/' + 'account_partner_aged_statement_webkit/' + 'report/' + 'partner_aged_statement.mako'), + parser=PartnerAgedStatementReport) + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_partner_aged_statement_webkit/report/partner_aged_statement_report.pyc b/account_partner_aged_statement_webkit/report/partner_aged_statement_report.pyc new file mode 100644 index 0000000000000000000000000000000000000000..717ac7e51cfa4cf35a82f32270a5850ca7da302b GIT binary patch literal 1691 zcmdT^&2H2%5FRJ{-)$)egaC1Z!%C=|8z(@tl{g?&sw@&Bm&i@rlEsN5dzQAMxAFu$ z1~0`!@BlDlXGQgJAbS51}4GHVSqh^cd<1WRqYIKyN@jg=|Xp5Yz~k zn{Z6~jNmK4CBTPl%X>#qj-i}DxdG)A)D~RELeLQxvrRf~^^2Z^nIIK8j@B5hY_Map zjje+*A;YTHSj^qoY4Gu^Jg5&z-7N~UYH;^NmG5jN^`6wSDb#y)^r=F;Pa_Vc#YR~k zu|SEcRt=_p(JL@{%{^-FHVH*Adgv%5!Yy6+&5AyCapME;Q*+NrAbkQZDE0`J5nPZ? zGG;a|dOm3CTgI^LK_vkDP)6|dQg}2MGmiBDha?NrpgKeB@tRewX1ogxr)^fPvMFmg zB9Z4+Q(>OtlniYOsn=6^#;PqTz?4^<`6;}fQ~DSqQVNT_tZ%ClzFg7C?d zd^EL6>OwlVLX#|By-5zOSt@kN{_02_YU!{lTw+>9u(nB~PIrvjak44TlamS)87SE~ zt{S3(IN1ptR?W$}FK+`Wxg=I{x27dO^|U2neDaq;p?BV%r(-(!V``3}0r5Z##Z-7$ zJFqxL0*mt~&udezG?{+dpP;>V(;{bfA5n8m>_E6D^y_d57|#C*p1VckJD%p<-@RpD zS(?WE51Qt+{A5CTOY5k-c}t&~o*T*@E0HRjIjm4wq)Wj0V(1bpr4GOi5}jji+~?F^ z8e7+#A?lQIz`NJ{e!V$b**MKb!Ksh0uMG&HuA|SdvNaDYcDXq3Q1ywr#`Gv$GN~_D u4#3u$Q`#wCsW&^fJU!1svAnoL!8yJ~r&L+fXj}L<+V0;Q4@6Awp!XZMe9l_{ literal 0 HcmV?d00001