Skip to Content
Menu
This question has been flagged
1 Reply
1917 Views

Goodnight,

I am moving a module from version 11 to 12, and I have an error with a view, but I cannot locate. I know the error is in: fiscal_position_remark, but I can't locate the view that references that field.

I looked for the view in the system but I couldn't locate it.

Vista `report_saleorder_document_inherit_sale_management`

very much appreciate your help.

view:

<?xml version="1.0" encoding="UTF-8"?>

<odoo>

    <data noupdate="0">

        <template id="sale.report_saleorder_document">

            <t t-call="web.external_layout">

                <t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})"/>

                <div class="header o_background_header">

<div class="row">

<div class="col-xs-3">

<span t-field="doc.company_id.logo" t-field-options="{'widget':'image'}"/>

</div>

<div class="col-xs-4">

<div><h3><span t-field="doc.company_id.name"/></h3></div>

<div><span t-field="doc.company_id.street"/></div>

<br/>

<div t-if="doc.company_id.email"><b> Email: </b><span t-field="doc.company_id.email"/></div>

<div t-if="doc.company_id.phone"><b> Teléfono: </b><span t-field="doc.company_id.phone"/></div>

</div>

<div class="col-xs-4 col-xs-offset-1" style="border-style:solid; border-width:thin;">

<div class="text-center">RUC: <span t-field="doc.company_id.vat"/></div>

<div class="text-center">

<h3>

                                <t t-if="not (env.context.get('proforma', False) or is_pro_forma)">

                                    <span t-if="doc.state not in ['draft','sent']">PEDIDO # </span>

                                    <span t-if="doc.state in ['draft','sent']">COTIZACIÓN # </span>

                                </t>

                                <t t-if="env.context.get('proforma', False) or is_pro_forma">

                                    <span>Pro-Forma Invoice # </span>

                                </t>

                                <span t-field="doc.name"/> 

</h3>

</div>

</div>

</div>

</div>

                <div class="page" style="padding-top:20px">

                    <div class="row" style="font-size:10px">

                        <!--DIRECCIÓN DEL CLIENTE-->

<div name="invoice_address" class="col-xs-5">

<div t-if="doc.partner_id.parent_id">

                                <div>

                                    <b>Cliente:</b>

                                    <t t-if="doc.partner_id.parent_id.registration_name">

                                        <span t-esc="doc.partner_id.parent_id.registration_name"/>

                                    </t>

                                    <t t-else="">

                                        <span t-esc="doc.partner_id.parent_id.name"/>

                                    </t>

                                </div>


                                <div t-if="doc.partner_id.parent_id.vat">

                                    <b><span t-if="doc.partner_id.catalog_06_id.code =='6' ">RUC: </span></b>

                                    <b><span t-if="doc.partner_id.catalog_06_id.code == '0' ">DOC.TRIB.Nro.DOM.SIN.RUC : </span></b>

                                    <b><span t-if="doc.partner_id.catalog_06_id.code == '1' "></span></b>

                                    <span t-esc="doc.partner_id.vat"/>

                                </div>


                                <div>

                                    <b><span>Dirección:</span></b>

                                    <span t-esc="doc.partner_id.parent_id.street"/>

                                </div>

                                <div>

                                    <span t-field="doc.partner_id.parent_id.state_id"/> - <span t-field="doc.partner_id.parent_id.province_id"/> - <span t-field="doc.partner_id.parent_id.district_id"/>

                                </div>

                                </div>

