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
1=== modified file 'hr_expense/hr_expense.py'
2--- hr_expense/hr_expense.py 2011-01-31 08:05:56 +0000
3+++ hr_expense/hr_expense.py 2011-02-25 14:06:55 +0000
4@@ -124,6 +124,28 @@
5 self.write(cr, uid, ids, {'state':'paid'})
6 return True
7
8+ def invoice(self, cr, uid, ids, context=None):
9+ wf_service = netsvc.LocalService("workflow")
10+ mod_obj = self.pool.get('ir.model.data')
11+ res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
12+ res_id = res and res[1] or False,
13+ inv_ids = []
14+ for id in ids:
15+ wf_service.trg_validate(uid, 'hr.expense.expense', id, 'invoice', cr)
16+ inv_ids.append(self.browse(cr, uid, id).invoice_id.id)
17+ return {
18+ 'name': _('Supplier Invoices'),
19+ 'view_type': 'form',
20+ 'view_mode': 'form,tree',
21+ 'view_id': [res_id],
22+ 'res_model': 'account.invoice',
23+ 'context': "{'type':'out_invoice', 'journal_type': 'purchase'}",
24+ 'type': 'ir.actions.act_window',
25+ 'nodestroy': True,
26+ 'target': 'current',
27+ 'res_id': inv_ids and inv_ids[0] or False,
28+ }
29+
30 def action_invoice_create(self, cr, uid, ids):
31 res = False
32 invoice_obj = self.pool.get('account.invoice')
33
34=== modified file 'hr_expense/hr_expense_view.xml'
35--- hr_expense/hr_expense_view.xml 2011-01-17 20:54:13 +0000
36+++ hr_expense/hr_expense_view.xml 2011-02-25 14:06:55 +0000
37@@ -104,7 +104,7 @@
38 <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>
39 <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />
40 <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
41- <button name="invoice" states="accepted" string="Invoice" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
42+ <button name="invoice" states="accepted" string="Invoice" type="object" icon="gtk-go-forward" groups="base.group_hr_user"/>
43 <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
44 </group>
45 </page>

Subscribers

People subscribed via source and target branches

to all changes: