File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import json
44
55from markupsafe import Markup
6- from odoo import _ , models
6+ from odoo import _ , api , models
77from odoo .addons .web .controllers .export import CSVExport
88from odoo .tools .misc import xlsxwriter
99
@@ -12,6 +12,11 @@ class IrModel(models.Model):
1212 _name = "ir.model"
1313 _inherit = ["ir.model" , "base.bg" ]
1414
15+ @api .model
16+ def get_export_threshold (self ):
17+ """Get the threshold for background export without requiring admin permissions."""
18+ return int (self .env ["ir.config_parameter" ].sudo ().get_param ("export_bg.record_threshold" , "500" ))
19+
1520 def _prepare_export_data (self , data ):
1621 params = json .loads (data )
1722 Model = self .env [params ["model" ]].with_context (** params .get ("context" , {}))
Original file line number Diff line number Diff line change 11/** @odoo -module **/
22
3- import { ListController } from "@web/views/list/list_controller" ;
43import { patch } from "@web/core/utils/patch" ;
4+ import { ListController } from "@web/views/list/list_controller" ;
55
66patch ( ListController . prototype , {
77 async downloadExport ( fields , import_compat , format ) {
88 const resIds = this . isDomainSelected ? false : await this . getSelectedResIds ( ) ;
99 const recordCount = resIds ? resIds . length : ( this . model . root . count || 0 ) ;
1010
1111 const threshold = await this . model . orm . call (
12- "ir.config_parameter " ,
13- "get_param " ,
14- [ "export_bg.record_threshold" , "500" ]
12+ "ir.model " ,
13+ "get_export_threshold " ,
14+ [ ]
1515 ) ;
1616
17- if ( recordCount > parseInt ( threshold ) ) {
17+ if ( recordCount > threshold ) {
1818 const data = {
1919 model : this . props . resModel ,
2020 fields : fields ,
You can’t perform that action at this time.
0 commit comments