Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2309 มุมมอง

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,}
       
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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,}

       

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ค. 24
1371
2
เม.ย. 24
1946
2
ก.ค. 25
640
1
ธ.ค. 24
3616
About Odoo Inventory แก้ไขแล้ว
2
ธ.ค. 24
2867