Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3348 Vizualizări

Hello,


I want to raise an error after printing certain number of reports. 

*Number of reports will be entered in a field.


ex: if in the field 20; so the user will be allowed to print 20 report only and when he tries to print 21 it shows anerror that (You can't print anymore reports)


May anyone help in code. Waiting for a reply!

Thanks.

Imagine profil
Abandonează

user printing report one by one or in onetime?

Cel mai bun răspuns

Hello Asma,

You can use the _get_report_values odoo base method for developing your functionality because when you print a report so first called this method.

You can check the report number using your field and add validation errors.

Hope this answer helps you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Imagine profil
Abandonează

Code example:

class ReportDetails(models.AbstractModel):
_name = "report.your_module_name.your_xml_report_id"
_description = "Report"

@api.model
def _get_report_values(self, docids, data=None):
res = super(ReportDetails, self)._get_report_values(docids, data)
"""
Add your condition and raise a warning.
"""
return res

Related Posts Răspunsuri Vizualizări Activitate
0
ian. 22
2500
0
mai 24
881
2
feb. 22
8859
0
ian. 22
20
0
oct. 21
4