Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to add search by group

By
heru
on 1/27/15, 11:17 PM 1,072 views

Hi, 

I want to make search by group inherit in another form.

i want to inherit in object 'sale.report'.

code in file .py :

class sales_analysis(osv.osv):
    _inherit = "sale.report"
    
    _columns = {
                'pjp_id': fields.many2one('smcus.pjp', 'PJP', required=True),
                'jenis': fields.related('pjp_id', 'jenis', type="char", string="Jenis Transaksi", readonly=True,),
                }
    
sales_analysis()

code file in .xml :

<record id="wtc_sales_analysis_tree" model="ir.ui.view">
             <field name="name">sale.report</field>
             <field name="model">sale.report</field>
             <field name="inherit_id" ref="sale.view_order_product_search"/>    
             <field name="arch" type="xml"/>                  
                     <filter string="Salesperson" position="after">
                         <filter string="Jenis Transaksi" icon="terp-personal" context="{'group_by':'jenis'}"/>
                     </filter>                             
         </record>

but the result is error :

2015-01-28 03:44:04,617 9107 ERROR century21-new openerp.tools.convert: The XML file does not fit the required schema !
2015-01-28 03:44:04,617 9107 ERROR century21-new openerp.tools.convert: /home/heru/odoo/addons/CENTURY21/wtc_sales_analysis/wtc_sales_analysis_view.xml:10:0:ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element record has extra content: filter

How i fix my problem ?

It says "wtc_sales_analysis_view"... are you sure the view shown here is the same one?

Emipro Technologies Pvt. Ltd.
on 1/28/15, 12:02 AM

oh i'm sorry , this is false . hehe. but, i want try make a different code, like : sale.report.search sale.report <xpath expr="//group/filter[@string='Group By...']" position="after"> but it's not work . can you give me, your solution ? thanks.

heru
on 1/28/15, 4:46 AM
oh i'm sorry , this is false.
but, i try make different code in file .xml , like :

<record id="wtc_sales_analysis_view" model="ir.ui.view">
             <field name="name">sale.report.search</field>
             <field name="model">sale.report</field>
             <field name="inherit_id" ref="sale.view_order_product_search"/>
             <field name="arch" type="xml"/>              
       <xpath expr="//group/filter[@string='Group By...']" position="after">
                    <filter string="Jenis Transaksi" icon="terp-personal" context="{'group_by':'jenis'}"/>
                </xpath>              
 </record>

but, it's not work. can you give me , your solution ?

On Wed, Jan 28, 2015 at 12:02 PM, Emipro Technologies Pvt. Ltd. <erp@emiprotechnologies.com> wrote:

It says "wtc_sales_analysis_view"... are you sure the view shown here is the same one?

Emipro Technologies is best in Odoo & eCommerce Application development based outsourcing software firm. We deliver any kind of complex solutions in the domain of Odoo and eCommerce to customers accross the globe. Being in IT business since 2011, We have a strong team of skilled experienced IT experts.Our customers are companies of all sizes ranging from startups to large enterprises who realize that they need a professional internet solution to generate revenue streams, establish communication channels or streamline business operations.

Our Services in Odoo includes,
  • Installation
  • Customization
  • Configuration
  • Software Training
  • After Sale Support
  • Maintenance
  • Consulting
Contact info@emiprotechnologies.com for any kind of queries in Odoo. Visit www.emiprotechnologies.com for more details.




 

Sent by Odoo S.A. using Odoo about Forum Post How to add search by group

heru
on 1/28/15, 4:55 AM
thanks Jogi.
 but it's not work .
and i try different code in file .xml , like :

<record id="wtc_sales_analysis_view" model="ir.ui.view">
             <field name="name">sale.report.search</field>
             <field name="model">sale.report</field>
             <field name="inherit_id" ref="sale.view_order_product_search"/>
             <field name="arch" type="xml"/>              
        <xpath expr="//group/filter[@string='Group By...']" position="after">
                    <filter string="Jenis Transaksi" icon="terp-personal" context="{'group_by':'jenis'}"/>
                </xpath>              
         </record>

but it's not work.
can you give , your solution ?

On Wed, Jan 28, 2015 at 1:06 PM, Nishant Jogi <nishjogi@gmail.com> wrote:

A new answer for How to add search by group has been posted. Click here to access the post.

--
Nishant Jogi

heru
on 1/28/15, 4:58 AM
2
Nishant Jogi
On 1/28/15, 1:06 AM

Hi,

Here is the problem in XML you have closed the <field> element in line.

Problem:

<record id="wtc_sales_analysis_tree" model="ir.ui.view">
             <field name="name">sale.report</field>
             <field name="model">sale.report</field>
             <field name="inherit_id" ref="sale.view_order_product_search"/>    
             <field name="arch" type="xml"/>                  
                     <filter string="Salesperson" position="after">
                         <filter string="Jenis Transaksi" icon="terp-personal" context="{'group_by':'jenis'}"/>
                     </filter>                             
         </record>

Solution :

<record id="wtc_sales_analysis_tree" model="ir.ui.view">
             <field name="name">sale.report</field>
             <field name="model">sale.report</field>
             <field name="inherit_id" ref="sale.view_order_product_search"/>    
             <field name="arch" type="xml">                  
                     <filter string="Salesperson" position="after">
                         <filter string="Jenis Transaksi" icon="terp-personal" context="{'group_by':'jenis'}"/>
                     </filter>

              </field>                     
         </record>

Hope this will helps you.

Thanks.

Also make sure that the field that you are grouping by is in the tree view.

Ivan
on 1/28/15, 1:13 AM

thanks Jogi, but it's not work. i try different code in file .xml , like : sale.report.search sale.report <xpath expr="//group/filter[@string='Group By...']" position="after"> but the result is same, not work. Jogi, and Ivan, can you give me, for your solution ?

heru
on 1/28/15, 4:51 AM

@Heru, can you elaborate what do you mean by doesn't work? Does it still produce the same error message? Or it produces different error message now?

Ivan
on 1/28/15, 5:25 AM

@Heru use below code for your solution. sale.report.search sale.report <xpath expr="//group[@string='Group By...']/filter[@string='Salesperson']" position="after">

Nishant Jogi
on 1/28/15, 6:04 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/27/15, 11:17 PM
Seen: 1072 times
Last updated: 3/16/15, 8:10 AM