On 2016-01-31 09:33, Oscar Alvarez wrote:
> 
> 
> El 30/01/16 a las 18:08, Cédric Krier escribió:
> >On 2016-01-30 12:51, Oscar Andres Alvarez Montero wrote:
> >>Hi, devs
> >>I am working 3.6, but de om a new module I need overload get_context from
> >>trytond core, not for a simple report, else for all reports, without create
> >>new Class as CompanyReport, it this possible?
> >We don't have a way to extend base classes. For now, you have to extend
> >every report you need or you could try to ugly way by monkey-patching
> >the Report class.
> >
> >But maybe there is a better way to achieve your goal if you could give
> >more detail on the needs.
> >
> 
> I am starting the develop of new module [1] for Management System (ISO) [2],
> for now is only little module, but a of first model is related with
> Documents and Records formats, for example purchase report on quality
> systems is a controlled record, so this need the following values on head
> document: code, version of document, approved by (person), etc, of course
> this values change between documents/records formats, and could be many
> formats, the idea is to define this values on a unique model without to call
> each model report and overload get_context, just using a field M2O, in this
> model:
> something like as:
> 
> https://bitbucket.org/presik/trytonpsk_ims/src/679891616c125f013d13db965b8d20a23f5c1d19/document_record.py?fileviewer=file-view-default
> 
> next, overload Class Report, that add new values to report context if data
> of DocumentReport if on context.
> 
>     @classmethod
>     def get_context(cls, records, data):
>         report_context = super(Report, cls).get_context(records, data)
>         ims_report = cls._get_report_ims_data()
>         report_context['ims_name'] = ims_report.ims_name
>         report_context['code'] = ims_report.code
>         report_context['version'] = ims_report.version
>         report_context['approved_date'] = ims_report.approved_date
>         return report_context

I personally don't understand what you try to achieve. I don't know what
you call "purchase report", I don't see the link between your
requirements and the reports. I don't understand why you define a
"unique model".

Often I find that when people talk about management system, they often
think about tool but for me, it is much more about company internal
process (I would call it "company culture").

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/20160131191520.GY20880%40tetsuo.

Reply via email to