Skip to content
Snippets Groups Projects
Commit 28b5ce385189 authored by Emmanuel Cazenave's avatar Emmanuel Cazenave
Browse files

Now it really transfer analytics to the invoice.

parent aab2d7552d9c
No related branches found
No related tags found
No related merge requests found
...@@ -34,5 +34,20 @@ ...@@ -34,5 +34,20 @@
), ),
} }
def move_line_get_item(self, cr, uid, line, context=None):
res = super(account_invoice_line_analytic, self)\
.move_line_get_item(cr, uid, line, context=context)
for i in range(1, 6):
key = "a%s_id" % i
val = getattr(line, key).id
res[key] = val
return res
class account_invoice_analytic(osv.Model):
_name = "account.invoice"
_inherit = "account.invoice"
def fields_view_get(self, cr, uid, view_id=None, view_type=False, def fields_view_get(self, cr, uid, view_id=None, view_type=False,
context=None, toolbar=False, submenu=False): context=None, toolbar=False, submenu=False):
...@@ -37,6 +52,5 @@ ...@@ -37,6 +52,5 @@
def fields_view_get(self, cr, uid, view_id=None, view_type=False, def fields_view_get(self, cr, uid, view_id=None, view_type=False,
context=None, toolbar=False, submenu=False): context=None, toolbar=False, submenu=False):
print "FIELDS VIEW GET CALLED"
''' '''
Display analysis code in account move lines trees Display analysis code in account move lines trees
''' '''
...@@ -44,7 +58,7 @@ ...@@ -44,7 +58,7 @@
context = {} context = {}
print "Context is" print "Context is"
print context print context
res = super(account_invoice_line_analytic, self).fields_view_get( res = super(account_invoice_analytic, self).fields_view_get(
cr, uid, view_id=view_id, cr, uid, view_id=view_id,
view_type=view_type, context=context, view_type=view_type, context=context,
toolbar=toolbar, submenu=False) toolbar=toolbar, submenu=False)
...@@ -109,15 +123,11 @@ ...@@ -109,15 +123,11 @@
'views']['tree']['arch'] = etree.tostring(doc) 'views']['tree']['arch'] = etree.tostring(doc)
return res return res
# We override the Hook method of account_invoice def line_get_convert(self, cr, uid, x, part, date, context=None):
# to add our analytic codes res = super(account_invoice_analytic, self)\
def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines): .line_get_convert(cr, uid, x, part, date, context)
print "************************************" for i in range(1, 6):
print invoice_browse key = "a%s_id" % i
print "************************************" val = x.get(key)
print move_lines res[key] = val
print "************************************" return res
return super(
account_invoice_line_analytic,
self).finalize_invoice_move_lines(
cr, uid, invoices_browse, move_lines)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment