Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4584 Widoki

HI all,


I know that odoo create a relationship between route and report.

For example I know that with odoo/addons/web there is:


@http.route(['/web/content',
'/web/content/<string:xmlid>',
'/web/content/<string:xmlid>/<string:filename>',
....
'/web/content/<string:model>/<int:id>/<string:field>',
'/web/content/<string:model>/<int:id>/<string:field>/<string:filename>'], type='http', auth="public")
def content_common(s.....


in relation with

<report
id="account_invoices"
model="account.invoice"
string="Invoices"
report_type="qweb-pdf"
name="account.report_invoice"
file="account.report_invoice"
attachment_use="True"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
/>

that work with "/web/content/34641?download=true" call for example.
What's the relation between the call and report?


how can I do if I want that "/web/content/34641?download=true" works for another custom report?
DO I have to define a new method or a new report? Or both?
Awatar
Odrzuć
Najlepsza odpowiedź

hello

you don't have to define the method.  attachment_use="True" this means when the report print at that time the report will reloaded from the attachment. and /web/content/34641 means it's your attachment record id. so when this controller call it will take the data of the attachment record number 34641.
so if in report if you define the attachment_use="True" it will works for your report also. There is also different routes so you can pass parameter into controller as per your needs like <string:model>/<int:id>/<string:filename> it means model name/recordid/field(which field data you want).

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
gru 21
3360
1
sty 24
5065
1
lut 18
12129
1
lut 24
6075
1
wrz 22
7200