← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-720629-ara into lp:openobject-addons

 

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

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  #720629 [PS] HR - Invoicing an expense doesn't open the invoice form
  https://bugs.launchpad.net/bugs/720629

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

Hello,

Fix the bug: HR - Invoicing an expense doesn't open the invoice form
https://bugs.launchpad.net/openobject-addons/+bug/720629

Thanks,
ara
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-720629-ara/+merge/50335
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-720629-ara.
=== modified file 'hr_expense/hr_expense.py'
--- hr_expense/hr_expense.py	2011-01-31 08:05:56 +0000
+++ hr_expense/hr_expense.py	2011-02-18 13:40:56 +0000
@@ -124,6 +124,25 @@
         self.write(cr, uid, ids, {'state':'paid'})
         return True
 
+    def invoice(self, cr, uid, ids, context=None):
+        mod_obj = self.pool.get('ir.model.data')
+        inv_id = self.action_invoice_create(cr, uid, ids)
+        res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
+        res_id = res and res[1] or False,
+
+        return {
+            'name': 'Supplier Invoices',
+            'view_type': 'form',
+            'view_mode': 'form',
+            'view_id': [res_id],
+            'res_model': 'account.invoice',
+            'context': "{'type':'out_invoice', 'journal_type': 'purchase'}",
+            'type': 'ir.actions.act_window',
+            'nodestroy': True,
+            'target': 'current',
+            'res_id': inv_id,
+        }
+
     def action_invoice_create(self, cr, uid, ids):
         res = False
         invoice_obj = self.pool.get('account.invoice')

=== modified file 'hr_expense/hr_expense_view.xml'
--- hr_expense/hr_expense_view.xml	2011-01-17 20:54:13 +0000
+++ hr_expense/hr_expense_view.xml	2011-02-18 13:40:56 +0000
@@ -104,7 +104,7 @@
                                 <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>
                                 <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />
                                 <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
-                                <button name="invoice" states="accepted" string="Invoice" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
+                                <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"/>
                             </group>
                         </page>


Follow ups