[MERGE] from upstream

bzr revid: fva@openerp.com-20130712100516-mk14z6zqebdje3ud
This commit is contained in:
Frédéric van der Essen
2013-07-12 12:05:16 +02:00
6 changed files with 58 additions and 29 deletions
+1 -1
View File
@@ -719,7 +719,7 @@ class account_journal(osv.osv):
'user_id': fields.many2one('res.users', 'User', help="The user responsible for this journal"),
'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'),
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
'entry_posted': fields.boolean('Skip \'Draft\' State for Manual Entries', help='Check this box if you don\'t want new journal entries to pass through the \'draft\' state and instead goes directly to the \'posted state\' without any manual validation. \nNote that journal entries that are automatically created by the system are always skipping that state.'),
'entry_posted': fields.boolean('Autopost Created Moves', help='Check this box to automatically post entries of this journal. Note that legally, some entries may be automatically posted when the source document is validated (Invoices), whatever the status of this field.'),
'company_id': fields.many2one('res.company', 'Company', required=True, select=1, help="Company related to this journal"),
'allow_date':fields.boolean('Check Date in Period', help= 'If set to True then do not accept the entry if the entry date is not into the period dates'),
+1 -1
View File
@@ -322,7 +322,7 @@
</tree>
</field>
</page>
<page string="Other Information">
<page string="Accounting Information">
<group>
<group string="Miscellaneous">
<field name="company_id" groups="base.group_multi_company"/>
+9 -7
View File
@@ -101,17 +101,19 @@ class LongPollingController(http.Controller):
raise Exception("Not usable in a server not running gevent")
from openerp.addons.im.watcher import ImWatcher
if db is not None:
request.session.authenticate(db=db, uid=uid, password=password)
openerp.service.security.check(db, uid, password)
else:
request.session.authenticate(db=request.session._db, uid=request.session._uid, password=request.session._password)
uid = request.session.uid
db = request.session.db
with request.registry.cursor() as cr:
request.registry.get('im.user').im_connect(cr, request.uid, uuid=uuid, context=request.context)
my_id = request.registry.get('im.user').get_by_user_id(cr, request.uid, uuid or request.session._uid, request.context)["id"]
registry = openerp.modules.registry.RegistryManager.get(db)
with registry.cursor() as cr:
registry.get('im.user').im_connect(cr, uid, uuid=uuid, context=request.context)
my_id = registry.get('im.user').get_by_user_id(cr, uid, uuid or uid, request.context)["id"]
num = 0
while True:
with request.registry.cursor() as cr:
res = request.registry.get('im.message').get_messages(cr, request.uid, last, users_watch, uuid=uuid, context=request.context)
with registry.cursor() as cr:
res = registry.get('im.message').get_messages(cr, uid, last, users_watch, uuid=uuid, context=request.context)
if num >= 1 or len(res["res"]) > 0:
return res
last = res["last"]
+27 -18
View File
@@ -37,36 +37,45 @@ env.filters["json"] = json.dumps
class LiveChatController(http.Controller):
@http.route('/im_livechat/loader')
def _auth(self, db):
reg = openerp.modules.registry.RegistryManager.get(db)
uid = openerp.netsvc.dispatch_rpc('common', 'authenticate', [db, "anonymous", "anonymous", None])
return reg, uid
@http.route('/im_livechat/loader', auth="none")
def loader(self, **kwargs):
p = json.loads(kwargs["p"])
db = p["db"]
channel = p["channel"]
user_name = p.get("user_name", None)
request.session.authenticate(db=db, login="anonymous", password="anonymous")
info = request.session.model('im_livechat.channel').get_info_for_chat_src(channel)
info["db"] = db
info["channel"] = channel
info["userName"] = user_name
return request.make_response(env.get_template("loader.js").render(info),
headers=[('Content-Type', "text/javascript")])
@http.route('/im_livechat/web_page')
reg, uid = self._auth(db)
with reg.cursor() as cr:
info = reg.get('im_livechat.channel').get_info_for_chat_src(cr, uid, channel)
info["db"] = db
info["channel"] = channel
info["userName"] = user_name
return request.make_response(env.get_template("loader.js").render(info),
headers=[('Content-Type', "text/javascript")])
@http.route('/im_livechat/web_page', auth="none")
def web_page(self, **kwargs):
p = json.loads(kwargs["p"])
db = p["db"]
channel = p["channel"]
request.session.authenticate(db=db, login="anonymous", password="anonymous")
script = request.session.model('im_livechat.channel').read(channel, ["script"])["script"]
info = request.session.model('im_livechat.channel').get_info_for_chat_src(channel)
info["script"] = script
return request.make_response(env.get_template("web_page.html").render(info),
headers=[('Content-Type', "text/html")])
reg, uid = self._auth(db)
with reg.cursor() as cr:
script = reg.get('im_livechat.channel').read(cr, uid, channel, ["script"])["script"]
info = reg.get('im_livechat.channel').get_info_for_chat_src(cr, uid, channel)
info["script"] = script
return request.make_response(env.get_template("web_page.html").render(info),
headers=[('Content-Type', "text/html")])
@http.route('/im_livechat/available', type='json')
@http.route('/im_livechat/available', type='json', auth="none")
def available(self, db, channel):
request.session.authenticate(db=db, login="anonymous", password="anonymous")
return request.session.model('im_livechat.channel').get_available_user(channel) > 0
reg, uid = self._auth(db)
with reg.cursor() as cr:
return reg.get('im_livechat.channel').get_available_user(cr, uid, channel) > 0
class im_livechat_channel(osv.osv):
_name = 'im_livechat.channel'
+18
View File
@@ -967,6 +967,24 @@ openerp.mail = function (session) {
this.$('.oe_reply').on('click', this.on_message_reply);
this.$('.oe_star').on('click', this.on_star);
this.$('.oe_msg_vote').on('click', this.on_vote);
this.$('.oe_mail_action_model').on('click', this.on_record_clicked);
},
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. */
+2 -2
View File
@@ -9,7 +9,6 @@ from openerp.addons.web.http import request
from openerp.addons.web.controllers.main import manifest_list, module_boot, html_template
class PointOfSaleController(http.Controller):
#_cp_path = '/pos'
@http.route('/pos/app', type='http', auth='admin')
def app(self):
@@ -18,7 +17,8 @@ class PointOfSaleController(http.Controller):
cookie = request.httprequest.cookies.get("instance0|session_id")
session_id = cookie.replace("%22","")
template = html_template.replace('<html','<html manifest="/pos/manifest?session_id=%s"'%session_id)
template = html_template.replace('<html','<html manifest="/pos/manifest?session_id=%s"' % request.session_id)
r = template % {
'js': js,
'css': css,