Пользовательский отчет Odoo - Внешний идентификатор не найден

Я создаю настраиваемый отчет в модуле Inventory (stock), для которого я создал всплывающее окно (окно) для выбора, а затем после нажатия кнопки отправки вызывается функция python. Проблема в том, что я получаю внутреннюю ошибку сервера с сообщением

Value Error: External ID not found in the system: stock.customer_detail_report

Вот файл stock_report_views.xml:

<odoo>
<data>
<report
            string="Customer Report"
            id="action_customer_detail_report"
            model="customer.detail"
            name="stock.customer_detail_report"
            file="stock.customer_detail_report"
            report_type="qweb-pdf"
            print_report_name="Customer_Detail"
        />
    </data>
</odoo>

Вот модель customer_detail.py

class CustomerDetail(models.TransientModel):
    _name = 'customer.detail'
    _description = 'Customer Detail'    

    customer_vendor = fields.Many2one('res.partner', 
                        string="Customer/Vendor", help="List of Customer and Vendors")
    PO = fields.Integer('purchase.order', related="id")
    
    def open_table(self):
        self.ensure_one()
        return self.env.ref('action_customer_detail_report').report_action(self)

Вот всплывающее окно (окно) customer_detail.xml:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_customer_detail" model="ir.ui.view">
        <field name="name">Customer Details</field>
        <field name="model">customer.detail</field>
        <field name="arch" type="xml">
            <form string="Choose your date">
                <group>
                    <group>
                        <field name="customer_vendor" />
                    </group>
                </group>
                <footer>
                    <button name="open_table" string="Retrieve the Customer Details" type="object" class="btn-primary"/>
                    <button string="Cancel" class="btn-secondary" special="cancel" />
                </footer>
            </form>
        </field>
    </record>
    <record id="action_customer_detail" model="ir.actions.act_window">
        <field name="name">Customer Detail</field>
        <field name="res_model">customer.detail</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="view_customer_detail"/>
        <field name="target">new</field>
    </record>
    <menuitem id="menu_customer_detail" name="Customer Detail" parent="stock.menu_warehouse_report" sequence="100" action="action_customer_detail_report"/>
</odoo>

И вот последний вид customer_detail_report.xml:

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <template id="action_customer_detail_report">

            <t t-call="web.basic_layout">
              <div class="page" style="padding-top:-10%;">
                   <div class="col-xs-4" style="padding:1;">
                      <h1>This is a test</h1>
                   </div>
              </div>
            </t>
    </template>
</odoo>

Вот файл манифеста:

{
    'name': 'Inventory',
    'version': '1.1',
    'summary': 'Manage your stock and logistics activities',
    'description': "",
    'website': 'https://www.odoo.com/page/warehouse',
    'depends': ['product', 'barcodes'], 
    'category': 'Warehouse',
    'sequence': 13,
    'demo': [
        'data/stock_demo_pre.xml',
        'data/procurement_demo.xml',
        'data/stock_demo.xml',
        'data/stock_orderpoint_demo.xml',
        'data/stock_demo2.xml',
        'data/stock_location_demo_cpu1.xml',
        'data/stock_location_demo_cpu3.xml',
    ],
    'data': [
        'security/stock_security.xml',
        'security/ir.model.access.csv',
        'views/stock_menu_views.xml',
        'data/stock_traceability_report_data.xml',
        'data/procurement_data.xml',

        'report/report_stock_forecast.xml',
        'report/stock_report_views.xml',
        'report/report_package_barcode.xml',
        'report/report_lot_barcode.xml',
        'report/report_location_barcode.xml',
        'report/report_stockpicking_operations.xml',
        'report/report_deliveryslip.xml',
        'report/report_stockinventory.xml',
        'report/report_stock_rule.xml',
        'report/transfer_printlabel_report.xml',

        'wizard/stock_change_product_qty_views.xml',
        'wizard/stock_picking_return_views.xml',
        'wizard/stock_scheduler_compute_views.xml',
        'wizard/stock_immediate_transfer_views.xml',
        'wizard/stock_backorder_confirmation_views.xml',
        'wizard/stock_overprocessed_transfer_views.xml',
        'wizard/stock_quantity_history.xml',
        'wizard/customer_detail.xml',
        'wizard/stock_rules_report_views.xml',
        'wizard/stock_warn_insufficient_qty_views.xml',
        'wizard/product_replenish_views.xml',
        'wizard/stock_track_confirmation_views.xml',
        'wizard/stock_package_destination_views.xml',
        'wizard/transfer_printlabel_view.xml',

        'views/res_partner_views.xml',
        'views/product_strategy_views.xml',
        'views/stock_production_lot_views.xml',
        'views/stock_picking_views.xml',
        'views/stock_scrap_views.xml',
        'views/stock_inventory_views.xml',
        'views/stock_quant_views.xml',
        'views/stock_location_views.xml',
        'views/stock_warehouse_views.xml',
        'views/stock_move_line_views.xml',
        'views/stock_move_views.xml',
        'views/product_views.xml',
        'views/res_config_settings_views.xml',
        'views/report_stock_traceability.xml',
        'views/stock_template.xml',
        'views/stock_rule_views.xml',
        'views/stock_package_level_views.xml',        
        'views/product_sequence_views.xml',

        'data/default_barcode_patterns.xml',
        'data/stock_data.xml',
        'data/stock_sequence_data.xml',
    ],
    'qweb': [
        'static/src/xml/stock_traceability_report_backend.xml',
    ],
    'installable': True,
    'application': True,
    'auto_install': False,
    'pre_init_hook': 'pre_init_hook',
    'post_init_hook': '_create_warehouse',
    'uninstall_hook': 'uninstall_hook',
}

Есть идеи, почему я не могу связать отчет и не получаю всплывающее окно и окончательный вид отчета?


person user1584253    schedule 27.11.2020    source источник
comment
не могли бы вы поделиться своим файлом манифеста, потому что эта ошибка исходит из файла манифеста.   -  person Adam Strauss    schedule 27.11.2020
comment
вопрос обновлен   -  person user1584253    schedule 27.11.2020
comment
О, прости! плохо, я хочу сказать, что эта ошибка исходит от security file, потому что есть модель, которой нет в вашем модуле ...   -  person Adam Strauss    schedule 27.11.2020
comment
просто проверьте stock.customer_detail_report, есть ли в вашем модуле какая-либо модель.   -  person Adam Strauss    schedule 27.11.2020
comment
Нет, у меня только одна модель с именем customer_detail   -  person user1584253    schedule 27.11.2020
comment
Вы использовали неправильное имя модуля. Вам необходимо заменить stock.customer_detail_report на your_module_name.customer_detail_report для вашего файла и имя в теге отчета.   -  person Neural    schedule 28.11.2020


Ответы (1)


Похоже, вы напрямую добавляете настройку в стандартный модуль. Предлагаю вам сделать собственный модуль для правильной реализации.

Однако в приведенном выше коде я обнаружил ошибку листинга

  1. customer_detail_report.xml Не определено в файле манифеста.

  2. # P4 #
        <template id="customer_detail_report">
            <t t-call="web.basic_layout">
                  <div class="page" style="padding-top:-10%;">
                       <div class="col-xs-4" style="padding:1;">
                          <h1>This is a test</h1>
                       </div>
                  </div>
                </t>
        </template>
    
person Vishnu VaNnErI    schedule 30.11.2020