On 2016-01-31 23:06, Oscar Alvarez wrote: > > > El 31/01/16 a las 14:15, Cédric Krier escribió: > >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". > 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.
For me, you are mixing record history with printed document history. By just activating the history on the Purchase and PurchaseLine, you have all the tracking information you need. And if you need more field on the Report, you have to add them to the Purchase Model. -- 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/20160201084823.GE20880%40tetsuo.