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

Proposed by Ashvin Rathod (OpenERP)
Status: Merged
Merged at revision: 4451
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-720629-ara
Merge into: lp:openobject-addons
Diff against target: 45 lines (+23/-1)
2 files modified
hr_expense/hr_expense.py (+22/-0)
hr_expense/hr_expense_view.xml (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-720629-ara
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Approve
Rifakat Husen (OpenERP) (community) Needs Resubmitting
Review via email: mp+50335@code.launchpad.net

Description of the change

Hello,

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

Thanks,
ara

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

I can not get paid/refuse state of expense when related invoice got paid/cancel.
so with your diff workflow break.

Thanks,
mra

review: Needs Fixing
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) :
review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

clicking on invoice button on expense it should open form view of created supplier invoice as like sale order.

and collect invoice ids and return with action like inv_ids and inv_ids[0] or False

review: Needs Fixing
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) :
review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

remove exception: raise osv.except_osv(_('Error'), _('No Invoices were created'))

and use view mode only "form" not "tree form"

review: Needs Fixing
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) :
review: Needs Resubmitting
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) :
review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve
Revision history for this message
qdp (OpenERP) (qdp) wrote :

i improved:
1) _('Supplier Invoices') for translability
2)
- 'view_mode': 'form',
+ 'view_mode': 'form,tree',
to allwo to switch in tree view after processing that invoice

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-25 14:06:55 +0000
@@ -124,6 +124,28 @@
124 self.write(cr, uid, ids, {'state':'paid'})124 self.write(cr, uid, ids, {'state':'paid'})
125 return True125 return True
126126
127 def invoice(self, cr, uid, ids, context=None):
128 wf_service = netsvc.LocalService("workflow")
129 mod_obj = self.pool.get('ir.model.data')
130 res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
131 res_id = res and res[1] or False,
132 inv_ids = []
133 for id in ids:
134 wf_service.trg_validate(uid, 'hr.expense.expense', id, 'invoice', cr)
135 inv_ids.append(self.browse(cr, uid, id).invoice_id.id)
136 return {
137 'name': _('Supplier Invoices'),
138 'view_type': 'form',
139 'view_mode': 'form,tree',
140 'view_id': [res_id],
141 'res_model': 'account.invoice',
142 'context': "{'type':'out_invoice', 'journal_type': 'purchase'}",
143 'type': 'ir.actions.act_window',
144 'nodestroy': True,
145 'target': 'current',
146 'res_id': inv_ids and inv_ids[0] or False,
147 }
148
127 def action_invoice_create(self, cr, uid, ids):149 def action_invoice_create(self, cr, uid, ids):
128 res = False150 res = False
129 invoice_obj = self.pool.get('account.invoice')151 invoice_obj = self.pool.get('account.invoice')
130152
=== 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-25 14:06:55 +0000
@@ -104,7 +104,7 @@
104 <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>104 <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>
105 <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />105 <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />
106 <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>106 <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
107 <button name="invoice" states="accepted" string="Invoice" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>107 <button name="invoice" states="accepted" string="Invoice" type="object" icon="gtk-go-forward" groups="base.group_hr_user"/>
108 <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>108 <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
109 </group>109 </group>
110 </page>110 </page>

Subscribers

People subscribed via source and target branches

to all changes: