Ashvin Rathod (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-808704-ara into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #808704 in OpenERP Addons: "hr-expense : incmplete handling of canceld 
and reopened invoices"
  https://bugs.launchpad.net/openobject-addons/+bug/808704

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-808704-ara/+merge/77316

Hello,

Fix: hr-expense : incmplete handling of canceld and reopened invoices

Thanks,
ara
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-808704-ara/+merge/77316
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-808704-ara.
=== modified file 'hr_expense/hr_expense.py'
--- hr_expense/hr_expense.py	2011-09-24 13:11:35 +0000
+++ hr_expense/hr_expense.py	2011-09-28 12:28:06 +0000
@@ -82,6 +82,7 @@
             ('accepted', 'Approved'),
             ('invoiced', 'Invoiced'),
             ('paid', 'Reimbursed'),
+            ('invoice_except', 'Invoice Exception'),
             ('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\'.'),
@@ -224,6 +225,10 @@
             res = inv_id
         return res
 
+    def action_invoice_cancel(self, cr, uid, ids, context=None):
+        self.write(cr, uid, ids, {'state': 'invoice_except'}, context=context)
+        return True
+
 hr_expense_expense()
 
 class product_product(osv.osv):

=== modified file 'hr_expense/hr_expense_view.xml'
--- hr_expense/hr_expense_view.xml	2011-09-24 09:10:37 +0000
+++ hr_expense/hr_expense_view.xml	2011-09-28 12:28:06 +0000
@@ -106,6 +106,7 @@
                                 <button name="confirm" states="draft" string="Submit to Manager" type="workflow" icon="gtk-apply"/>
                                 <button name="invoice" states="accepted" string="Invoice" type="object" icon="gtk-go-forward" groups="base.group_hr_user"/>
                                 <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
+                                <button name="invoice_recreate_hr_expense" states="invoice_except" string="Recreate Invoice" icon="gtk-go-forward"/>
                             </group>
                         </page>
                         <page string="Other Info" groups="base.group_extended">

=== modified file 'hr_expense/hr_expense_workflow.xml'
--- hr_expense/hr_expense_workflow.xml	2011-01-14 00:11:01 +0000
+++ hr_expense/hr_expense_workflow.xml	2011-09-28 12:28:06 +0000
@@ -55,6 +55,13 @@
             <field name="action">action_invoice_create()</field>
         </record>
 
+        <record id="act_invoice_except" model="workflow.activity">
+            <field name="wkf_id" ref="wkf_expenses"/>
+            <field name="name">invoice_except</field>
+            <field name="kind">function</field>
+            <field name="action">action_invoice_cancel()</field>
+        </record>
+
         <record id="t1" model="workflow.transition">
             <field name="act_from" ref="act_draft"/>
             <field name="act_to" ref="act_confirm"/>
@@ -117,5 +124,18 @@
             <field name="group_id" ref="base.group_hr_user"/>
         </record>
 
+        <record id="t12" model="workflow.transition">
+            <field name="act_from" ref="act_invoice"/>
+            <field name="act_to" ref="act_invoice_except"/>
+            <field name="signal">subflow.cancel</field>
+            <field name="group_id" ref="base.group_hr_user"/>
+        </record>
+
+        <record id="t13" model="workflow.transition">
+            <field name="act_from" ref="act_invoice_except"/>
+            <field name="act_to" ref="act_invoice"/>
+            <field name="signal">invoice_recreate_hr_expense</field>
+        </record>
+
     </data>
 </openerp>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to