-
Notifications
You must be signed in to change notification settings - Fork 154
[REL] fixes and improvements on release to v11 #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sraps can you please take a look at this PR?
| parser = self._custom_aeroo_parser(model_data) | ||
| parser._build_model(self.pool, cr) | ||
|
|
||
| if 'report_aeroo' in self.pool._init_modules: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid error on module install
| """ | ||
| Instantiates custom parsers for Aeroo Reports "dynamic" reports | ||
| """ | ||
| expected_class = 'Parser' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used
| ### Fields | ||
| charset = fields.Selection('_get_encodings', string='Charset', | ||
| required=True, default='utf_8') | ||
| content_fname = fields.Char('Override Extension',size=64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use new odoo field "print_report_name"
| string='Template Mime-type', default='oo-odt') | ||
| out_format = fields.Many2one('report.mimetypes', 'Output Mime-type', | ||
| default=_get_default_outformat) | ||
| active = fields.Boolean('Active', help='Disables the report if unchecked.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is not necessary, keep it simpler
| rep_model.with_context(_force_unlink=True).unlink() | ||
|
|
||
|
|
||
| @api.multi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use odoo api.multi capabilities
| 'gettext': self._translate_text, | ||
| 'test': self.test, | ||
| } | ||
| 'fields': fields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useful for date/datetime methods (for eg. fields.Date.today())
| var aeroo_url = 'report/aeroo/' + c_action.report_name; | ||
| if(c_action.context.active_ids){ | ||
| aeroo_url += '/' + c_action.context.active_ids.join(','); | ||
| if (_.isUndefined(action.data) || _.isNull(action.data) || (_.isObject(action.data) && _.isEmpty(action.data))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more similar as odoo does. Without this changes context and data where lost and not reaching the controller
| if (action.context.active_ids) { | ||
| aeroo_url += '/' + c_action.context.active_ids.join(','); | ||
| // odoo does not send context if no data, but I find it quite useful to send it regardless data or no data | ||
| aeroo_url += '?context=' + encodeURIComponent(JSON.stringify(c_action.context)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is the main difference with odoo. I've added for compatibility with v8/v9 where you could send values on the context to the report.
I don't see any reason why if there is not data you should not preserve the context.
| from odoo import api, models | ||
|
|
||
| class ReportSampleParser(models.AbstractModel): | ||
| class Parser(models.AbstractModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of this it must be named "Parser"
| git+https://github.com/aeroo/aeroolib.git | ||
| git+https://github.com/aeroo/currency2text.git | ||
| # use this genshi version to fix error when, for eg, you send arguments like "date=True" check this https://genshi.edgewall.org/ticket/600 | ||
| git+https://github.com/edgewall/genshi@stable/0.7.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newer version to fix ror with genshi if, for eg. you call "formatlang(o.date, date=True)" (the issue was with date=True)
|
I get two errors when printing: The first one might be a user error. |
|
Hi @CasVissers ! Thanks for the review. Thanks! |
|
@jjscarafia |
|
Hi! The error with that report is that you have an small /if (without an if that starts the conditional). I've deleted locally and it works ok. |
|
@jjscarafia Runbot is not working correctly for me. I downloaded your report, still get the error: In runbot I get a server overload. |
|
@jjscarafia some more info I get the TypeError: object of type 'bool' has no len() error only when I export to PDF, ODT works. If I try to reproduce on runbot. The PDF export doesn't work at all. |
|
hi @CasVissers
|
|
@jjscarafia Complete traceback: You have any idea where to search? |
|
Hi @jjscarafia @CasVissers , I have tested Sample report and it is working perfectly, i just added one method in sample report.odt (get_data()) and trying to call it through parser file, but it is giving me errors. i am not sure if parser file code is already done in this commit. please help me out. |
|
Hi @jsmith3885 . Actually I haven't test parsers, I don't use the. I think that what is missing is a call to a method that can be extended on parser to modify data and/or context. |
|
@jjscarafia Thanks for your quick response. For some complex reports parsers are very important. Can you please test then tell me which method i should call on parser? |
|
@jsmith3885 |
|
@sraps , with using this method, I am getting following error 2018-06-29 14:57:34,309 6426 ERROR db_test_aeroo werkzeug: Error on request: File "/usr/local/lib/python3.6/dist-packages/Genshi-0.7-py3.6-linux-x86_64.egg/genshi/template/eval.py", line 310, in lookup_name |
|
@sraps @jjscarafia any hint on this. or i should try with different methods like |
|
@sraps @jjscarafia @FreeDoo2018 please help me out. |
|
Hi @jsmith3885 I 've make this new PR #116 where I show on report sample how parser can be used on report sample hope it helps @sraps what do you think about it? |
No description provided.