[IMP] contract management: misc code cleaning and improvements
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 15 Jun 2012 13:10:56 +0000 (15:10 +0200)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 15 Jun 2012 13:10:56 +0000 (15:10 +0200)
bzr revid: qdp-launchpad@openerp.com-20120615131056-swbbcy7obbbjjo33

addons/account_analytic_analysis/account_analytic_analysis_menu.xml
addons/account_analytic_analysis/account_analytic_analysis_view.xml
addons/analytic/analytic.py
addons/hr_timesheet_invoice/hr_timesheet_invoice.py
addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
addons/project/project_view.xml
addons/project_long_term/project_long_term_view.xml

index 4926123..a642e53 100644 (file)
@@ -63,7 +63,7 @@
             <field name="view_type">form</field>
             <field name="view_mode">tree,form,graph</field>
             <field name="context">{'search_default_user_id':uid, 'search_default_draft':1, 'search_default_pending':1, 'search_default_open':1, 'search_default_renew':1}</field>
-            <field name="domain">[('type','=','normal'),('partner_id', '!=', False)]</field>
+            <field name="domain">[('type','=','contract')]</field>
             <field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
             <field name="help">You will find here the contracts to be renewed because the deadline is passed or the working hours are higher than the allocated hours. OpenERP automatically sets these analytic accounts to the pending state, in order to raise a warning during the timesheets recording. Salesmen should review all pending accounts and reopen or close the according to the negotiation with the customer.</field>
         </record>
index f58b933..da6618f 100644 (file)
             <field name="domain">[('type','=','template')]</field>
             <field name="context">{'search_default_type':'template','default_type' : 'template'}</field>
         </record>
-        <menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config" />
+        <menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config"/>
     </data>
 </openerp>
index 84093af..fbc2fac 100644 (file)
@@ -20,7 +20,6 @@
 ##############################################################################
 
 import time
-from lxml import etree
 
 from osv import fields, osv
 from tools.translate import _
@@ -227,29 +226,6 @@ class account_analytic_account(osv.osv):
         default['line_ids'] = []
         return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
 
-    def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
-        if context is None:context = {}
-        
-        res = super(account_analytic_account, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
-        
-        doc = etree.XML(res['arch'])
-        node = []
-        if view_type == 'form':node = doc.xpath("//field[@name='name']")
-        if view_type == 'tree':node = doc.xpath("//field[@name='complete_name']")
-        if node:
-            curr_node = node[0]
-            if context.get('default_type') == 'contract':
-                curr_node.set('string', 'Contract/Project Name')
-                curr_node.set('placeholder', 'Contract or Project Name')
-            elif context.get('default_type') == 'template':
-                curr_node.set('string', 'Template Name')
-                curr_node.set('placeholder', 'Template Name')
-            else:
-                curr_node.set('string', 'Account Name')
-                curr_node.set('placeholder', 'Account Name')
-        res['arch'] = etree.tostring(doc)
-        return res
-
     def on_change_company(self, cr, uid, id, company_id):
         if not company_id:
             return {}
index 1535598..a45b2a1 100644 (file)
@@ -87,9 +87,10 @@ class account_analytic_account(osv.osv):
 
     def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None):
         res = super(account_analytic_account,self).on_change_partner_id(cr, uid, ids,partner_id, name, context=context)
-        part = self.pool.get('res.partner').browse(cr, uid, partner_id,context=context)
+        part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
         pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
-        if pricelist:res['value']['pricelist_id'] = pricelist
+        if pricelist:
+            res['value']['pricelist_id'] = pricelist
         return res
 
     def set_close(self, cr, uid, ids, context=None):
index 7e0d648..549bb01 100644 (file)
             <field name="type">tree</field>
             <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
             <field name="arch" type="xml">
-                <field name="account_id" position="replace">
-                    <field name="account_id" context="{'search_default_use_timesheets': 1, 'default_use_timesheets': 1}"/>
+                <field name="account_id" position="after">
                     <field name="to_invoice"/>
                 </field>
             </field>
index a7c97a2..8cbe80d 100644 (file)
                             <field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
                                 <tree editable="top" string="Timesheet Lines">
                                     <field invisible="1" name="date"/>
