Parent view error when installing Ecommerce without price odoo module - odoo-9

I have Odoo v9 installed in CentOS7 on a remote server. I copied the Ecommerce Catalog without price module folder to the addons folder, activated developer mode, updated module list, clicked on install that module. I get this error posted below and if I come back to the apps that module shows up as "Installing".
Error details:Element '<xpath expr="//del[#class='text-danger mr8']">' cannot be located in parent view
Error context:View `Suggested Products Without Catalog Price`[view_id: 924, xml_id: n/a, model: n/a, parent_id: 894]None" while parsing None:23, near<data inherit_id="website_sale.cart_lines" name="Suggested Products Without Catalog Price"> <xpath expr="//del[#class='text-danger mr8']" position="replace"> <field name="text-danger" invisible="1" nolabel="1"/> </xpath> </data>
Here is the xml view it refers to:
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="products_item" inherit_id="website_sale.products_item" name="Shop Without Catalog Price">
<xpath expr="//del[#class='text-danger mr8']" position="replace">
<field name="text-danger" invisible="1" nolabel="1"/>
</xpath>
</template>
<template id="cart" inherit_id="website_sale.cart_lines" name="Shopping Cart Without Catalog Price">
<xpath expr="//del[#t-field='line.product_id.lst_price']" position="replace">
<field name="text-danger" invisible="1" nolabel="1"/>
</xpath>
</template>
<template id="product_price" inherit_id="website_sale.product_price" name="Product Page Without Catalog Price">
<xpath expr="//span[#class='text-danger oe_default_price']" position="replace">
<field name="text-danger oe_default_price" invisible="1" nolabel="1"/>
</xpath>
</template>
<template id="suggested_products_list" inherit_id="website_sale.cart_lines" name="Suggested Products Without Catalog Price">
<xpath expr="//del[#class='text-danger mr8']" position="replace">
<field name="text-danger" invisible="1" nolabel="1"/>
</xpath>
</template>
<template id="modal_cart" inherit_id="website_sale_options.modal" name="Modal Cart Without Catalog Price">
<xpath expr="//span[#t-attf-class='text-danger oe_default_price']" position="replace">
<field name="text_danger oe_default_price" invisible="1" nolabel="1"/>
</xpath>
<xpath expr="//span[#class='text-danger oe_optional']" position="replace">
<field name="text-danger oe_optional" invisible="1" nolabel="1"/>
</xpath>
</template>
</data>
</openerp>

What is going on here is that basically a ViewB tries to add something on ViewA using the //del[#class='text-danger mr8'] xpath as a hook. But this element on ViewA has probably been removed by another module. So, what you can do here is find which view uses this xpath expression and either edit it to use another expression or find the ViewA that this expression refers to and add the class='text-danger mr8' element so that ViewB can operate normally.

Related

Can I set default view mode of a field inside Notebook/Page

