[IMP] hr_timesheet_invoice: improved color of button based on business flow
[odoo/odoo.git] / addons / hr_timesheet_invoice / hr_timesheet_invoice_view.xml
index b0edacd..e97fcd0 100644 (file)
@@ -7,23 +7,32 @@
             <field name="type">form</field>
             <field name="inherit_id" ref="account.view_account_analytic_account_form"/>
             <field name="arch" type="xml">
-                <field name="user_id" position="after">
-                    <group colspan="4" col="4">
-                        <separator colspan="4" string="Invoicing Data"/>
-                        <field name="pricelist_id" domain="[('type','=','sale')]" widget="selection"/>
-                        <field name="to_invoice" widget="selection" />
+                <field name="partner_id" position="replace">
+                    <field name="partner_id" on_change="on_change_partner_id(partner_id, context)"/>
+                </field>
+                <group name="contract" position="after">
+                    <group name="invoice_data">
+                        <separator colspan="2" string="Invoicing Data"/>
+                        <field name="to_invoice" widget="selection"/>
+                        <field name="pricelist_id" groups="product.group_sale_pricelist" domain="[('type','=','sale')]" attrs="{'required':[('to_invoice','!=',False)]}"/>
                         <field name="amount_max"/>
+                    </group>
+                    <group name="invoice_stats">
+                        <separator colspan="4" string="Invoicing Statistics"/>
                         <field name="amount_invoiced"/>
-                        <separator colspan="4"/>
-                        <group col="9" colspan="8">
-                               <field name="state" readonly="1"/>
-                               <button name="set_cancel" string="Cancel" type="object" states="open,pending" icon="gtk-cancel"/>
-                               <button name="set_open" string="Reactivate Account" type="object" states="pending,cancelled,close" icon="gtk-ok"/>
-                               <button name="set_pending" string="Pending" type="object" states="open" icon="gtk-media-pause"/>
-                               <button name="set_close" string="Close" type="object" states="open,pending" icon="terp-dialog-close"/>
-                        </group>
                     </group>
-                </field>
+                </group>
+                <xpath expr="/form/sheet" position='before'>
+                    <header>
+                        <button name="set_pending" string="Pending" type="object" states="open" class="oe_form_button_return_flow"/>
+                        <button name="set_close" string="Close" type="object" states="open,pending" class="oe_form_button_active_flow"/>
+                        <button name="set_open" string="Re-open project" type="object" states="pending,close" class="oe_form_button_return_flow"/>
+                        <button name="set_open" string="Re-open project" type="object" states="cancelled,draft"/>
+                        <button name="set_cancel" string="Cancel" type="object" states="open,pending"/>
+                        <field name="state" readonly="1" widget="statusbar"
+                            statusbar_visible="open,pending,close" statusbar_colors='{"pending":"red", "template":"blue"}'/>
+                    </header>
+                </xpath>
             </field>
         </record>
 
             <field name="type">form</field>
             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
             <field name="arch" type="xml">
-                <xpath expr='//separator[@string="Invoicing"]' position='after'>
-                    <field name="to_invoice"/>
-                    <field name="invoice_id"/>
+                <xpath expr="//group[@string='Accounting']" position='after'>
+                    <group string="Invoicing">
+                        <field name="to_invoice"/>
+                        <field name="invoice_id"/>
+                    </group>
                 </xpath>
             </field>
         </record>
@@ -47,7 +58,7 @@
             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
             <field name="arch" type="xml">
                 <field name="account_id" position="replace">
-                    <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)" select="1"/>
+                    <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
                 </field>
             </field>
         </record>
@@ -85,7 +96,8 @@
             <field name="inherit_id" ref="account.view_account_analytic_line_filter"/>
             <field name="arch" type="xml">
                 <field name="date" position="before">
-                    <filter name="to_invoice" string="To Invoice" context="{'to_invoice': 1}" domain="[('invoice_id','=',False),('to_invoice','&lt;&gt;',False)]" icon="terp-dolar"/>
+                    <filter name="to_invoice" string="To Invoice" context="{'to_invoice': 1}" domain="[('invoice_id','=',False), ('to_invoice','&lt;&gt;',False)]" icon="terp-dolar"/>
+                    <filter name="invoiced" string="Invoiced" domain="[('invoice_id','!=',False), ('to_invoice','&lt;&gt;',False)]" icon="terp-dolar"/> 
                     <separator orientation="vertical"/>
                 </field>
             </field>
             <field name="view_mode">tree,form</field>
             <field name="domain">[]</field>
             <field name="context">{'search_default_to_invoice': 1}</field>
-                       <field name="search_view_id" ref="account.view_account_analytic_line_filter"/>            
+            <field name="search_view_id" ref="account.view_account_analytic_line_filter"/>            
             <field name="help">This list shows you every task you can invoice to the customer. Select the lines and click the Action button to generate the invoices automatically.</field>
         </record>
         <menuitem
             <field name="model">hr_timesheet_invoice.factor</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
-                <form string="Type of invoicing">
-                    <field colspan="1" name="name"/>
-                    <field colspan="1" name="customer_name"/>
-                    <field colspan="2" name="factor"/>
+                <form string="Type of invoicing" version="7.0">
+                    <group col="4">
+                        <field name="name"/>
+                        <field name="customer_name"/>
+                        <field name="factor"/>
+                    </group>
                 </form>
             </field>
         </record>
         <menuitem
             action="action_hr_timesheet_invoice_factor_form"
             id="hr_timesheet_invoice_factor_view"
-            parent="account.menu_configuration_misc" sequence="25"/>
+            parent="account.menu_configuration_misc" sequence="25" groups="base.group_no_one"/>
 
     </data>
 </openerp>