summaryrefslogtreecommitdiff
path: root/addons/web_unsplash/models
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2018-08-13 19:27:47 +0200
committerJeremy Kersten <jke@odoo.com>2018-08-13 20:38:38 +0200
commit732702d5e2a007797e589dc42b29f31a9e27c54f (patch)
treee6c1a7eb880775f788059e0751ce689559de0116 /addons/web_unsplash/models
parent0b608109ee8e6600f259e065c557316c8b3663d9 (diff)
[ADD] web_unsplash: Find free high-resolution images from Unsplash
Move module from enterprise to community Work of @dep-odoo and @rdeodoo
Diffstat (limited to 'addons/web_unsplash/models')
-rw-r--r--addons/web_unsplash/models/__init__.py5
-rw-r--r--addons/web_unsplash/models/res_config_settings.py9
-rw-r--r--addons/web_unsplash/models/res_users.py12
3 files changed, 26 insertions, 0 deletions
diff --git a/addons/web_unsplash/models/__init__.py b/addons/web_unsplash/models/__init__.py
new file mode 100644
index 00000000000..63a963dae32
--- /dev/null
+++ b/addons/web_unsplash/models/__init__.py
@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import res_config_settings
+from . import res_users
diff --git a/addons/web_unsplash/models/res_config_settings.py b/addons/web_unsplash/models/res_config_settings.py
new file mode 100644
index 00000000000..2eca06a5f41
--- /dev/null
+++ b/addons/web_unsplash/models/res_config_settings.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import fields, models
+
+
+class ResConfigSettings(models.TransientModel):
+ _inherit = 'res.config.settings'
+
+ unsplash_access_key = fields.Char("Access Key", config_parameter='unsplash.access_key')
diff --git a/addons/web_unsplash/models/res_users.py b/addons/web_unsplash/models/res_users.py
new file mode 100644
index 00000000000..9400c06b075
--- /dev/null
+++ b/addons/web_unsplash/models/res_users.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import api, models
+
+
+class ResUsers(models.Model):
+ _inherit = 'res.users'
+
+ @api.multi
+ def _has_unsplash_key_rights(self):
+ self.ensure_one()
+ return self.has_group('base.group_erp_manager')