I want extending ActionReport with three fields to ir.action.report
("code or number", "revision/version", "approved/release date"),
and see them printed on reports, (sale order, purchase order, etc,
see attached), it print these fields on reports are necessary for
all companies that has quality management systems [1][2], because
they are important controlled documents/records, not anything else
document, and for example "revision" field change constantly, so
thats why is better change "revision" value from a record on model,
and not set as a constant in a format report.
Another way is not add these fields to ir.action.report, but a new
model that as this:
class DocumentRecord(Workflow, ModelSQL, ModelView):
'Document Record'
__name__ = 'ims.document_record'
_rec_name = 'name'
name = fields.Char('Name', select=True, required=True)
code = fields.Char('Code', states=STATES, select=True)
revision = fields.Char('Revision states=STATES, select=True)
approved_date = fields.Char('Approved Date', states=STATES,
select=True)
report = fields.Many2One('ir.action.report', 'Report') # with
this field we link to report
[1]
http://mireauxms.com/wp-content/uploads/2014/01/accessible-new.jpg
[2]
http://www.versesolutions.com/images/screenshots/documentcontrol.jpg
But in both cases the main problem is that ir.action.report model is
not on context of report, maybe a patch like as solve the problem.
@classmethod
def get_context(cls, records, data,
action_report):
pool = Pool()
User = pool.get('res.user')
report_context = {}
report_context['data'] = data
report_context['context'] = Transaction().context
report_context['user'] = User(Transaction().user)
report_context['records'] = records
report_context['format_date'] = cls.format_date
report_context['format_currency'] = cls.format_currency
report_context['format_number'] = cls.format_number
report_context['datetime'] = datetime
report_context['action_report'] =
action_report
return report_context