This question has been flagged
1 Reply
13129 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 ?

Avatar
Discard

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

Author

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.

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

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

Best Answer

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.

Avatar
Discard

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

Author

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, 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?

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