[MERGE] Merge with saas-3
bzr revid: jke@openerp.com-20140217170650-8jxje7eu96vnfkiq
This commit is contained in:
@@ -22,6 +22,7 @@ openerp.account.quickadd = function (instance) {
|
||||
start:function(){
|
||||
var tmp = this._super.apply(this, arguments);
|
||||
var self = this;
|
||||
var defs = [];
|
||||
this.$el.parent().prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this}));
|
||||
|
||||
this.$el.parent().find('.oe_account_select_journal').change(function() {
|
||||
@@ -41,11 +42,17 @@ openerp.account.quickadd = function (instance) {
|
||||
self.$el.parent().find('.oe_account_select_period').removeAttr('disabled');
|
||||
});
|
||||
var mod = new instance.web.Model("account.move.line", self.dataset.context, self.dataset.domain);
|
||||
mod.call("default_get", [['journal_id','period_id'],self.dataset.context]).then(function(result) {
|
||||
defs.push(mod.call("default_get", [['journal_id','period_id'],self.dataset.context]).then(function(result) {
|
||||
self.current_period = result['period_id'];
|
||||
self.current_journal = result['journal_id'];
|
||||
});
|
||||
return tmp;
|
||||
}));
|
||||
defs.push(mod.call("list_journals", []).then(function(result) {
|
||||
self.journals = result;
|
||||
}));
|
||||
defs.push(mod.call("list_periods", []).then(function(result) {
|
||||
self.periods = result;
|
||||
}));
|
||||
return $.when(tmp, defs);
|
||||
},
|
||||
do_search: function(domain, context, group_by) {
|
||||
var self = this;
|
||||
@@ -53,34 +60,27 @@ openerp.account.quickadd = function (instance) {
|
||||
this.last_context = context;
|
||||
this.last_group_by = group_by;
|
||||
this.old_search = _.bind(this._super, this);
|
||||
var mod = new instance.web.Model("account.move.line", context, domain);
|
||||
return $.when(mod.call("list_journals", []).then(function(result) {
|
||||
self.journals = result;
|
||||
}),mod.call("list_periods", []).then(function(result) {
|
||||
self.periods = result;
|
||||
})).then(function () {
|
||||
var o;
|
||||
self.$el.parent().find('.oe_account_select_journal').children().remove().end();
|
||||
self.$el.parent().find('.oe_account_select_journal').append(new Option('', ''));
|
||||
for (var i = 0;i < self.journals.length;i++){
|
||||
o = new Option(self.journals[i][1], self.journals[i][0]);
|
||||
if (self.journals[i][0] === self.current_journal){
|
||||
self.current_journal_type = self.journals[i][2];
|
||||
self.current_journal_currency = self.journals[i][3];
|
||||
self.current_journal_analytic = self.journals[i][4];
|
||||
$(o).attr('selected',true);
|
||||
}
|
||||
self.$el.parent().find('.oe_account_select_journal').append(o);
|
||||
var o;
|
||||
self.$el.parent().find('.oe_account_select_journal').children().remove().end();
|
||||
self.$el.parent().find('.oe_account_select_journal').append(new Option('', ''));
|
||||
for (var i = 0;i < self.journals.length;i++){
|
||||
o = new Option(self.journals[i][1], self.journals[i][0]);
|
||||
if (self.journals[i][0] === self.current_journal){
|
||||
self.current_journal_type = self.journals[i][2];
|
||||
self.current_journal_currency = self.journals[i][3];
|
||||
self.current_journal_analytic = self.journals[i][4];
|
||||
$(o).attr('selected',true);
|
||||
}
|
||||
self.$el.parent().find('.oe_account_select_period').children().remove().end();
|
||||
self.$el.parent().find('.oe_account_select_period').append(new Option('', ''));
|
||||
for (var i = 0;i < self.periods.length;i++){
|
||||
o = new Option(self.periods[i][1], self.periods[i][0]);
|
||||
self.$el.parent().find('.oe_account_select_period').append(o);
|
||||
}
|
||||
self.$el.parent().find('.oe_account_select_period').val(self.current_period).attr('selected',true);
|
||||
return self.search_by_journal_period();
|
||||
});
|
||||
self.$el.parent().find('.oe_account_select_journal').append(o);
|
||||
}
|
||||
self.$el.parent().find('.oe_account_select_period').children().remove().end();
|
||||
self.$el.parent().find('.oe_account_select_period').append(new Option('', ''));
|
||||
for (var i = 0;i < self.periods.length;i++){
|
||||
o = new Option(self.periods[i][1], self.periods[i][0]);
|
||||
self.$el.parent().find('.oe_account_select_period').append(o);
|
||||
}
|
||||
self.$el.parent().find('.oe_account_select_period').val(self.current_period).attr('selected',true);
|
||||
return self.search_by_journal_period();
|
||||
},
|
||||
search_by_journal_period: function() {
|
||||
var self = this;
|
||||
@@ -93,7 +93,9 @@ openerp.account.quickadd = function (instance) {
|
||||
self.last_context["journal_type"] = self.current_journal_type;
|
||||
self.last_context["currency"] = self.current_journal_currency;
|
||||
self.last_context["analytic_journal_id"] = self.current_journal_analytic;
|
||||
return self.old_search(new instance.web.CompoundDomain(self.last_domain, domain), self.last_context, self.last_group_by);
|
||||
var compound_domain = new instance.web.CompoundDomain(self.last_domain, domain);
|
||||
self.dataset.domain = compound_domain.eval();
|
||||
return self.old_search(compound_domain, self.last_context, self.last_group_by);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -96,8 +96,9 @@ class AuthSignup(openerp.addons.web.controllers.main.Home):
|
||||
|
||||
def _signup_with_values(self, token, values):
|
||||
db, login, password = request.registry['res.users'].signup(request.cr, openerp.SUPERUSER_ID, values, token)
|
||||
request.cr.commit() # as authenticate will use its own cursor we need to commit the current transaction
|
||||
uid = request.session.authenticate(db, login, password)
|
||||
if uid is not False:
|
||||
if not uid:
|
||||
raise SignupError(_('Authentification Failed.'))
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,9 @@ class base_config_settings(osv.osv_memory):
|
||||
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."""),
|
||||
'font': fields.many2one('res.font', string="Report Font", help="Set the font into the report header, it will be used as default font in the RML reports of the user company"),
|
||||
'font': fields.many2one('res.font', string="Report Font", domain=[('mode', 'in', ('Normal', 'Regular', 'all', 'Book'))],
|
||||
help="Set the font into the report header, it will be used as default font in the RML reports of the user company"),
|
||||
|
||||
}
|
||||
|
||||
_defaults= {
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<label for="font" />
|
||||
<div>
|
||||
<div>
|
||||
<field name="font" class="oe_inline" domain="[('mode', 'in', ('normal', 'regular', 'all', 'book'))]" />
|
||||
<field name="font" class="oe_inline" />
|
||||
<button string="(reload fonts)" name="act_discover_fonts" type="object" class="oe_link"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -54,7 +54,7 @@ _ref_vat = {
|
||||
'gr': 'GR12345670',
|
||||
'hu': 'HU12345676',
|
||||
'hr': 'HR01234567896', # Croatia, contributed by Milan Tribuson
|
||||
'ie': 'IE1234567T',
|
||||
'ie': 'IE1234567FA',
|
||||
'it': 'IT12345670017',
|
||||
'lt': 'LT123456715',
|
||||
'lu': 'LU12345613',
|
||||
@@ -190,6 +190,34 @@ class res_partner(osv.osv):
|
||||
return check == int(num[8])
|
||||
return False
|
||||
|
||||
def _ie_check_char(self, vat):
|
||||
vat = vat.zfill(8)
|
||||
extra = 0
|
||||
if vat[7] not in ' W':
|
||||
if vat[7].isalpha():
|
||||
extra = 9 * (ord(vat[7]) - 64)
|
||||
else:
|
||||
# invalid
|
||||
return -1
|
||||
checksum = extra + sum((8-i) * int(x) for i, x in enumerate(vat[:7]))
|
||||
return 'WABCDEFGHIJKLMNOPQRSTUV'[checksum % 23]
|
||||
|
||||
def check_vat_ie(self, vat):
|
||||
""" Temporary Ireland VAT validation to support the new format
|
||||
introduced in January 2013 in Ireland, until upstream is fixed.
|
||||
TODO: remove when fixed upstream"""
|
||||
if len(vat) not in (8, 9) or not vat[2:7].isdigit():
|
||||
return False
|
||||
if len(vat) == 8:
|
||||
# Normalize pre-2013 numbers: final space or 'W' not significant
|
||||
vat += ' '
|
||||
if vat[:7].isdigit():
|
||||
return vat[7] == self._ie_check_char(vat[:7] + vat[8])
|
||||
elif vat[1] in (string.ascii_uppercase + '+*'):
|
||||
# Deprecated format
|
||||
# See http://www.revenue.ie/en/online/third-party-reporting/reporting-payment-details/faqs.html#section3
|
||||
return vat[7] == self._ie_check_char(vat[2:7] + vat[0] + vat[8])
|
||||
return False
|
||||
|
||||
# Mexican VAT verification, contributed by <moylop260@hotmail.com>
|
||||
# and Panos Christeas <p_christ@hol.gr>
|
||||
|
||||
@@ -330,6 +330,7 @@ class crm_lead(format_address, osv.osv):
|
||||
'phone': partner.phone,
|
||||
'mobile': partner.mobile,
|
||||
'fax': partner.fax,
|
||||
'zip': partner.zip,
|
||||
}
|
||||
return {'value': values}
|
||||
|
||||
|
||||
@@ -219,6 +219,7 @@ class event_event(osv.osv):
|
||||
]
|
||||
|
||||
def onchange_event_type(self, cr, uid, ids, type_event, context=None):
|
||||
values = {}
|
||||
if type_event:
|
||||
type_info = self.pool.get('event.type').browse(cr,uid,type_event,context)
|
||||
dic ={
|
||||
@@ -228,7 +229,8 @@ class event_event(osv.osv):
|
||||
'seats_min': type_info.default_registration_min,
|
||||
'seats_max': type_info.default_registration_max,
|
||||
}
|
||||
return {'value': dic}
|
||||
values.update(dic)
|
||||
return values
|
||||
|
||||
def onchange_start_date(self, cr, uid, ids, date_begin=False, date_end=False, context=None):
|
||||
res = {'value':{}}
|
||||
|
||||
@@ -187,7 +187,7 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
|
||||
for server in self.browse(cr, uid, ids, context=context):
|
||||
_logger.info('start checking for new emails on %s server %s', server.type, server.name)
|
||||
context.update({'fetchmail_server_id': server.id, 'server_type': server.type})
|
||||
count = 0
|
||||
count, failed = 0, 0
|
||||
imap_server = False
|
||||
pop_server = False
|
||||
if server.type == 'imap':
|
||||
@@ -196,20 +196,26 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
|
||||
imap_server.select()
|
||||
result, data = imap_server.search(None, '(UNSEEN)')
|
||||
for num in data[0].split():
|
||||
res_id = None
|
||||
result, data = imap_server.fetch(num, '(RFC822)')
|
||||
res_id = mail_thread.message_process(cr, uid, server.object_id.model,
|
||||
data[0][1],
|
||||
save_original=server.original,
|
||||
strip_attachments=(not server.attach),
|
||||
context=context)
|
||||
imap_server.store(num, '-FLAGS', '\\Seen')
|
||||
try:
|
||||
res_id = mail_thread.message_process(cr, uid, server.object_id.model,
|
||||
data[0][1],
|
||||
save_original=server.original,
|
||||
strip_attachments=(not server.attach),
|
||||
context=context)
|
||||
except Exception:
|
||||
_logger.exception('Failed to process mail from %s server %s.', server.type, server.name)
|
||||
failed += 1
|
||||
if res_id and server.action_id:
|
||||
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id], 'active_model': context.get("thread_model", server.object_id.model)})
|
||||
imap_server.store(num, '+FLAGS', '\\Seen')
|
||||
cr.commit()
|
||||
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids': [res_id], 'active_model': context.get("thread_model", server.object_id.model)})
|
||||
imap_server.store(num, '+FLAGS', '\\Seen')
|
||||
cr.commit()
|
||||
count += 1
|
||||
_logger.info("fetched/processed %s email(s) on %s server %s", count, server.type, server.name)
|
||||
_logger.info("Fetched %d email(s) on %s server %s; %d succeeded, %d failed.", count, server.type, server.name, (count - failed), failed)
|
||||
except Exception:
|
||||
_logger.exception("Failed to fetch mail from %s server %s.", server.type, server.name)
|
||||
_logger.exception("General failure when trying to fetch mail from %s server %s.", server.type, server.name)
|
||||
finally:
|
||||
if imap_server:
|
||||
imap_server.close()
|
||||
@@ -222,18 +228,23 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
|
||||
for num in range(1, numMsgs + 1):
|
||||
(header, msges, octets) = pop_server.retr(num)
|
||||
msg = '\n'.join(msges)
|
||||
res_id = mail_thread.message_process(cr, uid, server.object_id.model,
|
||||
msg,
|
||||
save_original=server.original,
|
||||
strip_attachments=(not server.attach),
|
||||
context=context)
|
||||
res_id = None
|
||||
try:
|
||||
res_id = mail_thread.message_process(cr, uid, server.object_id.model,
|
||||
msg,
|
||||
save_original=server.original,
|
||||
strip_attachments=(not server.attach),
|
||||
context=context)
|
||||
except Exception:
|
||||
_logger.exception('Failed to process mail from %s server %s.', server.type, server.name)
|
||||
failed += 1
|
||||
if res_id and server.action_id:
|
||||
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id], 'active_model': context.get("thread_model", server.object_id.model)})
|
||||
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids': [res_id], 'active_model': context.get("thread_model", server.object_id.model)})
|
||||
pop_server.dele(num)
|
||||
cr.commit()
|
||||
_logger.info("fetched/processed %s email(s) on %s server %s", numMsgs, server.type, server.name)
|
||||
_logger.info("Fetched %d email(s) on %s server %s; %d succeeded, %d failed.", numMsgs, server.type, server.name, (numMsgs - failed), failed)
|
||||
except Exception:
|
||||
_logger.exception("Failed to fetch mail from %s server %s.", server.type, server.name)
|
||||
_logger.exception("General failure when trying to fetch mail from %s server %s.", server.type, server.name)
|
||||
finally:
|
||||
if pop_server:
|
||||
pop_server.quit()
|
||||
|
||||
+25
-12
@@ -733,13 +733,15 @@ class mail_thread(osv.AbstractModel):
|
||||
# Private message: should not contain any thread_id
|
||||
if not model and thread_id:
|
||||
if assert_model:
|
||||
assert thread_id == 0, 'Routing: posting a message without model should be with a null res_id (private message), received %s.' % thread_id
|
||||
_warn('posting a message without model should be with a null res_id (private message), received %s, resetting thread_id' % thread_id)
|
||||
if thread_id:
|
||||
raise ValueError('Routing: posting a message without model should be with a null res_id (private message), received %s.' % thread_id)
|
||||
_warn('posting a message without model should be with a null res_id (private message), received %s resetting thread_id' % thread_id)
|
||||
thread_id = 0
|
||||
# Private message: should have a parent_id (only answers)
|
||||
if not model and not message_dict.get('parent_id'):
|
||||
if assert_model:
|
||||
assert message_dict.get('parent_id'), 'Routing: posting a message without model should be with a parent_id (private mesage).'
|
||||
if not message_dict.get('parent_id'):
|
||||
raise ValueError('Routing: posting a message without model should be with a parent_id (private mesage).')
|
||||
_warn('posting a message without model should be with a parent_id (private mesage), skipping')
|
||||
return ()
|
||||
|
||||
@@ -768,7 +770,10 @@ class mail_thread(osv.AbstractModel):
|
||||
# New Document: check model accepts the mailgateway
|
||||
if not thread_id and model and not hasattr(model_pool, 'message_new'):
|
||||
if assert_model:
|
||||
assert hasattr(model_pool, 'message_new'), 'Model %s does not accept document creation, crashing' % model
|
||||
if not hasattr(model_pool, 'message_new'):
|
||||
raise ValueError(
|
||||
'Model %s does not accept document creation, crashing' % model
|
||||
)
|
||||
_warn('model %s does not accept document creation, skipping' % model)
|
||||
return ()
|
||||
|
||||
@@ -829,8 +834,11 @@ class mail_thread(osv.AbstractModel):
|
||||
to which this mail should be attached. Only used if the message
|
||||
does not reply to an existing thread and does not match any mail alias.
|
||||
:return: list of [model, thread_id, custom_values, user_id, alias]
|
||||
|
||||
:raises: ValueError, TypeError
|
||||
"""
|
||||
assert isinstance(message, Message), 'message must be an email.message.Message at this point'
|
||||
if not isinstance(message, Message):
|
||||
raise TypeError('message must be an email.message.Message at this point')
|
||||
mail_msg_obj = self.pool['mail.message']
|
||||
fallback_model = model
|
||||
|
||||
@@ -948,9 +956,11 @@ class mail_thread(osv.AbstractModel):
|
||||
return [route]
|
||||
|
||||
# AssertionError if no routes found and if no bounce occured
|
||||
assert False, \
|
||||
"No possible route found for incoming message from %s to %s (Message-Id %s:)." \
|
||||
"Create an appropriate mail.alias or force the destination model." % (email_from, email_to, message_id)
|
||||
raise ValueError(
|
||||
'No possible route found for incoming message from %s to %s (Message-Id %s:). '
|
||||
'Create an appropriate mail.alias or force the destination model.' %
|
||||
(email_from, email_to, message_id)
|
||||
)
|
||||
|
||||
def message_route_process(self, cr, uid, message, message_dict, routes, context=None):
|
||||
# postpone setting message_dict.partner_ids after message_post, to avoid double notifications
|
||||
@@ -961,9 +971,11 @@ class mail_thread(osv.AbstractModel):
|
||||
context.update({'thread_model': model})
|
||||
if model:
|
||||
model_pool = self.pool[model]
|
||||
assert thread_id and hasattr(model_pool, 'message_update') or hasattr(model_pool, 'message_new'), \
|
||||
"Undeliverable mail with Message-Id %s, model %s does not accept incoming emails" % \
|
||||
(message_dict['message_id'], model)
|
||||
if not (thread_id and hasattr(model_pool, 'message_update') or hasattr(model_pool, 'message_new')):
|
||||
raise ValueError(
|
||||
"Undeliverable mail with Message-Id %s, model %s does not accept incoming emails" %
|
||||
(message_dict['message_id'], model)
|
||||
)
|
||||
|
||||
# disabled subscriptions during message_new/update to avoid having the system user running the
|
||||
# email gateway become a follower of all inbound messages
|
||||
@@ -973,7 +985,8 @@ class mail_thread(osv.AbstractModel):
|
||||
else:
|
||||
thread_id = model_pool.message_new(cr, user_id, message_dict, custom_values, context=nosub_ctx)
|
||||
else:
|
||||
assert thread_id == 0, "Posting a message without model should be with a null res_id, to create a private message."
|
||||
if thread_id:
|
||||
raise ValueError("Posting a message without model should be with a null res_id, to create a private message.")
|
||||
model_pool = self.pool.get('mail.thread')
|
||||
if not hasattr(model_pool, 'message_post'):
|
||||
context['thread_model'] = model
|
||||
|
||||
@@ -115,6 +115,9 @@
|
||||
.openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body p {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body * {
|
||||
text-overflow:ellipsis;
|
||||
word-wrap: break-word;
|
||||
|
||||
@@ -925,20 +925,12 @@ openerp.mail = function (session) {
|
||||
},
|
||||
|
||||
on_record_clicked: function (event) {
|
||||
event.stopPropagation();
|
||||
var state = {
|
||||
'model': this.model,
|
||||
'id': this.res_id,
|
||||
'title': this.record_name
|
||||
};
|
||||
session.webclient.action_manager.do_push_state(state);
|
||||
this.do_action({
|
||||
res_model: state.model,
|
||||
res_id: state.id,
|
||||
type: 'ir.actions.act_window',
|
||||
views: [[false, 'form']]
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
/* Call the on_compose_message on the thread of this message. */
|
||||
|
||||
@@ -262,7 +262,8 @@
|
||||
<!-- message itself -->
|
||||
<div class="oe_msg_content">
|
||||
<h1 t-if="(widget.show_record_name or widget.subject) and !widget.thread_level" class="oe_msg_title">
|
||||
<a t-if="widget.options.show_link and widget.show_record_name" class="oe_mail_action_model" t-attf-href="#model=#{widget.model}&id=#{widget.res_id}">
|
||||
<a t-if="widget.options.show_link and widget.show_record_name" class="oe_mail_action_model"
|
||||
t-attf-href="#action=mail.action_mail_redirect&model=#{widget.model}&res_id=#{widget.res_id}">
|
||||
<t t-esc="widget.record_name"/>
|
||||
</a>
|
||||
<span t-if="!widget.options.show_link and widget.show_record_name"><t t-esc="widget.record_name"/></span>
|
||||
|
||||
@@ -394,7 +394,7 @@ class TestMailgateway(TestMail):
|
||||
'message_process: after reply, group should have 2 followers')
|
||||
|
||||
# Do: incoming email with ref holding model / res_id but that does not match any message in the thread: must raise since OpenERP saas-3
|
||||
self.assertRaises(AssertionError,
|
||||
self.assertRaises(ValueError,
|
||||
format_and_process,
|
||||
MAIL_TEMPLATE, email_from='other5@gmail.com',
|
||||
to='noone@example.com', subject='spam',
|
||||
@@ -490,14 +490,14 @@ class TestMailgateway(TestMail):
|
||||
# --------------------------------------------------
|
||||
|
||||
# Do: incoming email with model that does not accepts incoming emails must raise
|
||||
self.assertRaises(AssertionError,
|
||||
self.assertRaises(ValueError,
|
||||
format_and_process,
|
||||
MAIL_TEMPLATE,
|
||||
to='noone@example.com', subject='spam', extra='', model='res.country',
|
||||
msg_id='<1198923581.41972151344608186760.JavaMail.new4@agrolait.com>')
|
||||
|
||||
# Do: incoming email without model and without alias must raise
|
||||
self.assertRaises(AssertionError,
|
||||
self.assertRaises(ValueError,
|
||||
format_and_process,
|
||||
MAIL_TEMPLATE,
|
||||
to='noone@example.com', subject='spam', extra='',
|
||||
|
||||
@@ -95,8 +95,15 @@ class Website(openerp.addons.web.controllers.main.Home):
|
||||
# Edit
|
||||
#------------------------------------------------------
|
||||
@http.route('/website/add/<path:path>', type='http', auth="user", website=True)
|
||||
def pagenew(self, path, noredirect=False):
|
||||
def pagenew(self, path, noredirect=False, add_menu=None):
|
||||
xml_id = request.registry['website'].new_page(request.cr, request.uid, path, context=request.context)
|
||||
if add_menu:
|
||||
model, id = request.registry["ir.model.data"].get_object_reference(request.cr, request.uid, 'website', 'main_menu')
|
||||
request.registry['website.menu'].create(request.cr, request.uid, {
|
||||
'name': path,
|
||||
'url': "/page/" + xml_id,
|
||||
'parent_id': id,
|
||||
}, context=request.context)
|
||||
url = "/page/" + xml_id
|
||||
if noredirect:
|
||||
return werkzeug.wrappers.Response(url, mimetype='text/plain')
|
||||
|
||||
@@ -148,7 +148,7 @@ class view(osv.osv):
|
||||
qcontext.update(values)
|
||||
|
||||
# in edit mode ir.ui.view will tag nodes
|
||||
context['inherit_branding'] = qcontext['editable']
|
||||
context['inherit_branding'] = qcontext.get('editable', False)
|
||||
|
||||
view_obj = request.website.get_template(id_or_xml_id)
|
||||
if 'main_object' not in qcontext:
|
||||
|
||||
@@ -494,9 +494,14 @@ class website_menu(osv.osv):
|
||||
'parent_left': fields.integer('Parent Left', select=True),
|
||||
'parent_right': fields.integer('Parent Right', select=True),
|
||||
}
|
||||
|
||||
def __defaults_sequence(self, cr, uid, context):
|
||||
menu = self.search_read(cr, uid, [(1,"=",1)], ["sequence"], limit=1, order="sequence DESC", context=context)
|
||||
return menu and menu[0]["sequence"] or 0
|
||||
|
||||
_defaults = {
|
||||
'url': '',
|
||||
'sequence': 0,
|
||||
'sequence': __defaults_sequence,
|
||||
'new_window': False,
|
||||
}
|
||||
_parent_store = True
|
||||
|
||||
@@ -19,10 +19,24 @@
|
||||
website.prompt({
|
||||
id: "editor_new_page",
|
||||
window_title: _t("New Page"),
|
||||
input: "Page Title",
|
||||
}).then(function (val) {
|
||||
input: _t("Page Title"),
|
||||
init: function () {
|
||||
var $group = this.$dialog.find("div.form-group");
|
||||
$group.removeClass("mb0");
|
||||
|
||||
var $add = $(
|
||||
'<div class="form-group mb0">'+
|
||||
'<label class="col-sm-offset-3 col-sm-9 text-left">'+
|
||||
' <input type="checkbox" checked="checked" required="required"/> '+
|
||||
'</label>'+
|
||||
'</div>');
|
||||
$add.find('label').append(_t("Add page in menu"));
|
||||
$group.after($add);
|
||||
}
|
||||
}).then(function (val, field, $dialog) {
|
||||
if (val) {
|
||||
document.location = '/website/add/' + encodeURI(val);
|
||||
console.log('/website/add/' + encodeURI(val) + "?add_menu=" + $dialog.find('input[type="checkbox"]').is(':checked'));
|
||||
document.location = '/website/add/' + encodeURI(val) + "?add_menu=" + $dialog.find('input[type="checkbox"]').is(':checked');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -206,6 +206,7 @@
|
||||
|
||||
var def = $.Deferred();
|
||||
var dialog = $(openerp.qweb.render('website.prompt', options)).appendTo("body");
|
||||
options.$dialog = dialog;
|
||||
var field = dialog.find(options.field_type).first();
|
||||
field.val(options.default);
|
||||
field.fillWith = function (data) {
|
||||
@@ -226,7 +227,7 @@
|
||||
dialog.modal('show');
|
||||
field.focus();
|
||||
dialog.on('click', '.btn-primary', function () {
|
||||
def.resolve(field.val(), field);
|
||||
def.resolve(field.val(), field, dialog);
|
||||
dialog.remove();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -281,6 +281,14 @@ website.Tour = openerp.Class.extend({
|
||||
self.nextStep(step.stepId, callback, overlaps);
|
||||
}, self.defaultDelay);
|
||||
} else if (!overlaps || new Date().getTime() - time < overlaps) {
|
||||
if (self.current.element) {
|
||||
var $popover = $(".popover.tour");
|
||||
if(!$(self.current.element).is(":visible")) {
|
||||
$popover.data("hide", true).fadeOut(300);
|
||||
} else if($popover.data("hide")) {
|
||||
$popover.data("hide", false).fadeIn(150);
|
||||
}
|
||||
}
|
||||
self.timer = setTimeout(checkNext, self.defaultDelay);
|
||||
} else {
|
||||
self.reset();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
{
|
||||
title: _t("Create an Event"),
|
||||
content: _t("Let's go through the first steps to publish a new event."),
|
||||
popover: { next: _("Start Tutorial"), end: _("Skip It") },
|
||||
popover: { next: _t("Start Tutorial"), end: _t("Skip It") },
|
||||
},
|
||||
{
|
||||
element: '#content-menu-button',
|
||||
|
||||
@@ -12,10 +12,7 @@ OpenERP Website LiveChat
|
||||
'depends': ['website', 'im_livechat'],
|
||||
'installable': True,
|
||||
'data': [
|
||||
'views/website_livechat.xml'
|
||||
'views/website_livechat.xml',
|
||||
'views/res_config.xml'
|
||||
],
|
||||
'demo': [ ],
|
||||
'js': [],
|
||||
'qweb': [],
|
||||
'css': [],
|
||||
}
|
||||
|
||||
@@ -5,4 +5,11 @@ class website(osv.osv):
|
||||
|
||||
_columns = {
|
||||
'channel_id': fields.many2one('im_livechat.channel', string="Channel"),
|
||||
}
|
||||
}
|
||||
|
||||
class website_config_settings(osv.osv_memory):
|
||||
_inherit = 'website.config.settings'
|
||||
|
||||
_columns = {
|
||||
'channel_id': fields.related('website_id', 'channel_id', type='many2one', relation='im_livechat.channel', string='Live Chat Channel'),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_website_config_settings" model="ir.ui.view">
|
||||
<field name="name">Website livechat settings</field>
|
||||
<field name="model">website.config.settings</field>
|
||||
<field name="inherit_id" ref="website.view_website_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@string='Social Media']" position="inside">
|
||||
<label for="channel_id"/>
|
||||
<div name="channel_id">
|
||||
<div class="oe_inline">
|
||||
<field name="channel_id"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -2,22 +2,6 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="website_settings_livechat" model="ir.ui.view">
|
||||
<field name="name">website.form</field>
|
||||
<field name="model">website</field>
|
||||
<field name="inherit_id" ref="website.view_website_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='other']" position='before'>
|
||||
<div name="livechat">
|
||||
<separator string="LiveChat"/>
|
||||
<group name="livechat">
|
||||
<field name="channel_id" widget="many2one"/>
|
||||
</group>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<template id="header" inherit_id="website.layout" name="LiveChat Snippet">
|
||||
<xpath expr="//body" position="inside">
|
||||
<t t-if="website.channel_id">
|
||||
|
||||
@@ -28,13 +28,21 @@ class MailMessage(osv.Model):
|
||||
|
||||
_columns = {
|
||||
'website_published': fields.boolean(
|
||||
'Publish', help="Publish on the website as a blog"
|
||||
'Published', help="Visible on the website as a comment"
|
||||
),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'website_published': True,
|
||||
}
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
defaults = super(MailMessage, self).default_get(cr, uid, fields_list, context=context)
|
||||
|
||||
# Note: explicitly implemented in default_get() instead of _defaults,
|
||||
# to avoid setting to True for all existing messages during upgrades.
|
||||
# TODO: this default should probably be dynamic according to the model
|
||||
# on which the messages are attached, thus moved to create().
|
||||
if 'website_published' in fields_list:
|
||||
defaults.setdefault('website_published', True)
|
||||
|
||||
return defaults
|
||||
|
||||
def _search(self, cr, uid, args, offset=0, limit=None, order=None,
|
||||
context=None, count=False, access_rights_uid=None):
|
||||
|
||||
Reference in New Issue
Block a user