Skip to Content
Menu
This question has been flagged
1 Reply
9206 Views

I'm trying to follow the instructions here however I think perhaps it's a different version. Using v7, I need to create some fields on the res.partner form and use them in the group by menu.

Already I have <?xml version="1.0"?><field name="ref" position="after"> <field name="x_user.id"> </field></field> which works just fine by itself, but adding the group by instructions on the linked question does not work.

So how do I add a group by to the code I have?

EDIT: So I've tried copying some of the existing views but I keep getting an error. Since the field I'm adding to the group by is essentially a copy of the Salesperson (user_id) field, I copied that view (res.partner.select) and saved it as res.partner.select2. Now I inherit the original res.partner.select and added:

<?xml version="1.0"?>
<search string="Search Partner">
                   <group expand="0" string="Group By...">
                       <filter string="Outside Salesperson" icon="terp-personal" domain="[]" context="{'group_by' : 'x_user_id'}"/>
                   </group>
               </search>

This apparently works to add the "Outside Salesperson" to the group by filter. However, when I try to acutally use that, I get an error:

Traceback (most recent call last):
File "/home/odoo/src/web/saas-2/addons/web/http.py", line 325, in dispatch response["result"] = self._call_function(*self.params)
File "/home/odoo/src/web/saas-2/addons/web/http.py", line 174, in _call_function return self.func(
args, *kwargs) File "/home/odoo/src/web/saas-2/addons/web/http.py", line 1060, in nfunc return checked_call(request.db, *args, *kwargs) File "/home/odoo/src/server/saas-2/openerp/service/model.py", line 111, in wrapper return f(dbname, args, *kwargs) File "/home/odoo/src/web/saas-2/addons/web/http.py", line 1052, in checked_call return func(a, *kw) File "/home/odoo/src/web/saas-2/addons/web/controllers/main.py", line 1098, in call_kw return self._call_kw(model, method, args, kwargs) File "/home/odoo/src/web/saas-2/addons/web/controllers/main.py", line 1090, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, args, *kwargs) File "/home/odoo/src/server/saas-2/openerp/osv/orm.py", line 2662, in read_group assert groupby_def and groupby_def._classic_write, "Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True" AssertionError: Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True

Even when I edit the original res.partner.select do I get the same error. As in:

<?xml version="1.0"?>
<search string="Search Partner">
                   <field name="name" filter_domain="['|','|',('display_name','ilike',self),('ref','=',self),('email','ilike',self)]"/>
                   <filter help="My Partners" icon="terp-personal+" domain="[('user_id','=',uid)]"/>
                   <separator/>
                   <filter string="Persons" name="type_person" domain="[('is_company','=',0)]"/>
                   <filter string="Companies" name="type_company" domain="[('is_company','=',1)]"/>
                   <separator/>
                   <filter string="Customers" name="customer" domain="[('customer','=',1)]" help="Customer Partners"/>
                   <filter string="Suppliers" name="supplier" domain="[('supplier','=',1)]" help="Supplier Partners"/>
                   <separator/>
                   <field name="category_id" string="Tag" filter_domain="[('category_id','ilike', self)]"/>
                   <field name="user_id"/>
                   <field name="parent_id" domain="[('is_company','=',1)]" filter_domain="[('parent_id','child_of',[self])]"/>
                   <group expand="0" string="Group By...">
                       <filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by' : 'user_id'}”/>
                       <filter string=“Outside Salesperson" icon="terp-personal" domain="[]" context="{'group_by' : ‘x_user_id'}"/>
                       <filter string="Company" context="{'group_by': 'parent_id'}"/>
                       <filter string="Country" context="{'group_by': 'country_id'}"/>
                   </group>
               </search>
Avatar
Discard
Best Answer

first create a category like

<record model="ir.module.category" id="module_category_name">
            <field name="name">Category Name</field>
            <field name="sequence">6</field>
         </record>

then add a group to that category

<record model="res.groups" id="group_name_id">
        <field name="name">Group Nmae</field>
        <field name="category_id" ref="module_category_name"/>
     </record>
Avatar
Discard
Related Posts Replies Views Activity
3
Dec 22
5741
0
Dec 16
2557
0
Dec 24
58
0
May 24
492
1
May 23
3700