<div t-else="">

                                <b>Cliente: </b>

                                <div t-if="doc.partner_id.registration_name">

                                    <span t-field="doc.partner_id.registration_name"/>

                                </div>

                                <div t-else="">

                                    <span t-field="doc.partner_id.name"/>

                                </div>

                                

                                <div t-if="doc.partner_id.vat">

                                    <span t-if="doc.partner_id.catalog_06_id.code == '6' "><b>RUC:</b> </span>

                                    <span t-if="doc.partner_id.catalog_06_id.code == '0' "><b>DOC.TRIB.Ndoc.DOM.SIN.RUC :</b></span>

                                    <span t-if="doc.partner_id.catalog_06_id.code == '1' "><b>DNI/RUC:</b> </span>

                                    <span t-field="doc.partner_id.vat"/>

                                </div>

                                

                                <div>

                                    <b>Dirección: </b>

                                    <span t-field="doc.partner_id.street"/>

                                </div>

                                <div>

                                    <span t-field="doc.partner_id.state_id"/> - <span t-field="doc.partner_id.province_id"/> - <span t-field="doc.partner_id.district_id"/></div>

                                </div>

    </div>

<div class="col-xs-3 col-xs-offset-3">

<div name="validity_date" t-if="doc.validity_date" >

                                <strong t-if="doc.validity_date">Fecha de Caducidad:</strong>

                                <p t-field="doc.validity_date"/>

                            </div>                            


                            <div name="user_id" t-if="doc.user_id" >

                                <strong>Vendedor:</strong>

                                <p t-field="doc.user_id"/>

                            </div>


                            <div name="currency_unit_label" t-if="doc.currency_id.currency_unit_label" >

<strong t-if="doc.currency_id.currency_unit_label">Tipo de Moneda: </strong>

<span t-field="doc.currency_id.currency_unit_label"/>

</div>


                            <div name="payment_term" t-if="doc.payment_term_id" >

<strong t-if="doc.payment_term_id.note">Condición de Pago: </strong>

<span t-field="doc.payment_term_id.note"/>

                            </div>

