multiple search index spring data solr showcase - spring

how do i can search multiple index content in spring data solr showcase?
just now i only can search "name".
for example how do i can search "companyNo"?.
thanks in advance
sample xml of indexed in solr:
<?xml version="1.0" encoding="UTF-8"?>
<add>
<doc>
<field name="id">1051879H_15082014_00003457</field>
<field name="name">BEST MEGALINK SDN. BHD.</field>
<field name="entityName"></field>
<field name="companyNo">1051879-H</field>
<field name="noticeType">RMAT_N_C</field>
<field name="noticeDate">15/08/2014</field>
<field name="repNames"></field>
<field name="repNames"></field>
<field name="repNames"></field>
<field name="repICs"></field>
<field name="repICs"></field>
<field name="repICs"></field>
<field name="format">PDF</field>
<field name="folder">15082014</field>
<field name="pages">2</field>
</doc>
</add>

Other fields which need to be searched, needs to be added as part of schema.xml.
For example, the fields like the following needs to be added as part schema.xml:
<field name="entityName" type="text_string" indexed="true" stored="true"/>
<field name="companyNo" type="text_string" indexed="true" stored="true"/>
<field name="noticeType" type="text_string" indexed="true" stored="true"/>

Related

Create a new tree view in Odoo13

I´m trying to create a new tree view for the invoices in Odoo 13
my code looks like this:
<odoo>
<record model="ir.ui.view" id="new_invoice_tree">
<field name="name">New Tree</field>
<field name="model">account.move</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="custom_field_1"/>
<field name="custom_field_2"/>
</tree>
</field>
</record>
<record id="my_module.new_tree_action_window" model="ir.actions.act_window">
<field name="name">New tree</field>
<field name="res_model">account.move</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="new_invoice_tree"/>
<field name="type">ir.actions.act_window</field>
<field name="domain">[('type','=','out_invoice')]</field>
</record>
<menuitem name="Libro de ventas"
id="my_module.new_tree_menu"
parent="my_parent_menu"
action="my_module.new_tree_action_window"
sequence="1"/>
</odoo>
But when I try to open the menu appears this error:
Rastreo de error:
Error: Unknown field state in domain
at Class.compute (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:322:55)
at evalModifier (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:1197:91)
at Class._evalModifiers (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:1200:44)
at Class._registerModifiers (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:1401:101)
at Class._renderBodyCell (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2076:70)
at http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2100:117
at Array.map (<anonymous>)
at Class._renderRow [as _super] (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2100:80)
at Class._renderRow (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2010:69)
at Class._renderRow (http://192.168.1.7:8070/web/content/312-75a923f/web.assets_common.js:3863:371)
I´m not sure how my domain should look like, what´s what I´m doing wrong?
The way to avoid this kind of error is by adding the "state" field with the attribute invisible as True, like this:
<odoo>
<record model="ir.ui.view" id="new_invoice_tree">
<field name="name">New Tree</field>
<field name="model">account.move</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="state" invisible="True"/>
<field name="custom_field_1"/>
<field name="custom_field_2"/>
</tree>
</field>
</record>
This error appears on databases that are working with the Enterprise version of Odoo.

Problem with adding a custom field to existing view

[![enter image description here][1]][1]I have a problem with adding a new field to the sale order view of odoo12. I have created a new module. I hope that you can help me.
Below the code of my view form
<odoo>
<record id="view_order_form_inherit" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml"></field>
<field name="payment_term_id" position="after">
<field name="additional_note"/>
</field>
</record>
</odoo>```
when i try to install the new module i have the following error:
File "src\lxml\etree.pyx", line 3557, in lxml.etree._Validator.assert_
AssertionError: Element odoo has extra content: record, line 3
[1]: https://i.stack.imgur.com/e1DOw.png
The problem is in the <field name="arch" type="xml"></field> line: the <field> tag is closed, and your additional_note field is declared outside of it.
Try this code instead:
<odoo>
<record id="view_order_form_inherit" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<!-- Leave the 'arch' field open -->
<field name="arch" type="xml">
<!-- Put your custom field and its position inside the 'arch' field.
Use 'xpath' tag to create a more precise positioning -->
<xpath expr="//group/group/field[#name='payment_term_id']" position="after">
<field name="additional_note"/>
</xpath>
<!-- Now, close the 'arch' field -->
</field>
</record>
</odoo>
The view is not correctly defined, you can refer to account_analytic_view.
The view definition should be (according to the provided link):
<odoo>
<record id="view_order_form_inherit" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<field name="payment_term_id" position="after">
<field name="additional_note"/>
</field>
</data>
</field>
</record>
</odoo>

AssertionError: Element odoo has extra content: record, line 4

I'm trying to add multi field to timesheet module to work as a tasks manage app i did inheritance to account.analytic.line the problem is in the view i got that error "AssertionError: Element odoo has extra content: record, line 4"
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="todo_timesheet_line_tree" model="ir.ui.view">
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
<field name="model">account.analytic.line</field>
<field name="arch" type="xml"/>
<field name="task_id" position="after">
<field name="priority"/>
</field>
<field name="company_id" groups="base.group_multi_company" position="before">
<field name="gov_department"/>
<field name="priority"/>
<field name="date_deadline"/>
</field>
</record>
</odoo>
from odoo import models, fields, api
class TodoTask(models.Model):
_inherit = 'account.analytic.line'
startdate=fields.Date('start Date', required=True, index=True, default=fields.Date.context_today)
date_deadline=fields.Date('Deadline', required=True, index=True, default=fields.Date.context_today)
priority = fields.Selection(selection=[('1', 'فوري'), ('2','هام جدا' ),('3','اقل اهمية')])
is_done = fields.Boolean ('Done?')
gov_department = fields.Many2one('govauthority','الجهة الحكومية')
class govauthority(models.Model):
govname = fields.Char('GOV_Department', size=25, required=True)
The error is in this line
<field name="arch" type="xml" />
You closed the tag while you really should not. Within this tag the actual XML body should be.
<record id="todo_timesheet_line_tree" model="ir.ui.view">
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree" />
<field name="model">account.analytic.line</field>
<field name="arch" type="xml">
<field name="task_id" position="after">
<field name="priority" />
</field>
<field name="company_id" groups="base.group_multi_company" position="before">
<field name="gov_department" />
<field name="priority" />
<field name="date_deadline" />
</field>
</field>
</record>

What is a rule and how to inherit it and edit it in odoo 10?

So I created this user named Eric and I want him to manage all the features in gamification module. When I go to gamification security I found these rules:
<record id="goal_user_visibility" model="ir.rule">
<field name="name">User can only see his/her goals or goal from the same challenge in board visibility</field>
<field name="model_id" ref="model_gamification_goal"/>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="domain_force">[
'|',
('user_id','=',user.id),
'&',
('challenge_id.user_ids','in',user.id),
('challenge_id.visibility_mode','=','ranking')]</field>
</record>
<record id="goal_gamification_manager_visibility" model="ir.rule">
<field name="name">Manager can see any goal</field>
<field name="model_id" ref="model_gamification_goal"/>
<field name="groups" eval="[(4, ref('base.group_erp_manager'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
But I can't find them in the user interface so I can put Eric in one of them. Isn't a rule the same as a group? If not how can I deal with this? Thanks.

How to manage security of model, such as only sales manager should be able to create, delete, write and read those records in odoo 10

I am new in odoo and want know how to manage security in module,
O have created one model and now gives group that can only see my
record view, see below code that I have tried,
<record id="view_account_supplier_payment_tree" model="ir.ui.view">
<field name="name">account.supplier.payment.tree</field>
<field name="model">account.payment</field>
<field name="arch" type="xml">
<tree decoration-info="state=='draft'" decoration-muted="state=='reconciled'" edit="false">
<field name="payment_date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="payment_method_id"/>
<field name="partner_id" string="Vendor"/>
<field name="amount" sum="Amount"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="state"/>
<field name="currency_id" invisible="1"/>
<field name="partner_type" invisible="1"/>
</tree>
</field>
</record>
Make an ir.model.access.csv file to manage security,
this file also mention in manifest file.

Resources