[REF] code review
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 25 Jun 2012 15:55:40 +0000 (17:55 +0200)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 25 Jun 2012 15:55:40 +0000 (17:55 +0200)
bzr revid: qdp-launchpad@openerp.com-20120625155540-n0e5lm0rhytsk22t

addons/account_analytic_analysis/account_analytic_analysis_view.xml
addons/analytic/analytic_view.xml
addons/analytic_contract_project/analytic_contract_project.py
addons/hr_timesheet_invoice/hr_timesheet_invoice.py

index cc1d674..be7af1d 100644 (file)
                 <xpath expr='//div[@name="duration"]' position="after" version="7.0">
                     <label for="quantity_max"/>
                     <div>
-                        <field name="quantity_max" class="oe_form_inline"/> / Remaining:
-                        <field name="remaining_hours" class="oe_form_inline"/>
+                        <field name="quantity_max" class="oe_form_inline"/> / Remaining: <field name="remaining_hours" class="oe_form_inline"/>
                     </div>
                 </xpath>
-                 <xpath expr="//field[@name='use_timesheets']" position="replace">
-                    <group colspan="2" col="4">
-                        <field name="use_timesheets" on_change="on_change_use_timesheets(use_timesheets, context)"/>
-                        <field name="to_invoice" attrs="{'required': [('invoice_on_timesheets', '=', True)],'invisible': [('invoice_on_timesheets','=',False)]}"/>
+                <xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">
+                    <group name='invoice_on_timesheets' string="Invoice on Timesheets Options" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" col="4">
+                        <field name="pricelist_id" attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
+                        <field name="to_invoice" widget="selection" attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
                     </group>
                 </xpath>
-                <xpath expr="//group[@name='invoice_on_timesheets']" position="replace"/>
                 <xpath expr='//group[@name="master"]' position='after'>
                     <separator name="toinvoice" string="Invoicing"/>
-                    <group>
-                        <group>
-                            <field name="pricelist_id" attrs="{'required': [('invoice_on_timesheets', '=', True)],'invisible': [('invoice_on_timesheets','=',False)]}"/>
-                        </group>
-                        <group></group>
-                    </group>
                     <table width="100%%">
                         <tr>
                             <th></th>
index 4fa01a9..1ff623e 100644 (file)
@@ -29,9 +29,9 @@
                             <page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
                                 <group name="master">
                                     <group string="Validity" name="contract">
-                                        <label string="Duration"/>
+                                        <label for="date_start" string="Duration"/>
                                         <div name="duration">
-                                            <field name="date_start"/> - <field name="date"/>
+                                            <field name="date_start" class="oe_form_inline"/> - <field name="date" class="oe_form_inline"/>
                                         </div>
                                     </group>
                                     <group name="project">
index 9ddc75e..6221617 100644 (file)
@@ -77,7 +77,7 @@ class task(osv.osv):
     
     def create(self, cr, uid, vals, context=None):
         task_id = super(task, self).create(cr, uid, vals, context=context)
-        task_browse = self.browse(cr,uid,task_id,context)
-        self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task has been <b>created</b>."), context=context)
+        task_browse = self.browse(cr, uid, task_id, context=context)
+        self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task <em>%s</em> has been <b>created</b>.") % (task_browse.name), context=context)
         return task_id
 task()
index 87539de..81b6325 100644 (file)
@@ -69,7 +69,7 @@ class account_analytic_account(osv.osv):
             help="Keep empty if this contract is not limited to a total fixed price."),
         'amount_invoiced': fields.function(_invoiced_calc, string='Invoiced Amount',
             help="Total invoiced"),
-        'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Invocing Ratio',
+        'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Timesheet Invoicing Ratio',
             help="Fill this field if you plan to automatically generate invoices based " \
             "on the costs in this analytic account: timesheets, expenses, ..." \
             "You can configure an automatic invoice rate on analytic accounts."),
@@ -95,39 +95,27 @@ class account_analytic_account(osv.osv):
 
     def set_close(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, {'state':'close'}, context=context)
-        self.set_close_send_note(cr, uid, ids, context)
+        message = _("Contract has been <b>closed</b>.")
+        self.message_append_note(cr, uid, ids, body=message, context=context)
         return True
 
     def set_cancel(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
-        self.set_cancel_send_note(cr, uid, ids, context)
+        message = _("Contract has been <b>cancelled</b>.")
+        self.message_append_note(cr, uid, ids, body=message, context=context)
         return True
 
     def set_open(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, {'state':'open'}, context=context)
-        self.set_open_send_note(cr, uid, ids, context)
+        message = _("Contract has been <b>opened</b>.")
+        self.message_append_note(cr, uid, ids, body=message, context=context)
         return True
 
     def set_pending(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, {'state':'pending'}, context=context)
-        self.set_pending_send_note(cr, uid, ids, context)
+        message = _("Contract has been set as <b>pending</b>.")
+        self.message_append_note(cr, uid, ids, body=message, context=context)
         return True
-    
-    def set_open_send_note(self, cr, uid, ids, context=None):
-        message = _("Contract has been <b>opened</b>.")
-        return self.message_append_note(cr, uid, ids, body=message, context=context)
-    
-    def set_close_send_note(self, cr, uid, ids, context=None):
-        message = _("Contract has been <b>closed</b>.")
-        return self.message_append_note(cr, uid, ids, body=message, context=context)
-    
-    def set_cancel_send_note(self, cr, uid, ids, context=None):
-        message = _("Contract has been <b>cancelled</b>.")
-        return self.message_append_note(cr, uid, ids, body=message, context=context)
-
-    def set_pending_send_note(self, cr, uid, ids, context=None):
-        message = _("Contract has been <b>pending</b>.")
-        return self.message_append_note(cr, uid, ids, body=message, context=context)
 
 account_analytic_account()