</div>

                    </div>


                    <t t-set="display_discount" t-value="any([l.discount for l in doc.order_line])"/>


                    <t t-foreach="doc.order_lines_layouted()" t-as="page">

                        <table class="table table-condensed">

                            <thead>

                                <tr>

                                    <th>Description</th>

                                    <th class="text-right">Quantity</th>

                                    <th class="text-right">Unit Price</th>

                                    <th t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">Disc.(%)</th>

                                    <th class="text-right">Taxes</th>

                                    <th class="text-right" groups="sale.group_show_price_subtotal">Amount</th>

                                    <th class="text-right price_tax_included" groups="sale.group_show_price_total">Total Price</th>

                                </tr>

                        </thead>

                        <tbody class="sale_tbody">

                                <t t-foreach="page" t-as="layout_category">


                                    <t t-if="layout_category_size &gt; 1 or page_size &gt; 1" groups="sale.group_sale_layout">

                                        <tr class="active">

                                            <td colspan="7" style="font-weight: bold; border-bottom: 1px solid black;">&amp;bull;

                                                <t t-esc="layout_category['name']"/>

                                            </td>

                                        </tr>

                                    </t>


                                    <!-- Lines associated -->

                                    <t t-foreach="layout_category['lines']" t-as="l">

                                        <tr>

                                            <td><span t-field="l.name"/></td>

                                            <td class="text-right">

                                                <span t-field="l.product_uom_qty"/>

                                                <span t-field="l.product_uom" groups="product.group_uom"/>

                                            </td>

                                            <td class="text-right">

                                                <span t-field="l.price_unit"/>

                                            </td>

                                            <td t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">

                                                <span t-field="l.discount"/>

                                            </td>

                                            <td class="text-right">

                                                <span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_id))"/>

                                            </td>

                                            <td class="text-right" groups="sale.group_show_price_subtotal">

                                                <span t-field="l.price_subtotal" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>

                                            </td>

                                            <td class="text-right" groups="sale.group_show_price_total">

                                                <span t-field="l.price_total" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>

                                            </td>

                                        </tr>

                                    </t>


                                    <t t-if="(layout_category_size &gt; 1 or page_size &gt; 1) and layout_category['subtotal']" groups="sale.group_sale_layout">

                                        <tr class="text-right">

                                            <td colspan="6">

                                                <strong>Subtotal: </strong>

                                                <t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/>

                                                <span t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}"/>

                                            </td>

                                        </tr>

                                    </t>


                                </t>

                            </tbody>

                        </table>


                        <t t-if="page_index &lt; page_size - 1" groups="sale.group_sale_layout">

                            <p style="page-break-before:always;"> </p>

                        </t>

                    </t>

                    <div class="clearfix">

                        <div class="row" name="total">

                            <div class="col-xs-4 pull-right">

                                <table class="table table-condensed" style="min-width: 200px;max-width: 350px;">

                                    <tr class="border-black" style="border-bottom:1px solid #dddddd;">

                                        <td><strong>Subtotal</strong></td>

                                        <td class="text-right">

                                            <span t-field="doc.amount_untaxed" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>

                                        </td>

                                    </tr>

                                    <t t-foreach="doc._get_tax_amount_by_group()" t-as="amount_by_group">

                                        <tr style="border-bottom:1px solid #dddddd;">

                                            <t t-if="amount_by_group[3] == 1 and doc.amount_untaxed == amount_by_group[2]">

                                                <td>

                                                    <span t-esc="amount_by_group[0]"/>

                                                    <span>&amp;nbsp;<span>on</span>&amp;nbsp;<t t-esc="amount_by_group[2]" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/></span>

                                                </td>

                                                <td class="text-right">

                                                    <span t-esc="amount_by_group[1]" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>

                                                </td>

                                            </t>

                                            <t t-else="">

                                                <td>

                                                    <span t-esc="amount_by_group[0]"/>

                                                </td>

                                                <td class="text-right">

                                                    <span t-esc="amount_by_group[1]" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>

                                                </td>

                                            </t>

                                        </tr>

                                    </t>

                                    <tr class="border-black">

                                        <td><strong>Total</strong></td>

                                        <td class="text-right">

                                            <span t-field="doc.amount_total" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>

                                        </td>

                                    </tr>

                                </table>

                            </div>

                        </div>

                    </div>

                    <div >

                        <p t-field="doc.note"/>

                        <p t-if="doc.payment_term_id.note">

                            <span t-field="doc.payment_term_id.note"/>

                        </p>

                          <p id="fiscal_position_remark" t-if="doc.fiscal_position_id and doc.fiscal_position_id.note">

                            <strong>Fiscal Position Remark:</strong>

                            <span t-field="doc.fiscal_position_id.note"/>

                        </p>

                    </div>

                </div>

            </t>

        </template>


Odoo Server Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 1108, in _validate_fields
    check(self)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 345, in _check_xml
    view_def = view.read_combined(['arch'])
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 783, in read_combined
    arch = self.apply_view_inheritance(arch_tree, root.id, self.model)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 732, in apply_view_inheritance
    source = self.apply_inheritance_specs(source, specs_tree, view_id)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 710, in apply_inheritance_specs
    self.raise_view_error(_("Element '%s' cannot be located in parent view") % tag, inherit_id)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 548, in raise_view_error
    raise ValueError(message)
ValueError: El elemento '<xpath expr="//div[hasclass('page')]/p[@id='fiscal_position_remark']">' no puede ser localizado en la vista padre

Contexto del error:
Vista `report_saleorder_document_inherit_sale_management`
[view_id: 1208, xml_id: n/a, model: n/a, parent_id: 854]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 757, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 735, in _tag_template
    return self._tag_record(record, data_node)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 662, in _tag_record
    record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3821, in _load_records
    records = self._load_records_create([data['values'] for data in to_create])
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3735, in _load_records_create
    return self.create(values)
  File "<decorator-gen-32>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
    return create(self, arg)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 428, in create
    return super(View, self).create(vals_list)
  File "<decorator-gen-3>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
    return create(self, arg)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3552, in create
    fields[0].determine_inverse(batch_recs)
  File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1097, in determine_inverse
    getattr(records, self.inverse)()
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch
    view.write(data)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 444, in write
    return super(View, self).write(self._compute_defaults(vals))
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3269, in write
    self._write(store_vals)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3413, in _write
    self._validate_fields(vals)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 1112, in _validate_fields
    raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
