summaryrefslogtreecommitdiff
path: root/addons/base_setup/models
diff options
context:
space:
mode:
authorParamjit Singh Sahota <psa@odoo.com>2016-04-19 13:43:10 +0200
committerJérome Maes <jem@openerp.com>2016-04-27 16:21:42 +0200
commit5c28b3d4a2306d7b3723a1abd2da9c4395480d73 (patch)
tree2770c951b634ed7db05066a5c96a1e56868f9b39 /addons/base_setup/models
parentfce8735b1a360221630c1e93d07de9c112cb462f (diff)
[MIG] base_setup : migrate to new api
Diffstat (limited to 'addons/base_setup/models')
-rw-r--r--addons/base_setup/models/__init__.py1
-rw-r--r--addons/base_setup/models/res_config.py77
2 files changed, 38 insertions, 40 deletions
diff --git a/addons/base_setup/models/__init__.py b/addons/base_setup/models/__init__.py
index 4c73a40e640..cc830c0b1e9 100644
--- a/addons/base_setup/models/__init__.py
+++ b/addons/base_setup/models/__init__.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
import res_config
diff --git a/addons/base_setup/models/res_config.py b/addons/base_setup/models/res_config.py
index 7ec3da83060..9602593c105 100644
--- a/addons/base_setup/models/res_config.py
+++ b/addons/base_setup/models/res_config.py
@@ -1,67 +1,64 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import api, fields, models
-from openerp.osv import fields, osv
+class BaseConfigSettings(models.TransientModel):
-class base_config_settings(osv.osv_memory):
_name = 'base.config.settings'
_inherit = 'res.config.settings'
- _columns = {
- 'group_multi_company': fields.boolean('Manage multiple companies',
- help='Work in multi-company environments, with appropriate security access between companies.',
- implied_group='base.group_multi_company'),
- 'module_share': fields.boolean('Allow documents sharing',
- help="""Share or embbed any screen of Odoo."""),
- 'module_portal': fields.boolean('Activate the customer portal',
- help="""Give your customers access to their documents."""),
- 'module_auth_oauth': fields.boolean('Use external authentication providers (OAuth)'),
- 'module_base_import': fields.boolean("Allow users to import data from CSV/XLS/XLSX/ODS files"),
- 'module_google_drive': fields.boolean('Attach Google documents to any record',
- help="""This installs the module google_docs."""),
- 'module_google_calendar': fields.boolean('Allow the users to synchronize their calendar with Google Calendar',
- help="""This installs the module google_calendar."""),
- 'module_inter_company_rules': fields.boolean('Manage Inter Company',
- help="""This installs the module inter_company_rules.\n Configure company rules to automatically create SO/PO when one of your company sells/buys to another of your company."""),
- 'company_share_partner': fields.boolean('Share partners to all companies',
- help="Share your partners to all companies defined in your instance.\n"
- " * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n"
- " * Unchecked : Each company can see only its partner (partners where company is defined). Partners not related to a company are visible for all companies."),
- 'group_multi_currency': fields.boolean('Allow multi currencies',
+ group_multi_company = fields.Boolean(string='Manage multiple companies',
+ help='Work in multi-company environments, with appropriate security access between companies.',
+ implied_group='base.group_multi_company')
+ module_share = fields.Boolean(string='Allow documents sharing',
+ help="""Share or embbed any screen of Odoo.""")
+ module_portal = fields.Boolean(string='Activate the customer portal',
+ help="""Give your customers access to their documents.""")
+ module_auth_oauth = fields.Boolean(string='Use external authentication providers (OAuth)')
+ module_base_import = fields.Boolean(string="Allow users to import data from CSV/XLS/XLSX/ODS files")
+ module_google_drive = fields.Boolean(string='Attach Google documents to any record',
+ help="""This installs the module google_docs.""")
+ module_google_calendar = fields.Boolean(
+ string='Allow the users to synchronize their calendar with Google Calendar',
+ help="""This installs the module google_calendar.""")
+ module_inter_company_rules = fields.Boolean(string='Manage Inter Company',
+ help="""This installs the module inter_company_rules.\n Configure company rules to automatically create SO/PO when one of your company sells/buys to another of your company.""")
+ company_share_partner = fields.Boolean(string='Share partners to all companies',
+ help="Share your partners to all companies defined in your instance.\n"
+ " * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n"
+ " * Unchecked : Each company can see only its partner (partners where company is defined). Partners not related to a company are visible for all companies.")
+ group_multi_currency = fields.Boolean(string='Allow multi currencies',
implied_group='base.group_multi_currency',
- help="Allows to work in a multi currency environment"),
+ help="Allows to work in a multi currency environment")
- }
-
- def open_company(self, cr, uid, ids, context=None):
- user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ @api.multi
+ def open_company(self):
return {
'type': 'ir.actions.act_window',
'name': 'My Company',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'res.company',
- 'res_id': user.company_id.id,
+ 'res_id': self.env.user.company_id.id,
'target': 'current',
}
- def get_default_company_share_partner(self, cr, uid, fields, context=None):
- partner_rule = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'base.res_partner_rule', context=context)
+ @api.model
+ def get_default_company_share_partner(self, fields):
return {
- 'company_share_partner': not bool(partner_rule.active)
+ 'company_share_partner': not self.env.ref('base.res_partner_rule').active
}
- def set_default_company_share_partner(self, cr, uid, ids, context=None):
- partner_rule = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'base.res_partner_rule', context=context)
- for wizard in self.browse(cr, uid, ids, context=context):
- self.pool['ir.rule'].write(cr, uid, [partner_rule.id], {'active': not bool(wizard.company_share_partner)}, context=context)
+ @api.multi
+ def set_default_company_share_partner(self):
+ partner_rule = self.env.ref('base.res_partner_rule')
+ for config in self:
+ partner_rule.write({'active': not config.company_share_partner})
# Empty class but required since it's overrided by sale & crm
-class sale_config_settings(osv.osv_memory):
+class SaleConfigSettings(models.TransientModel):
+
_name = 'sale.config.settings'
_inherit = 'res.config.settings'
- _columns = {
- }
-