This question has been flagged

Hey people , i need help with an error i keep getting when i try to print a custom report , 

ther error log :

line 924, in xmlid_lookup raise ValueError('External ID not found in the system: %s' % (xmlid)) QWebTemplateNotFound: External ID not found in the system: cm_rental_contracts.report_retailcontracts

The funny thing is tthat if i go to settings > reports > all my custom reports are there.

My code for printing the custom report :

 def print_contract(self, cr, uid, ids, context=None):
        """ 
        This function prints the Rental Contracts 
        """
        assert len(ids) == 1, 'This option should only be used for a single id at a time.'
        #self.sent = True
        #context = dict(context or {}, active_ids=ids)
        Printfood_obj = self.pool.get('cm.rental.contracts')
        val = Printfood_obj.browse(cr,uid,ids, context=context)
        if(val.contract_category == "Food"):
            return self.pool['report'].get_action(cr, uid, ids, 'cm_rental_contracts.report_foodcontracts', context=context)
        elif(val.contract_category == "Retail"):
            return self.pool['report'].get_action(cr, uid, ids, 'cm_rental_contracts.report_retailcontracts', context=context)
        elif(val.contract_category == "Storage"):
            return self.pool['report'].get_action(cr, uid, ids, 'cm_rental_contracts.report_storagecontracts', context=context)
        else:
             return self.pool['report'].get_action(cr, uid, ids, 'cm_rental_contracts.report_retailcontracts', context=context)

 

the xml :

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report 
            id="action_report_print_contract" 
            string="Tenant/unit rental Contracts" 
            model="cm.rental.contracts" 
            report_type="qweb-pdf"
            name="cm_rental_contracts.report_foodcontracts" 
            file="cm_rental_contracts.report_foodcontracts"
             attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
        /> 
    </data>
</openerp>

 

Does any one no what the error could be and how i can solve it ?

Avatar
Discard
Author Best Answer

Hello zbik i for got to add them to the last post : 

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report 
            id="action_report_print_retail_contract" 
            string="Tenant/unit retail Contracts" 
            model="cm.rental.contracts" 
            report_type="qweb-pdf"
            name="cm_rental_contracts.report_retailcontracts" 
            file="cm_rental_contracts.report_retailcontracts"
             attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
        /> 
    </data>
</openerp>

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report 
            id="action_report_print_storage_contract" 
            string="Tenant/unit storage Contracts" 
            model="cm.rental.contracts" 
            report_type="qweb-pdf"
            name="cm_rental_contracts.report_storagecontracts" 
            file="cm_rental_contracts.report_storagecontracts"
             attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
        /> 
    </data>
</openerp>

i still get th error here is my 

__openerp__.py:

##############################################################################
#
#    Zeraxis Add-on Modules for the OpenObject Platform
#    Copyright (C) 2014 Zeraxis Limited (http://www.zeraxis.com)
#
#    OpenERP & OpenObject originally created by Tiny SPRL (http://tiny.be)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

{
    "name" : "Camden Market Managers",
    "version" : "1.0",
    "author" : "Zeraxis Ltd",
    "category" : "Tools",
    "website": "http://www.zeraxis.com",
    "description": """Custom module to extend features for market managers """,
    "depends" : ["base" , "report" , "analytic" , "account"],
    "data" : [
              "cm_rental_contracts_view.xml",
              "cm_account_analytic_account_view.xml",
              "report/cm_report_retail_contracts.xml",
              "report/cm_report_storage_contracts.xml",
              "report/cm_report_food_contracts.xml",
              "security/ir.model.access.csv",
              "views/report_retailcontracts.xml",
              "views/report_foodcontracts.xml",
              "views/report_storagecontracts.xml",
                  "views/cm_market_managers_view.xml"
                  
     ],
    "demo": [],
    "active": False,
    "installable": True
}

 

 

Avatar
Discard

You check whether the report with name report_foodcontracts exists in the system (In Settings/Reports/Reports)?

Author

hey the problem is fixed , maybe a bug , but all i did was resatrt the server and update all modules

Best Answer

In XML you have only definded cm_rental_contracts.report_foodcontracts. I do not see report_retailcontracts and therefore error is: External ID not found in the system: cm_rental_contracts.report_retailcontracts

Avatar
Discard