[WIP] starting changes after revision
authorJosse Colpaert <jco@openerp.com>
Fri, 2 Nov 2012 09:36:31 +0000 (10:36 +0100)
committerJosse Colpaert <jco@openerp.com>
Fri, 2 Nov 2012 09:36:31 +0000 (10:36 +0100)
bzr revid: jco@openerp.com-20121102093631-9odoewlan9mny8w3

addons/account_followup/account_followup.py
addons/account_followup/account_followup_customers.xml
addons/account_followup/account_followup_data.xml
addons/account_followup/account_followup_view.xml
addons/account_followup/test/account_followup.yml

index 9ff6d3b..053561e 100644 (file)
@@ -49,9 +49,10 @@ class followup_line(osv.osv):
         'followup_id': fields.many2one('account_followup.followup', 'Follow Ups', required=True, ondelete="cascade"),
         'description': fields.text('Printed Message', translate=True),
         'send_email':fields.boolean('Send email', help="When processing, it will send an email"),
-        'send_letter':fields.boolean('Print email'),
+        'send_letter':fields.boolean('Send letter'),
         'phonecall':fields.boolean('Phone call'), 
-        'email_template_id':fields.many2one('email.template', 'Email template', required = False, ondelete='set null')
+        'email_template_id':fields.many2one('email.template', 'Email template', required = False, ondelete='set null'), 
+        'email_body':fields.related('email_template_id', 'body_html', type='text', string="Email Message"), 
     }
     _defaults = {
         'start': 'days',
@@ -244,7 +245,6 @@ class res_partner(osv.osv):
         #print partner_ids
         #print "Testing: " ,  fields.date.context_today(cr, uid, context)
         self.write(cr, uid, partner_ids, {'payment_next_action_date': fields.date.context_today(cr, uid, context),}, context)
-        
 
 
 
index a88ba06..4865993 100644 (file)
                                        <separator/>
                                        <filter string="Without responsible" domain="[('payment_responsible_id', '=', False)]"/>
                                        <filter string="I am responsible" domain="[('payment_responsible_id','=', uid)]"/>
-                                                               
                                </search>
                        </field>
                </record>
index 1fd6eca..b2fa4b6 100644 (file)
@@ -5,9 +5,9 @@
     <data noupdate="1">
 
         <!--Email template -->
-        <record id="email_template_account_followup" model="email.template">
-            <field name="name">Followup of outstanding accounts</field>
-            <field name="email_from">${object.user_id.email or ''}</field>
+        <record id="email_template_account_followup_level2" model="email.template">
+            <field name="name">Followup of overdue invoices level 2</field>
+            <field name="email_from">${user.email or ''}</field>
             <field name="subject">${object.company_id.name} Followup</field>
             <field name="email_to">${object.email}</field>
             <field name="lang">${object.lang}</field>
             <field name="body_html"><![CDATA[
 <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); ">
     
-    <p>Hello${object.name and ' ' or ''},</p>
-    
-    <p>We see in our books that some accounts are not settled yet:</p>
+    <p>Dear ${object.name and ' ' or ''},</p>
+    <p>
+    Despite several reminders, your account is still not settled.
+Unless full payment is made in next 8 days, legal action for the recovery of the debt will be taken without
+further notice.
+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 (+32).10.68.94.39.
+</p>
+<br/>
+Best Regards,
     
 
-    <table>
+    <table width=80%>
 
         <tr>
-            <td>Debit</td>
-            <td>Credit</td>
-            <td>Reference</td>
+               <td>Invoice date</td>
+               <td>Reference</td>
+            <td>Maturity date</td>
+            <td>Amount</td>            
+            <td>Lit.</td>
         </tr>
 
-        
 % for aml in object.accountmoveline_ids : 
 
 <tr>
 <td>
-${aml.debit}
+${aml.date}
+</td>
+<td>
+${aml.ref}
 </td>
 <td>
-${aml.credit}
+% if aml.date_maturity and aml.date_maturity > fields.date.context_today(cr, uid, context):
+${aml.date_maturity}
+% else: 
+${aml.date}
+% endif
 </td>
 <td>
-${aml.ref}
+${aml.debit}
+</td>
+<td>
+% if aml.blocked:
+ X
+% endif
 </td>
 </tr>
 % endfor
-</table>
-
-    
-
-    <p style="border-left: 1px solid #8e0000; margin-left: 30px;">
-       &nbsp;&nbsp;<strong>REFERENCES</strong><br />
-       &nbsp;&nbsp;Order number: <strong>${object.name}</strong><br />
-       &nbsp;&nbsp;Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
-    </p>
+</table>   
     <br/>
 </div>
             ]]></field>
index 5fd4487..081d92e 100644 (file)
             <field name="model">account_followup.followup.line</field>
             <field name="arch" type="xml">
                 <form string="Follow-up Steps" version="7.0">
-                    <group col="4">
+                    <group>
                        <field name="name"/>
+                       <group>
                        <field name="delay"/>
                        <field name="start"/>
+                       </group>
 
                     </group>
                     <separator string="Processing actions"/>
                        <field name="email_template_id"/>
                     </group>
                     <separator string="Message"/>
-                    <field name="description"/>
+                    <group col="4">
+                    <field name="description" attr="{'invisible': [('send_email', '=', False)]}" colspan="2"/>
+                    <field name="email_body" attr="{'invisible': [('send_letter', '=', False)]}" colspan="2"/>
+                    </group>
                     <separator string="Legend"/>
                     <group>
                         <label string="%%(partner_name)s: Partner Name"/>
index d015e30..82c580c 100644 (file)
@@ -6,7 +6,7 @@
     date_invoice: 2012-06-2
     invoice_line:
       - account_id : account.a_sale
-        name: 'Stupid PC'
+        name: 'Test PC'
         quantity: 1.0
     journal_id: account.bank_journal
     partner_id: base.res_partner_12
 - 
   !python {model: account.followup.print}:  |
     self.do_process(cr, uid, [ref("account_followup_print_0")], {"active_ids": [ref("account_followup.account_followup_print_menu")], "active_id": ref("account_followup.account_followup_print_menu"),})
-#- 
-#  Test it has everything
-#- 
-#  !assert {model: account.invoice, id: account.demo_invoice_0}:
-#    - reference_type = None
-  #!assert {model: res.partner, id: base.res_partner_12} :
-  #  - 
-      #latest_followup_level_id == ref("demo_followup_line1")
-    
+- 
+  Unnecessary test of invoice
+- 
+  !assert {model: account.invoice, id: account.demo_invoice_0}:
+    - check_total == 14.0
+-
+  Test latest followup level changed Python
+-
+  !python {model: res.partner, id: base.res_partner_12}:  |
+    assert(latest_followup_level_id == ref("demo_followup_line1"))
+-
+  Test latest followup level changed
+-
+    !assert {model: res.partner, id: base.res_partner_12} :
+      - latest_followup_level_id == ref("demo_followup_line1")
\ No newline at end of file