← Back to team overview

banking-addons-team team mailing list archive

lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-logger into lp:banking-addons/bank-statement-reconcile-70

 

Nicolas Bessi - Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-logger into lp:banking-addons/bank-statement-reconcile-70.

Requested reviews:
  Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-fix-logger/+merge/145332

Fix logger + use of mail thread system
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-fix-logger/+merge/145332
Your team Banking Addons Team is subscribed to branch lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_statement_base_import/statement.py'
--- account_statement_base_import/statement.py	2012-12-20 13:40:22 +0000
+++ account_statement_base_import/statement.py	2013-01-29 09:23:22 +0000
@@ -43,7 +43,7 @@
             help="Tic that box to automatically launch the completion "
                  "on each imported file using this profile."),
         'last_import_date': fields.datetime("Last Import Date"),
-        'rec_log': fields.text('log', readonly=True),
+        'rec_log': fields.text('log', readonly=True, deprecated=True),
         'import_type': fields.selection(
             get_import_type_selection,
             'Type of import',
@@ -55,29 +55,17 @@
 
     def write_logs_after_import(self, cr, uid, ids, statement_id, num_lines, context):
         """
-        Write the log in the logger + in the log field of the profile to report the user about
-        what has been done.
+        Write the log in the logger
 
         :param int/long statement_id: ID of the concerned account.bank.statement
         :param int/long num_lines: Number of line that have been parsed
         :return: True
         """
-        if isinstance(ids, (int, long)):
-            ids = [ids]
-        for id in ids:
-            log = self.read(cr, uid, id, ['rec_log'], context=context)['rec_log']
-            log_line = log and log.split("\n") or []
-            import_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
-            log_line[0:0] = [import_date + ' : '
-                + _("Bank Statement ID %s have been imported with %s lines ") % (statement_id, num_lines)]
-            log = "\n".join(log_line)
-            self.write(cr, uid, id, {'rec_log': log, 'last_import_date': import_date}, context=context)
-            self.message_post(
-                    cr,
-                    uid,
-                    [statement_id],
-                    body=_('Statement ID %s have been imported with %s lines.') % (statement_id, num_lines),
-                    context=context)
+        self.message_post(cr,
+                          uid,
+                          ids,
+                          body=_('Statement ID %s have been imported with %s lines.') % (statement_id, num_lines),
+                          context=context)
         return True
 
     def prepare_global_commission_line_vals(

=== modified file 'account_statement_base_import/statement_view.xml'
--- account_statement_base_import/statement_view.xml	2012-12-18 20:38:21 +0000
+++ account_statement_base_import/statement_view.xml	2013-01-29 09:23:22 +0000
@@ -16,10 +16,12 @@
                 <field name="import_type"/>
                 <button name="%(account_statement_base_import.statement_importer_action)d"
                                                         string="Import Bank Statement"
-                                                        type="action" icon="gtk-ok" 
+                                                        type="action" icon="gtk-ok"
                                                         colspan = "2"/>
-                <separator colspan="4" string="Import Logs"/>
-                <field name="rec_log" colspan="4" nolabel="1"/>
+                <group attrs="{'invisible': [('rec_log', '=', False)]}">
+                    <separator colspan="4" string="Historical Import Logs"/>
+                    <field name="rec_log" colspan="4" nolabel="1" />
+                </group>
             </field>
         </field>
     </record>
@@ -39,6 +41,6 @@
          </field>
      </record>
 
-    
+
 </data>
 </openerp>

=== modified file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py	2012-12-20 13:41:45 +0000
+++ account_statement_ext/statement.py	2013-01-29 09:23:22 +0000
@@ -31,6 +31,8 @@
     journal to use, the partner and commision account and so on.
     """
     _name = "account.statement.profile"
+    _inherit = ['mail.thread']
+
     _description = "Statement Profil"
 
     _columns = {

=== modified file 'account_statement_ext/statement_view.xml'
--- account_statement_ext/statement_view.xml	2013-01-10 14:51:19 +0000
+++ account_statement_ext/statement_view.xml	2013-01-29 09:23:22 +0000
@@ -18,6 +18,7 @@
                 <field name="force_partner_on_bank"/>
                 <field name="balance_check"/>
                 <field name="bank_statement_prefix"/>
+                <field name="message_ids" widget="mail_thread" placeholder="Share a note..." colspan="4"/>
             </form>
         </field>
     </record>
@@ -46,10 +47,10 @@
         <field name="view_mode">tree,form</field>
     </record>
 
-    <menuitem string="Bank Statements Profile" action="action_treasury_statement_profile_tree" id="menu_treasury_statement_profile_tree" parent="account.menu_configuration_misc" sequence="30"/>    
-
-    
-    
+    <menuitem string="Bank Statements Profile" action="action_treasury_statement_profile_tree" id="menu_treasury_statement_profile_tree" parent="account.menu_configuration_misc" sequence="30"/>
+
+
+
     <record id="view_treasury_statement_search" model="ir.ui.view">
         <field name="name">account.bank.statement.search</field>
         <field name="model">account.bank.statement</field>
@@ -87,7 +88,7 @@
         </field>
     </record>
 
-  
+
   <record id="view_treasury_statement_form" model="ir.ui.view">
       <field name="name">account.bank.statement.form</field>
       <field name="model">account.bank.statement</field>
@@ -98,7 +99,7 @@
           <!-- Add before the group : profile and related infos -->
           <xpath expr="/form/sheet/group/group/field[@name='journal_id']" position="replace">
           </xpath>
-          
+
           <xpath expr="/form/sheet/group" position="after">
               <group>
                   <field name="profile_id" select="1" required="1" on_change="onchange_imp_config_id(profile_id)" widget="selection"/>
@@ -109,7 +110,7 @@
                    <field name="balance_check" invisible="1"/>
               </group>
           </xpath>
-          
+
           # Make balance visible or not depending on profile
           <xpath expr="/form/sheet/group/group/field[@name='balance_start']" position="attributes">
               <attribute name="attrs">{'invisible':[('balance_check','=',False)]}</attribute>
@@ -120,11 +121,11 @@
           <xpath expr="/form/sheet/group/group/field[@name='balance_end_real']" position="after">
                <field name="balance_end" widget="monetary" options='{"currency_field" : "currency"}' attrs="{'invisible':[('balance_check','=',False)]}"/>
           </xpath>
-          
+
           <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='sequence']" position="after">
               <field name="id" readonly="1" />
           </xpath>
-                    
+
           <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='date']" position="before">
               <field name="id" readonly="1" />
           </xpath>
@@ -132,7 +133,7 @@
           <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='partner_id']" position="replace">
               <field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
           </xpath>
-          
+
           <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='partner_id']" position="replace">
              <field name="partner_id" on_change="onchange_partner_id(partner_id,parent.profile_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/>
           </xpath>
@@ -142,18 +143,18 @@
           <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='type']" position="replace">
                <field name="type" on_change="onchange_type(partner_id, type, parent.profile_id)"/>
           </xpath>
-          
+
       </field>
   </record>
 
-    
+
         <act_window id="act_bank_statement_from_profile"
-            name="Open Statements" 
-            res_model="account.bank.statement" 
-            src_model="account.statement.profile" 
+            name="Open Statements"
+            res_model="account.bank.statement"
+            src_model="account.statement.profile"
             domain="[('profile_id','=',active_id),]"
             view_type="form"/>
-        
+
 
 </data>
 </openerp>


Follow ups