This question has been flagged
2 Replies
2660 Views

I can't load my module, becuase it is trying to search for an xpath location in apps settings, and my module is meant for the website_sales app. So, I have 2 questions

1) Is something wrong with my code

2) Is there a way to limit module's functionality only to specific url? (e.g. 127.0.0.1/shop)

Error log when I try to press "Upgrade", to update the edited module - https://pastebin.com/6mjgk38g

Template code:

<odoo>
    <data>
       <template id="website_sales_inh" name="webiste_sales_inherit" inherit_id="website_sale.products_item">
          <xpath expr="//span[@data-oe-model='product.template' and @data-oe-id='2' and @data-oe-field='image_1920' and @data-oe-type='image' and @data-oe-expression='product.image_1920' and @class='d-flex h-100 justify-content-center align-items-center']" position="inside">
             <input name="testing our site" t-att-value="1234" type="hidden"/>            
          </xpath>
       </template>
    </data>
</odoo>

Model code:

# -*- coding: utf-8 -*-

from odoo import models, fields, api


class imgtogif_r(models.Model):
    _inherit = 'product.product'
    _name = 'product.product'

Avatar
Discard
Author Best Answer

Well... I need this span element from the shop - https://prnt.sc/sdpzkm
My thought is that, it is trying to find it in the settings, and that's why it is failing to load.
And my module is meant to work with website_sales, not the main view of website
If something is wrong about xpath, I would like to know :)

P.S. I can't comment on answers, sorry



Avatar
Discard

You can't inherit HTML code from the website. Please make yourself familiar with the basics of Odoo development.

Best Answer

If you check the original parent view, you will see that there is no span element with the expression you have specified. You can check the parent view website_sale.products_item with the developer mode activated under "Settings/Technical/User Interface/Views".

Your second question is not understandable, and you should not mix questions.

Avatar
Discard