Browse Source

[FIX] partner_multi_relation: Several fixes:

* API of _auto_init
* Menu and groups
  stuff has moved from base to sales_team in odoo 10
pull/654/head
Alexandre Fayolle 8 years ago
committed by Pedro M. Baeza
parent
commit
3b087b8b87
  1. 1
      partner_multi_relation/__manifest__.py
  2. 14
      partner_multi_relation/models/res_partner_relation_all.py
  3. 7
      partner_multi_relation/models/res_partner_relation_type_selection.py
  4. 2
      partner_multi_relation/security/ir.model.access.csv
  5. 4
      partner_multi_relation/views/menu.xml

1
partner_multi_relation/__manifest__.py

@ -10,6 +10,7 @@
"license": "AGPL-3", "license": "AGPL-3",
"depends": [ "depends": [
'base', 'base',
'sales_team',
], ],
"demo": [ "demo": [
"data/demo.xml", "data/demo.xml",

14
partner_multi_relation/models/res_partner_relation_all.py

@ -32,10 +32,10 @@ class ResPartnerRelationAll(models.AbstractModel):
You must use the same name as in res_partner_relation. You must use the same name as in res_partner_relation.
Don't overwrite this list in your declaration but append in _auto_init: Don't overwrite this list in your declaration but append in _auto_init:
def _auto_init(self, cr, context=None):
@api.model_cr_context
def _auto_init(self):
self._additional_view_fields.append('my_field') self._additional_view_fields.append('my_field')
return super(ResPartnerRelationAll, self)._auto_init(
cr, context=context)
return super(ResPartnerRelationAll, self)._auto_init()
my_field = fields... my_field = fields...
""" """
@ -78,7 +78,9 @@ class ResPartnerRelationAll(models.AbstractModel):
search='_search_any_partner_id' search='_search_any_partner_id'
) )
def _auto_init(self, cr, context=None):
@api.model_cr_context
def _auto_init(self):
cr = self._cr
drop_view_if_exists(cr, self._table) drop_view_if_exists(cr, self._table)
additional_view_fields = ','.join(self._additional_view_fields) additional_view_fields = ','.join(self._additional_view_fields)
additional_view_fields = (',' + additional_view_fields)\ additional_view_fields = (',' + additional_view_fields)\
@ -121,9 +123,7 @@ CREATE OR REPLACE VIEW %(table)s AS
'additional_view_fields': AsIs(additional_view_fields), 'additional_view_fields': AsIs(additional_view_fields),
} }
) )
return super(ResPartnerRelationAll, self)._auto_init(
cr, context=context
)
return super(ResPartnerRelationAll, self)._auto_init()
@api.model @api.model
def _search_any_partner_id(self, operator, value): def _search_any_partner_id(self, operator, value):

7
partner_multi_relation/models/res_partner_relation_type_selection.py

@ -65,7 +65,9 @@ class ResPartnerRelationTypeSelection(models.Model):
string='Symmetric', string='Symmetric',
) )
def _auto_init(self, cr, context=None):
@api.model_cr_context
def _auto_init(self):
cr = self._cr
drop_view_if_exists(cr, self._table) drop_view_if_exists(cr, self._table)
cr.execute( cr.execute(
"""CREATE OR REPLACE VIEW %(table)s AS """CREATE OR REPLACE VIEW %(table)s AS
@ -100,8 +102,7 @@ class ResPartnerRelationTypeSelection(models.Model):
'padding': PADDING, 'padding': PADDING,
'underlying_table': AsIs('res_partner_relation_type'), 'underlying_table': AsIs('res_partner_relation_type'),
}) })
return super(ResPartnerRelationTypeSelection, self)._auto_init(
cr, context=context)
return super(ResPartnerRelationTypeSelection, self)._auto_init()
@api.multi @api.multi
def name_get(self): def name_get(self):

2
partner_multi_relation/security/ir.model.access.csv

@ -5,4 +5,4 @@ read_res_partner_relation_type,access_res_partner_relation_type,model_res_partne
read_res_partner_relation_type_selection,access_res_partner_relation_type,model_res_partner_relation_type_selection,,1,0,0,0 read_res_partner_relation_type_selection,access_res_partner_relation_type,model_res_partner_relation_type_selection,,1,0,0,0
crud_res_partner_relation,access_res_partner_relation,model_res_partner_relation,base.group_partner_manager,1,1,1,1 crud_res_partner_relation,access_res_partner_relation,model_res_partner_relation,base.group_partner_manager,1,1,1,1
crud_res_partner_relation_all,access_res_partner_relation,model_res_partner_relation_all,base.group_partner_manager,1,1,1,1 crud_res_partner_relation_all,access_res_partner_relation,model_res_partner_relation_all,base.group_partner_manager,1,1,1,1
crud_res_partner_relation_type,access_res_partner_relation_type,model_res_partner_relation_type,base.group_sale_manager,1,1,1,1
crud_res_partner_relation_type,access_res_partner_relation_type,model_res_partner_relation_type,sales_team.group_sale_manager,1,1,1,1

4
partner_multi_relation/views/menu.xml

@ -4,7 +4,7 @@
<menuitem <menuitem
id="menu_res_partner_relation_sales" id="menu_res_partner_relation_sales"
sequence="2" sequence="2"
parent="base.menu_sales"
parent="sales_team.menu_sales"
action="action_res_partner_relation_all" action="action_res_partner_relation_all"
/> />
@ -17,7 +17,7 @@
<menuitem <menuitem
id="menu_res_partner_relation_type" id="menu_res_partner_relation_type"
parent="base.menu_config_address_book"
parent="sales_team.menu_config_address_book"
action="action_res_partner_relation_type" action="action_res_partner_relation_type"
/> />

Loading…
Cancel
Save