Skip to content

Commit

Permalink
Return undefined for procedures without document_page defined
Browse files Browse the repository at this point in the history
  • Loading branch information
llacroix committed Apr 1, 2015
1 parent 0cfe417 commit 8eaf3a8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mgmtsystem_audit/report/verification_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import time
from openerp.report import report_sxw
from openerp.tools.translate import _


class mgmtsystem_audit_verification_list(report_sxw.rml_parse):
Expand All @@ -38,11 +39,16 @@ def __init__(self, cr, uid, name, context):
def get_lines_by_procedure(self, verification_lines):
p = []
for l in verification_lines:
proc_nm = self.pool.get('document.page').read(
self.cr, self.uid, l.procedure_id.id, ['name']
)
if l.procedure_id.id:
proc_nm = self.pool.get('document.page').read(
self.cr, self.uid, l.procedure_id.id, ['name']
)
procedure_name = proc_nm['name']
else:
procedure_name = _('Undefined')

p.append({"id": l.id,
"procedure": proc_nm['name'],
"procedure": procedure_name,
"name": l.name,
"yes_no": "Yes / No"})
p = sorted(p, key=lambda k: k["procedure"])
Expand Down

0 comments on commit 8eaf3a8

Please sign in to comment.