odoo.exceptions.ValidationError: ('Error mientras se validaban las restricciones\n\nEl elemento \'<xpath expr="//div[hasclass(\'page\')]/p[@id=\'fiscal_position_remark\']">\' no puede ser localizado en la vista padre\n\nContexto del error:\nVista `report_saleorder_document_inherit_sale_management`\n[view_id: 1208, xml_id: n/a, model: n/a, parent_id: 854]', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 696, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 749, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 736, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-61>", line 2, in button_immediate_install
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 73, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 444, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 553, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 421, in load_modules
    loaded_modules, update_module, models_to_check)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 313, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 222, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package, report=report)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 68, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 801, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 864, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 763, in parse
    exc_info[2]
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 757, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 735, in _tag_template
    return self._tag_record(record, data_node)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 662, in _tag_record
    record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3821, in _load_records
    records = self._load_records_create([data['values'] for data in to_create])
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3735, in _load_records_create
    return self.create(values)
  File "<decorator-gen-32>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
    return create(self, arg)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 428, in create
    return super(View, self).create(vals_list)
  File "<decorator-gen-3>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 452, in _model_create_multi
    return create(self, arg)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3552, in create
    fields[0].determine_inverse(batch_recs)
  File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1097, in determine_inverse
    getattr(records, self.inverse)()
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 275, in _inverse_arch
    view.write(data)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 444, in write
    return super(View, self).write(self._compute_defaults(vals))
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3269, in write
    self._write(store_vals)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3413, in _write
    self._validate_fields(vals)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 1112, in _validate_fields
    raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
odoo.tools.convert.ParseError: "Error mientras se validaban las restricciones

El elemento '<xpath expr="//div[hasclass('page')]/p[@id='fiscal_position_remark']">' no puede ser localizado en la vista padre

Contexto del error:
Vista `report_saleorder_document_inherit_sale_management`
[view_id: 1208, xml_id: n/a, model: n/a, parent_id: 854]
None" while parsing None:3, near
<data inherit_id="sale.report_saleorder_document">
    <xpath expr="//div[hasclass('page')]/p[@id='fiscal_position_remark']" position="after">
        <div t-if="doc.sale_order_option_ids and doc.state in ['draft', 'sent']">
            <t t-set="has_option_discount" t-value="any(doc.sale_order_option_ids.filtered(lambda o: o.discount != 0.0))"/>
            <h4>
                <span>Optional Products</span>
            </h4>
            <table class="table table-sm">
                <thead>
                    <tr>
                        <th class="text-left">Description</th>
                        <th t-if="has_option_discount" groups="sale.group_discount_per_so_line" class="text-left"/>
                        <th class="text-right">Unit Price</th>
                    </tr>
                </thead>
                <tbody class="sale_tbody">
                    <tr t-foreach="doc.sale_order_option_ids" t-as="option">
                        <td>
                            <span t-field="option.name"/>
                        </td>
                        <td t-if="has_option_discount" groups="sale.group_discount_per_so_line">
                            <strong t-if="option.discount != 0.0" class="text-info">
                                <t t-esc="((option.discount % 1) and '%s' or '%d') % option.discount"/>% discount
                            </strong>
                        </td>
                        <td>
                            <strong class="text-right">
                                <div t-field="option.price_unit" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}" t-att-style="option.discount and 'text-decoration: line-through' or None" t-att-class="option.discount and 'text-danger' or None"/>
                                <div t-if="option.discount">
                                    <t t-esc="'%.2f' % ((1-option.discount / 100.0) * option.price_unit)"/>
                                </div>
                            </strong>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </xpath>
</data>



Avatar
Discard
Best Answer

Because you have an ID for the element, I'd suggest you the simplify the xpath expression to directly address the element like that:

<xpath expr="//p[@id='fiscal_position_remark']" position="after">


Avatar
Discard