Commit Graph
9 Commits
Author SHA1 Message Date
Xavier-Do 4820be3cb7 [IMP] base: add test for wkhtmltopdf generation
The current used version of wkhtmltopdf manages is frozen to 0.12.5
because some features used by odoo are only available in this version
using a patched qt.

Anyway, it become difficult to keep this version up to date, especially
with Ubuntu Jammy and updates of the dependencies used by wkhtmltopdf.
More than that because of qt related issues, wkhtmltopdf maintenance
will end soon.

Adding a test to check some caracteristics of pdf reports may be usefull
to check that current version is still working, and eventually to find
an alternative solution.

This test checks that pdf reports contains the expected headers and
footers elements with the correct page number (2 record of 2 pages)
This also check that the pdf is in the expected A4 format.

Future test may check other formats, margins, layout,
page size/pagebreak combination, (table of content?), ...

This test may also check performances and existing limitations.

closes odoo/odoo#136626

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-10-19 13:20:28 +00:00
Lucas Perais 3c6235d446 [FIX] base: ir_actions_report: context for not using attachment
Before this commit it was not possible to print a report without
bypassing the retrieval of a previous attachment, or to print
a report without creating one.

After this commit it is possible with the context key "report_pdf_no_attachment"

Part-of: odoo/odoo#128228
2023-07-20 17:01:31 +02:00
nni-odoo 84ac1d1093 [IMP] l10n_th: Tax Invoice
When an invoice is issued in Thailand, the Revenue department will make a note that taxes need to be paid. This is important for both corporate tax and VAT purposes. A tax invoice is important to be generated and should contain the title "Tax Invoice".
On top of that, the tax invoice should also contain the information on supplier's tax id number (headquarters or branch number). In this case, we set the original Odoo invoice to be labelled Tax Invoice and create another invoice called commercial invoice.

2879718

closes odoo/odoo#123679

X-original-commit: 1cdaa362c9f0377a7ec4929c2f581ccd84ae3b33
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2023-06-06 03:49:51 +02:00
Martin Trigaux ffc525419a [IMP] base: avoid render with env mixup
The render API was confusing as mixing the access to the report and
the rendering env.

The ambiguity was present for code such as
`report.sudo()._render(record_ids)` where it was not clear if the
`sudo()` is needed to access to `report` or to `record_ids`. For low
priviledge users (such as portal or public), it was common to use
`report.with_user(SUPERUSER_ID)._render(record_ids)`.

This PR changes the render methods signature to be `api.model`. The
`report_ref` can be:
- ir.actions.report external id
- ir.actions.report id
- ir.actions.report recod
- `report_name` value

This will allow to call the report methods with any user and no longer
need to use `with_user(1)` to render reports as public user.

Task-id 2670865

closes odoo/odoo#91341

Related: odoo/upgrade#3650
Related: odoo/enterprise#27323
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-08-02 11:48:46 +02:00
Laurent Smet bbc2128ba1 [FIX] base: Blacklist invoice specific reports in generic test
Some reports are specific to invoices and are raising an UserError if called without the correct business objects.
Since version 13.0, invoices have been merged into `account.move`.
The test is making a `search` on `account.move` to test the report generation but there is no guarantee there are invoices.
To prevent random failures in the futur, this commit allows custom domain to get the records in order to test these reports correctly.

closes odoo/odoo#85150

Task: 2726507
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2022-04-29 11:00:56 +02:00
wan e6f891d80e [FIX] base: generic test for reports for l10n too
A lot of localization are inheriting reports and changing them.
This should be tested in a generic test like /base.test_reports to avoid
possible tracebacks.

closes odoo/odoo#82312

Related: odoo/enterprise#23299
Signed-off-by: William André (wan) <wan@odoo.com>
2022-01-07 20:42:45 +00:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
Christophe Monniez b356b19033 [IMP] tests: Add the possibility to tag tests
Purpose: When running tests, all the tests for the installed/updated
files are done. This commit adds a 'tagged' decorator that can be used to
tag tests. Combined with a new 'test-tags' CLI option, it adds the ability
to filter which tests are executed. For example, @tagged('slow') will
add a tag 'slow' to the test. The CLI option 'test-tags="slow"' will
only run tests tagged 'slow'.

One can use prefixes to select cases with tags.
'+' or no prefix means that the tests tagged with this tag are selected
for execution. '-' prefix will exclude the tests tagged with this tag.
Exclusion takes precedence over inclusion.

Also, by default, all Odoo tests cases are tagged 'standard' and with
the technical name of the module.
This means that when selecting tests with the 'test-tags'
parameter, if '-standard' is not specified, all tests tags are
going to be executed.
When tagging tests, one can remove such automatic tag by prefixing the
tag name with '-'. E.g. @tagged('-standard') will remove the standard
tag from the test.

Another example, if one wants to test the 'sale' module alone,
even without adding any 'tagged' decorator thos tests can be selected
like that: --test-tags="sale"

Tests are selected or deselected using a TagsSelector. When instanciated,
 a string is passed with comma separated tests selectors like
'+slow,-standard'. When the 'check' method is called  with a test as argument,
it returns True or False if the test has to be executed or not.
2018-01-18 13:20:37 +01:00
Laurent Smet e80238042c [REF] report: remove the report module
The content of the report module is now dispatched in
the 'base' and the 'web' modules.
2017-05-08 09:23:12 +02:00