Skip to content

Feature/15.0/batch report printing #3

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

Open
wants to merge 8 commits into
base: 15.0
Choose a base branch
from

Conversation

ambientstl
Copy link

#958696098 Batch report printing

Depends on PR #2

Changes:

  • Adds a new Server Action, Batch Print Reports, for Sale Order and Product Template models
  • Adds a new wizard, Batch Print Report Wizard, that is launched by the Server Action
    • All HTML reports for the model are available for batching
    • Adds the option to collate reports by record instead of report

To test:

  • Clone gobluestingray/reporting-engine
  • Add the report_batch module to to the 15.0 branch of blue_odoo_addons's docker-compose.base.yml (in services.volumes)
    • i.e. ../<reporting-engine repo name>/report_batch:/opt/odoo/vendor/report_batch
  • Add sample sale reports and templates to the sale module in the 15.0 branch of blue_odoo_addons
  • Start a new db from the 15.0 branch of blue_odoo_addons, install the report_batch (and the "Sales") module(s), and check out the new functionality

Remaining Issues:

  • Report header still "prints"
  • "Instructions..." link in report header needs working link
  • Report opens in same tab
  • "Collate by record" only works on Sale Orders (not Products): need better view munging to get document name consistently across models
  • Printing the generated batch report results in a blank report (only the Report header prints)
    • I investigated a few things that I thought may be causing this, with no success:
      • The report header isn't causing this: I removed the header completely and the report was still blank
      • I tried adding active_ids to the context, but the report was still blank
      • I don't think it's caused by my sample reports being mostly blank

Bhavesh Odedra and others added 8 commits August 30, 2022 16:08
Changes:
 - Adds a new Server Action, Batch Print Reports, for Sale Order and Product Template models
 - Adds a new wizard, Batch Print Report Wizard, that is launched by the Server Action
   - All HTML reports for the model are available for batching
   - Adds the option to collate reports by record instead of report
Copy link

@traviswaelbro traviswaelbro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested, but looks good overall. Have a few requests

class BatchPrintReportsWizard(models.TransientModel):
_name = "batch.print.reports.wizard"
_description = "Batch Print Reports Wizard"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +12 to +14
model_name = fields.Char(string="Model Name")
res_model = fields.Char(string="Model")
res_ids = fields.Char(string="Record IDs")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some help strings on these would be helpful imo

Comment on lines +34 to +40
template_id = generic_template_id.copy({
"name": "{}_parent_report_template_{}".format(self.res_model.replace(".", "_"), random.randint(0, 99999)),
"type": "qweb",
"model": self.res_model,
"mode": "primary",
"arch_base": generic_template_id.arch_base,
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be destroyed after we're done with it?

@@ -25,25 +25,44 @@ class IrActionsReport(models.Model):

subreport_ids = fields.One2many("ir.actions.report.subreport", "parent_report_id")

def generate_top_part(self):
def generate_top_part(self, collate_by_record=False):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get docstrings on the methods in this file? In particular, I'd like to see some explanation about all of the \n and \t characters being used.

@traviswaelbro
Copy link

Has anyone functionally tested this? I know there are still some remaining issues, but @ambientstl can you assign QA if this should have it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants