Merge lp:~openerp-dev/openobject-addons/6.1-opw-574927-msh into lp:openobject-addons/6.1

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-574927-msh
Merge into: lp:openobject-addons/6.1
Diff against target: 31 lines (+11/-3)
1 file modified
account/account_invoice.py (+11/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-574927-msh
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+108294@code.launchpad.net

Description of the change

Hello,

Fixed the issue of res.log, res log of customer invoice payment opens the view of supplier invoice.

Demo :- Create Customer Invoice and Pay it -> when you pay invoice you will get res.log 'Invoice SAJ/.../.. is paid' but when you click it you will get supplier invoice.

Reason :- Here res,log is created from the workflow method and currently workflow method does not support context, context will not be passed from any workflow method so we can not determined the type, that whether it is in_invoice or out_invoice, so call the read and get the type and changed the string from overwritten fields_view_get.

Thanks.

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Not Relevant on Trunk (means that architecture on trunk has changed and so this bug has no meaning anymore). If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6822. By Mohammed Shekha(Open ERP)

[FIX]Fixed the issue of res.log, here the res.log link of customer invoice paid opens supplier invoice.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2012-03-29 15:43:31 +0000
3+++ account/account_invoice.py 2012-06-01 07:11:18 +0000
4@@ -345,6 +345,13 @@
5 for node in doc.xpath("//field[@name='partner_id']"):
6 node.set('string', partner_string)
7 res['arch'] = etree.tostring(doc)
8+ if view_type == 'form':
9+ form_string = "Supplier Invoices"
10+ if context.get('type','in_invoice') in ('out_invoice', 'out_refund'):
11+ form_string = "Customer Invoices"
12+ for node in doc.xpath("//form"):
13+ node.set('string', form_string)
14+ res['arch'] = etree.tostring(doc)
15 return res
16
17 def get_log_context(self, cr, uid, context=None):
18@@ -378,9 +385,10 @@
19 if context is None:
20 context = {}
21 self.write(cr, uid, ids, {'state':'paid'}, context=context)
22- for inv_id, name in self.name_get(cr, uid, ids, context=context):
23- message = _("Invoice '%s' is paid.") % name
24- self.log(cr, uid, inv_id, message)
25+ for inv in self.read(cr, uid, ids, context=context):
26+ message = _("Invoice '%s' is paid.") % inv['number']
27+ context['type'] = str(inv['type'])
28+ self.log(cr, uid, ids[0], message, context=context)
29 return True
30
31 def unlink(self, cr, uid, ids, context=None):