[MOD]hr_expense : usability improvement
authorDBR (OpenERP) <dbr@tinyerp.com>
Mon, 6 Sep 2010 10:31:34 +0000 (16:01 +0530)
committerDBR (OpenERP) <dbr@tinyerp.com>
Mon, 6 Sep 2010 10:31:34 +0000 (16:01 +0530)
bzr revid: dbr@tinyerp.com-20100906103134-zjt5id9sq5oswt0i

addons/hr_expense/hr_expense.py
addons/hr_expense/hr_expense_view.xml

index c581853..6c2f44d 100644 (file)
@@ -61,12 +61,12 @@ class hr_expense_expense(osv.osv):
     _name = "hr.expense.expense"
     _description = "Expense"
     _columns = {
-        'name': fields.char('Expense Sheet', size=128, required=True),
+        'name': fields.char('Description', size=128, required=True),
         'id': fields.integer('Sheet ID', readonly=True),
         'ref': fields.char('Reference', size=32),
         'date': fields.date('Date'),
         'journal_id': fields.many2one('account.journal', 'Force Journal', help = "The journal used when the expense is invoiced"),
-        'employee_id': fields.many2one('hr.employee', "Employee's Name", required=True),
+        'employee_id': fields.many2one('hr.employee', "Employee", required=True),
         'user_id': fields.many2one('res.users', 'User', required=True),
         'date_confirm': fields.date('Confirmation Date', help = "Date of the confirmation of the sheet expense. It's filled when the button Confirm is pressed."),
         'date_valid': fields.date('Validation Date', help = "Date of the acceptation of the sheet expense. It's filled when the button Accept is pressed."),
@@ -81,11 +81,11 @@ class hr_expense_expense(osv.osv):
         'company_id': fields.many2one('res.company', 'Company', required=True),
         'state': fields.selection([
             ('draft', 'Draft'),
-            ('confirm', 'Waiting confirmation'),
-            ('accepted', 'Accepted'),
+            ('confirm', 'Waiting Approved'),
+            ('accepted', 'Approved'),
             ('invoiced', 'Invoiced'),
             ('paid', 'Reimbursed'),
-            ('cancelled', 'Cancelled')],
+            ('cancelled', 'Refused')],
             'State', readonly=True, help='When the expense request is created the state is \'Draft\'.\n It is confirmed by the user and request is sent to admin, the state is \'Waiting Confirmation\'.\
             \nIf the admin accepts it, the state is \'Accepted\'.\n If an invoice is made for the expense request, the state is \'Invoiced\'.\n If the expense is paid to user, the state is \'Reimbursed\'.'),
     }
index 4d25c01..03b373f 100644 (file)
             <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="Expenses" colors="blue:state=='draft'">
-                    <field name="date"/>
                     <field name="employee_id"/>
                     <field name="user_id" invisible="1"/>
                     <field name="department_id" groups="base.group_extended"/>
+                    <field name="name"/> 
+                    <field name="date"/>                                       
                     <field name="ref"/>
-                    <field name="name"/>
                     <field name="amount"/>
                     <field name="state"/>
                     <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
                             <group col="6" colspan="2">
                                 <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
                                 <button name="cancel" states="cancel" string="Cancel" type="workflow" icon="gtk-cancel"/>
-                                <button name="validate" states="confirm" string="Accept" type="workflow" icon="gtk-ok"/>
+                                <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert"/>                                                                
+                                <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-ok"/>
                                 <button name="invoice" states="accepted" string="Invoice" type="workflow" icon="gtk-execute"/>
-                                <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert"/>
-                                <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no"/>
+                                <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_manager" />
                             </group>
                         </page>
                         <page string="Other Info" groups="base.group_extended">
                     <group>
                       <filter icon="terp-document-new" domain="[('state','=','draft')]" string="Draft" help="Draft Expense"/>
                       <separator orientation="vertical"/>
-                      <filter icon="terp-gtk-go-back-rtl" domain="[('state','=','confirm')]" string="To Approve"
+                      <filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve"
                         help="Confirmed Expense"/>
-                      <filter icon="terp-gtk-go-back-rtl" domain="[('state','=','accepted')]" string="To Pay"
+                      <filter icon="terp-check" domain="[('state','=','accepted')]" string="To Pay"
                         help="Expenses to Invoice"/>
+                      <filter icon="terp-go-month" string="This Month"
+                              domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>                        
                       <separator orientation="vertical"/>
                       <field name="name" select='1'/>
                       <field name="date" select='1'/>
                 </group>
                 <newline />
                 <group expand="0" string="Group By...">
+                    <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>                                    
+                    <separator orientation="vertical"/>                    
                     <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
-                    <filter string="User" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
                     <separator orientation="vertical"/>
                     <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
                 </group>