-                                    <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id)" context="{'default_use_timesheets': 1}"/>
+                                    <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id)" context="{'default_use_timesheets': 1}"/>
                                     <field name="name"/>
                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
                                     <field name="to_invoice" widget="selection"/>
index 41bcef2..28a5b35 100644 (file)
                     <button name="set_cancel" string="Cancel" type="object" states="open,pending"/>
                     <field name="state" widget="statusbar" statusbar_visible="open,close" statusbar_colors='{"pending":"blue"}' readonly="1"/>
                 </header>
-                <sheet string="Project" layout="auto">
-                    <group col="4" colspan="4">
-                        <group col="2" colspan="2" class="oe_form_group_label_border">
-                            <field name="name" string="Project Name" select="1"/>
+                <sheet string="Project">
+                    <group>
+                        <label for="name" class="oe_form_readonly_hidden"/>
+                        <h1>
+                            <field name="name" string="Project Name"/>
+                        </h1>
+                        <group>
                             <field name="partner_id" on_change="onchange_partner_id(partner_id)" select="1"/>
-                            <field name="user_id" string="Project Manager" select="1" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
+                            <field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
                             <field name="analytic_account_id" invisible="1" required="0"/>
                             <field name="parent_id" invisible="1" string="Parent" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/>
                             <field name="privacy_visibility"/>
                         </group>
-                        <group col="2" colspan="2" class="oe_form_group_label_border">
-                            <table border="0">
-                                <tr name="use_tasks_row">
-                                    <th style="border-right:1px solid #DDD;" width="140px">Tasks Management</th>
-                                    <td><field name="use_tasks" nolabel="1"/></td>
-                                    <td style="text-align:right;" width="110px"><button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(act_project_project_2_project_task_all)d" string="Tasks" type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/></td>
-                                </tr>
-                                <tr name="use_attachment_row">
-                                    <th/>
-                                    <td/>
-                                    <td style="text-align:right;" width="110px"><button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(base.action_attachment)d" string="Documents" type="action" /></td>
-                                </tr>
-                            </table>
+                        <group col="4">
+                            <group>
+                                <label string=""/>
+                                <field name="use_tasks"/>
+                            </group>
+                            <group>
+                                <button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(base.action_attachment)d" string="Documents" type="action"/>
+                                <button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(act_project_project_2_project_task_all)d" string="Tasks" type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/>
+                            </group>
                         </group>
                     </group>
-                    <notebook colspan="4">
+                    <notebook>
                         <page string="Team" attrs="{'invisible':[('use_tasks','=', 0)]}" name="team">
-                            <field colspan="4" name="members" nolabel="1" widget="many2many_kanban">
+                            <field colspan="4" name="members" widget="many2many_kanban">
                                 <kanban quick_create="true" create="false">
                                     <field name="name"/>
                                     <templates>
                                 <field name="priority"/>
                                 <field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/>
                             </group>
-                        </page>
-                        <page string="Billing" groups="account.group_account_invoice">
-                            <field name="currency_id" select="1" groups="base.group_multi_company" required="1"/>
-                            <group col="3">
-                                <b>
-                                    <label string="Variables you can use for headers and footer." colspan="3"/>
-                                </b>
-                                <label string="Task: %%(name)s"/>
-                                <label string="User: %%(user_id)s"/>
-                                <label string="ID: %%(task_id)s"/>
-                                <label string="Status: %%(state)s"/>
-                                <label string="Date Start: %%(date_start)s"/>
-                                <label string="Date Stop: %%(date)s"/>
+                            <group string="Billing" groups="account.group_account_invoice">
+                                <field name="currency_id" select="1" groups="base.group_multi_company" required="1"/>
                             </group>
                         </page>
                         <page string="Tasks Stages">
index 196c679..93addfe 100644 (file)
                 <xpath expr='//separator[@name="project_sep"]' position='replace'>
                     <separator name="project_sep" string="Project Management" colspan="4"/> <!-- removal of invisible attribute -->
                 </xpath>
-                <xpath expr="//separator[@name='project_sep']" position="after">
+                <xpath expr='//separator[@name="project_sep"]' position='after'>
                     <field name="use_phases"/>
                 </xpath>
             </field>