I have overriden account.invoice_supplier_form and I have added kanban view
<record id="invoice_supplier_form_inherit" model="ir.ui.view">
<field name="name">account.invoice.supplier.form.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook/page/field[#name='invoice_line_ids']" position="attributes">
<attribute name="mode">tree,kanban</attribute>
</xpath>
<xpath expr="//notebook/page/field[#name='invoice_line_ids']" position="inside">
<kanban class="o_kanban_mobile">
...
So now page inside notebook supports two views - tree and kanban for invoice_line_ids. I want to set kanban as default view. How do I do that?
...
Did you try this:
<xpath expr="//notebook/page/field[#name='invoice_line_ids']" position="attributes">
<!-- reverse the order here -->
<attribute name="mode">kanban,tree</attribute>
</xpath>
<!-- and here make sure the kanban is the first tag inside the field tag -->
<xpath expr="//notebook/page/field[#name='invoice_line_ids']/tree" position="before">
<kanban class="o_kanban_mobile">
....
....

TypeError: dict.record.id is undefined when I access to my custom kanban view in Odoo 11

I have a custom module that had a kanban view. His model inherits from res.users (and res.users inherits from res.partner).
I have a problem when I try to access to kanban view of my module. I know where is the error, but i donĀ“t have idea for how to solve.
The error is:
Error: QWeb2 - template['kanban-box']: Runtime Error: TypeError: dict.record.id is undefined
This is my kanban view (maestro):
<record model="ir.ui.view" id="maestro_kanban_view">
<field name="name">maestro.kanban.view</field>
<field name="model">aula10.maestro</field>
<field name="groups_id" eval="[(4, ref('grupo_maestros'))]"/>
<field name="arch" type="xml">
<kanban>
<field name='name'/>
<field name='image'/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o kanban_image">
<img t-att-src="kanban_image('maestro','image_medium', record.id.value)"/>
<div class="oe_kanban_details">
<!-- Title and Data content -->
<h4>
<a type="open">
<field name="name"/>
</a>
</h4>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
I know the problem is in the image, in record.id.value, because when I erase the img tag, the error disappear.
How can I fix this?
In kanban view you must mention every fields you use in the field list like in your code you have mentioned two fields nameand image just add id to them and Odoo should recognize it.
<field name='id'/>
<field name='name'/>
<field name='image'/>

Make a delete button invisible using attrs. I am using Odoo 10

I need to make a delete button invisible using attrs.
my code here.
in this code i want to put invisible delete button.
<record id="calender_event_form_id1" model="ir.ui.view">
<field name="name">calender_event</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_form_popup"/>
<field name="arch" type="xml" delete="false">
<xpath expr="//field[#name='partner_ids']" position="after">
<field name="c_is_meeting_done" string="Is Meeting Done?" readonly="1"/>
<field name="description"/>
</xpath>
<xpath expr="//field[#name='alarm_ids']" position="after">
<div name="buttons">
<button name="%(ouc_meeting_wizard_action)d" string="Close Meeting" attrs="{'invisible':[('c_is_meeting_done', '=', True)]}" type="action" class="oe_highlight" />
</div>
</xpath>
</field>
</record>
You can give "delete=1" to your particular view from xml. Like this:
<form string="Custom" delete="1"/>

Button not displaying report in odoo

I have been battling with an issue for a while now....Kindly help me. Below is the issue:
I created a button on the header of a form, the idea of this button is to show a report of an image file on click. But anytime i click this button, nothing happens. And when i edited the form view from developer's mode, i realized that the button is picking a different name. i.e
<header>
<button name="reports/bh_customcustom.report_formdownload_view" type="report" string="Form Download" class="oe_highlight"/>
</header>
instead of this which is in the code:
<header>
<button name="action_formdownloader" type="object"
string="Form Downloader" class="oe_highlight"/>
</header>
Below are my code snippet:
The form view:
<record model="ir.ui.view" id="form_download_form_view">
<field name="name">form_download.form</field>
<field name="model">formdownload</field>
<field name="arch" type="xml">
<form string="Form Download Form">
<header>
<button name="action_formdownloader" type="object"
string="Form Downloader" class="oe_highlight"/>
</header>
<sheet>
<group string="Company Name">
<!--<field name="company_name_id"/>-->
<field name="name"/>
<!--<field name="form_serial_no" />-->
</group>
</sheet>
</form>
</field>
</record>
The model:
class FormDownload(models.Model):
_name = 'formdownload'
_rec_name = 'form_serial_no'
# #api.multi
def action_formdownloader(self):
return self.env['report'].get('bh_customcustom.report_formdownload_view')
name = fields.Many2one('companyname', string="Company Name", ondelete='cascade',
required=True)
form_serial_no = fields.Char(string="Form Serial No", readonly=True)
status = fields.Boolean(string="Status", default=False)
Part of the openerp.py file related to it
'depends': ['base', 'construction_plot_4devnet', 'bh_custom', 'report'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/bh_customcustom.xml',
'sequences.xml',
'report/form_download_report.xml',
'security/security_groups.xml',
'templates.xml',
],
'images': [
'img/firstpage.png',
],
The report file:
<openerp>
<data>
<report
id="report_form_download"
model="formdownload"
string="Form Download Report"
name="bh_customcustom.report_formdownload_view"
file="bh_customcustom.report_formdownload_view"
report_type="qweb-pdf"/>
<record id="paperformat_formdownloadcheck" model="report.paperformat">
<field name="name">Form Download Check</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">80</field>
<field name="page_width">175</field>
<field name="orientation">Portrait</field>
<field name="margin_top">3</field>
<field name="margin_bottom">3</field>
<field name="margin_left">3</field>
<field name="margin_right">3</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">3</field>
<field name="dpi">80</field>
</record>
<template id="report_formdownload_view">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="report.external_layout">
<div class="page">
<!--<img class="img img-responsive" src="/bh_customcustom/static/src/img/firstpage.png"-->
<!--style="max-height: 45px"/>-->
<img src="/static/src/img/firstpage.png"
style="max-height: 45px"/>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>
The problem was from my path on the view xml file cos i edited the form view now and it's picking the exact method that it suppose to pick after i reviewed the path. Moreso, the method that would pull the report should be like this:
#api.multi
def action_formdownloader(self):
return self.env['report'].get_action(self, 'bh_customcustom.report_formdownload_view')

How to replace with xpath rather than put after in odoo 8?

Look at this strange thing.
My code here works well.
<openerp>
<data>
<template id="index" inherit_id='point_of_sale.index' name="Restaurant Index"><!DOCTYPE html>
<xpath expr="//title" position="after">
<title>Odoo POS - AS</title>
</xpath>
<xpath expr="//link[#id='pos-stylesheet']" position="after">
<link rel="stylesheet" href="/pos_lapagept/static/src/css/pos_as.css" />
</xpath>
</template>
</data>
</openerp>
But if I replace by this code :
<xpath expr="//title" position="replace">
<title>Odoo POS - AS</title>
</xpath>
It DOESN'T replace the title. It does nothing... Do you understand this?
Try following,
<xpath expr="//title" position="attributes">
<attribute name="title">Odoo POS - AS</attribute>
</xpath>

Resources