diff --git a/red_october/fields/red_october_char.py b/red_october/fields/red_october_char.py
index 35558bf6926..83321335224 100644
--- a/red_october/fields/red_october_char.py
+++ b/red_october/fields/red_october_char.py
@@ -34,7 +34,7 @@ def read(self, records):
data = {att.res_id: att.datas for att in attachments}
_logger.debug(data)
for record in records:
- record._cache[self.name] = data.get(record.id, False)
+ record._cache[self.name] = data.get(record.id, self.null())
def write(self, records, value):
# retrieve the attachments that stores the value, and adapt them
diff --git a/red_october/static/src/js/dialog_vault_new.js b/red_october/static/src/js/dialog_vault_new.js
new file mode 100644
index 00000000000..017e11052a8
--- /dev/null
+++ b/red_october/static/src/js/dialog_vault_new.js
@@ -0,0 +1,87 @@
+/* Copyright 2016-2017 LasLabs Inc.
+ * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
+ */
+
+odoo.define('red_october.DialogVaultNew', function (require) {
+ "use strict";
+
+ var core = require('web.core');
+ var Dialog = require('web.Dialog');
+ var mixins = require('red_october.mixins');
+ var Model = require('web.DataModel');
+
+ var _t = core._t;
+
+ /* It allows a user to get their profile password.
+
+ Attributes:
+ */
+ var DialogVaultNew = Dialog.extend(
+ mixins.dialogMixin,
+ mixins.formMixin,
+ {
+
+ templateInner: 'red_october.FormVaultNew',
+
+ options: {
+ title: _t('Enter Vault Info'),
+ buttons: [
+ {
+ text: _t('Submit'),
+ classes: 'btn btn-primary',
+ close: true,
+ click: function(event){
+ this.$form.submit();
+ },
+ },
+ {
+ text: _t('Cancel'),
+ classes: 'btn btn-default',
+ close: true,
+ click: function () {
+ this.resetUI();
+ }
+ },
+ ],
+ },
+
+ handleSubmit: function (event) {
+
+ event.preventDefault();
+
+ var $target = $(event.target);
+ var $parent = this.getParent();
+ var arrData = $target.serializeArray();
+ var objData = {};
+ var Vaults = new Model('red.october.vault');
+
+ _.each(arrData, function(data) {
+ objData[data.name] = data.value;
+ })
+
+ var vault = Vaults.call(
+ 'create',
+ [{
+ 'host': objData.host,
+ 'port': objData.port,
+ 'verify_cert': objData.verify_cert || false,
+ }]
+ );
+ vault.done(
+ this.proxy(function (record) {
+ $parent.$el.trigger(
+ 'activateVault',
+ record,
+ objData.is_active
+ );
+ })
+ );
+ return vault;
+ },
+
+ }
+ );
+
+ return DialogVaultNew;
+
+});
diff --git a/red_october/static/src/js/widget_profile_manage.js b/red_october/static/src/js/widget_profile_manage.js
index 285f5b61221..dda9cc04b0f 100644
--- a/red_october/static/src/js/widget_profile_manage.js
+++ b/red_october/static/src/js/widget_profile_manage.js
@@ -14,6 +14,7 @@ odoo.define('red_october.WidgetProfileManage', function (require) {
var DialogPasswordChange = require('red_october.DialogPasswordChange');
var DialogPasswordGet = require('red_october.DialogPasswordGet');
var DialogVaultDelegate = require('red_october.DialogVaultDelegate');
+ var DialogVaultNew = require('red_october.DialogVaultNew');
var ERROR_PASSWORD = 'Wrong Password';
@@ -35,6 +36,7 @@ odoo.define('red_october.WidgetProfileManage', function (require) {
'decrypt': 'doDecrypt',
'encrypt': 'doEncrypt',
'decrementDelegation': 'decrementDelegation',
+ 'activateVault': 'activateVault',
},
/* It sets the widget properties */
@@ -64,6 +66,9 @@ odoo.define('red_october.WidgetProfileManage', function (require) {
this.$el.find('#roProfilePasswordGet').click(
this.proxy(this.clickProfilePasswordGet)
);
+ this.$el.find('#roVaultNew').click(
+ this.proxy(this.clickVaultNew)
+ );
},
/* Load user profiles from the server, add them to the instance, then re-render. */
@@ -138,6 +143,10 @@ odoo.define('red_october.WidgetProfileManage', function (require) {
new DialogPasswordGet(this).open();
},
+ clickVaultNew: function (event) {
+ new DialogVaultNew(this).open();
+ },
+
clickVaultDelegate: function (event) {
var dialog = new DialogVaultDelegate(
this,
@@ -197,6 +206,28 @@ odoo.define('red_october.WidgetProfileManage', function (require) {
return delegations;
},
+ activateVault: function (event, record, is_active) {
+ var Wizards = new Model('red.october.vault.activate');
+ Wizards.call(
+ 'create',
+ [{
+ 'is_active': is_active || false,
+ 'vault_ids': [[(6, 0, [record])]],
+ 'admin_user_id':
+ }]
+ )
+ },
+
+ upsertProfile: function (user, vaults) {
+ var Users = new Model('red.october.user');
+ Users.call(
+ 'create',
+ [{
+
+ }]
+ )
+ },
+
loadDelegations: function(records) {
_.each(
records,
diff --git a/red_october/static/src/xml/form_vault_new.xml b/red_october/static/src/xml/form_vault_new.xml
new file mode 100644
index 00000000000..0663cec2e40
--- /dev/null
+++ b/red_october/static/src/xml/form_vault_new.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+