Skip to Content
Menu
This question has been flagged

Hello community, I've created a report which is trigering the "Uncaught Promise" error when I try to load the report.

This is the second report that I've created in the module, following the same guidelines that the first one. But the first report work fine with no errors.  

I'm using Odoo v15 enterprise edition on SH. Please help me to solve this issue. 

The the information is as follows:

Error message:
TypeError: Cannot read properties of undefined (reading 'type')
    at ControlPanelModelExtension._extractAttributes (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:45534:46)
    at https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:45390:26 (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:958)
    at Array.forEach () (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:814)
    at ControlPanelModelExtension._createGroupOfFiltersFromArch (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:45347:24) (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:771)
    at ControlPanelModelExtension._addFilters (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:45174:18) (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:598)
    at ControlPanelModelExtension.prepareState (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:44797:22) (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:221)
    at ControlPanelModelExtension.importState (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:93703:22) (/web/static/src/legacy/js/model.js:81)
    at ActionModel.importState (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:93982:27) (/web/static/src/legacy/js/model.js:360)
    at new Model (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:93878:18) (/web/static/src/legacy/js/model.js:256)
    at new ActionModel (https://obsf-obsf2-11797879.dev.odoo.com/web/assets/debug/web.assets_backend.js:63612:5) (/web/static/src/legacy/js/views/action_model.js:59)
Report code:
class AccountReport(models.Model):
    """Report: accounts per city and state"""

    _name = 'account.report'
    _description = 'Accounts visited per zone'
    _auto = False
    _order = 'visit_date desc'

    account_id = fields.Many2one('res.partner', string='Account', readonly=True)
    distributor = fields.Many2one('res.partner', string='OBSF Distributor', readonly=True)
    poc = fields.Many2one('res.partner', string='POC', readonly=True)
    city = fields.Char(string='City', readonly=True)
    state = fields.Many2one('res.country.state', string='State', readonly=True)
    sales_rep = fields.Many2one('res.partner', string='Sales Rep', readonly=True)
    territory_manager = fields.Many2one('res.partner', string='Territory Manager', readonly=True)
    visit_date = fields.Date(string='Date', readonly=True)
    phones = fields.Char(string='POC Phones', readonly=True)
    email = fields.Char(string='POC email', readonly=True)
    account_score = fields.Float('Acc Score', group_operator="avg", readonly=True)

    def _query(self):
        return """
            SELECT
                ROW_NUMBER() OVER (ORDER BY v.id, rs4.id
        """


    def init(self):
        tools.drop_view_if_exists(self._cr, self._table)
        self._cr.execute("""
            CREATE OR REPLACE VIEW %s AS (
            %s
        )
        """ % (self._table, self._query()))
XML definition:

            account.visit.tree.report
            account.report
           
               
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
               
           
       


            account.visit.report.search
            account.report
           
               
                   
                   
                   
                   
                   
                   
                   
                   
                   
                                                name="filter_date"
                            date="visit_date"
                            default_period="this_month"/>
                   
                   
                           
                           
                           
                           
                           
                           
                           
                           
                   
               
           
       


            Account Visit Report
            account.report
            tree
           
            {'search_default_groupby_city': 1,}
       
Avatar
Discard
Best Answer

Hello, probably u can try send your module to easy to examine because your xml just won't appear

Avatar
Discard
Author Best Answer

XML files didn't appear as expected. I pasted them here again:

Report Tree View:

record id="account_visit_tree_report" model="ir.ui.view">

            account.visit.tree.report

            account.report

           

               

                   

                   

                     

                   

                   

                   

                   

                   

                   

                   

                     

               

           

       

Filter View:

            account.visit.report.search

            account.report

           

               

                   

                   

                   

                   

                   

                   

                   

                   

                     

                   

                            name="filter_date"

                            date="visit_date"

                            default_period="this_month"/>

                   

                   

                           

                           

                           

                           

                           

                           

                           

                           

                   

               

           

       

Action XML:

            Account Visit Report

            account.report

            tree

           

            {'search_default_groupby_city': 1,}

       

Avatar
Discard
Related Posts Replies Views Activity
0
Jul 24
1195
2
Apr 24
1772
2
Jul 25
264
1
Dec 24
3027
2
Dec 24
2643