Skip to content

Commit

Permalink
[FIX] new api
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaudoux committed Mar 23, 2017
1 parent 868c60b commit 276bafb
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions account_companyweb/models/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import fields, models
from openerp import SUPERUSER_ID


_parameters = {
"companyweb.login": "",
"companyweb.pswd": "",
}


class AccountCompanywebConfigSettings(models.TransientModel):
Expand All @@ -19,33 +12,3 @@ class AccountCompanywebConfigSettings(models.TransientModel):

companyweb_login = fields.Char('Login', 16)
companyweb_pswd = fields.Char('Password', 16)

def init(self, cr, force=False):
config_parameter_model = self.pool['ir.config_parameter']
for key, value in _parameters.iteritems():
ids = not force and config_parameter_model.search(
cr, SUPERUSER_ID, [('key', '=', key)])
if not ids:
config_parameter_model.set_param(cr, SUPERUSER_ID, key, value)

def get_default_companyweb_login(self, cr, uid, fields_name, context=None):
login = self.pool['ir.config_parameter'].get_param(
cr, SUPERUSER_ID, 'companyweb.login', False)
return {'companyweb_login': login}

def get_default_companyweb_pswd(self, cr, uid, fields_name, context=None):
pswd = self.pool['ir.config_parameter'].get_param(
cr, SUPERUSER_ID, 'companyweb.pswd', False)
return {'companyweb_pswd': pswd}

def set_default_companyweb_login(self, cr, uid, ids, context=None):
config = self.browse(cr, uid, ids[0], context)
self.pool['ir.config_parameter'].set_param(
cr, SUPERUSER_ID, 'companyweb.login', config.companyweb_login)
return True

def set_default_companyweb_pswd(self, cr, uid, ids, context=None):
config = self.browse(cr, uid, ids[0], context)
self.pool['ir.config_parameter'].set_param(
cr, SUPERUSER_ID, 'companyweb.pswd', config.companyweb_pswd)
return True

0 comments on commit 276bafb

Please sign in to comment.