[FIX] base: add fake fields
Values for "context" and "data" key were injected into the action dictionnary by report_action to be used by the /report controller later Courtesy of William Henrotin (whe) for the test X-original-commit: 4d43a301fd10cfeb498d9bf6b614779e26e12d16
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
odoo.define('stock.reports.setup.tour', function (require) {
|
||||
"use strict";
|
||||
|
||||
const tour = require('web_tour.tour');
|
||||
|
||||
tour.register('test_stock_route_diagram_report', {
|
||||
test: true,
|
||||
}, [
|
||||
{
|
||||
trigger: '.o_kanban_record',
|
||||
extra_trigger:'.breadcrumb',
|
||||
},
|
||||
{
|
||||
trigger: '.nav-item > a:contains("Inventory")',
|
||||
},
|
||||
{
|
||||
trigger: '.btn[id="stock.view_diagram_button"]',
|
||||
},
|
||||
{
|
||||
trigger: 'iframe .o_report_stock_rule',
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -17,3 +17,4 @@ from . import test_packing_neg
|
||||
from . import test_proc_rule
|
||||
from . import test_wise_operator
|
||||
from . import test_report
|
||||
from . import test_report_tours
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
import odoo
|
||||
from odoo.tests import Form, HttpCase, tagged
|
||||
|
||||
|
||||
@tagged('-at_install', 'post_install')
|
||||
class TestStockReportTour(HttpCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
def _get_report_url(self):
|
||||
return '/web#&model=product.template&action=stock.product_template_action_product'
|
||||
|
||||
|
||||
def test_stock_route_diagram_report(self):
|
||||
""" Open the route diagram report."""
|
||||
url = self._get_report_url()
|
||||
|
||||
self.start_tour(url, 'test_stock_route_diagram_report', login='admin', timeout=180)
|
||||
@@ -111,7 +111,7 @@
|
||||
<label for="route_ids" attrs="{'invisible': [('type', 'in', ['service', 'digital'])]}"/>
|
||||
<div>
|
||||
<field name="route_ids" class="mb-0" widget="many2many_checkboxes" attrs="{'invisible': ['|', ('has_available_route_ids', '=', False), ('type', 'in', ['service', 'digital'])]}"/>
|
||||
<button string="View Diagram" type="action" name="%(action_open_routes)d" icon="fa-arrow-right"
|
||||
<button id="stock.view_diagram_button" string="View Diagram" type="action" name="%(action_open_routes)d" icon="fa-arrow-right"
|
||||
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
|
||||
class="btn btn-link pt-0" context="{'default_product_tmpl_id': id}"/>
|
||||
</div>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<script type="text/javascript" src="/stock/static/src/js/forecast_widget.js"></script>
|
||||
<script type="text/javascript" src="/stock/static/src/js/basic_model.js"></script>
|
||||
<script type="text/javascript" src="/stock/static/src/js/stock_rescheduling_popover.js"></script>
|
||||
<script type="text/javascript" src="/stock/static/tests/tours/stock_report_tests.js"></script>
|
||||
<link rel="stylesheet" type="text/scss" href="/stock/static/src/scss/forecast_widget.scss"/>
|
||||
<link rel="stylesheet" type="text/scss" href="/stock/static/src/scss/stock_traceability_report.scss"/>
|
||||
<link rel="stylesheet" type="text/scss" href="/stock/static/src/scss/stock_empty_screen.scss"/>
|
||||
|
||||
@@ -146,6 +146,10 @@ class IrActionsReport(models.Model):
|
||||
def _get_readable_fields(self):
|
||||
return super()._get_readable_fields() | {
|
||||
"report_name", "report_type", "target",
|
||||
# these two are not real fields of ir.actions.report but are
|
||||
# expected in the route /report/<converter>/<reportname> and must
|
||||
# not be removed by clean_action
|
||||
"context", "data",
|
||||
}
|
||||
|
||||
def associated_view(self):
|
||||
|
||||
Reference in New Issue
Block a user