[MERGE] Forward-port of latest saas-1 bugfixes, up to rev. 8800 rev-id: dle@openerp.com-20131031162241-goga1hsvwgyqigzd
bzr revid: chs@openerp.com-20131031142325-vo84hk5co2e2phg0 bzr revid: dle@openerp.com-20131031143133-wfus2hag57e73by2 bzr revid: dle@openerp.com-20131031162928-8gpom1ralccy07uc
This commit is contained in:
commit
0cf57bdee2
|
@ -51,7 +51,12 @@ openerp.base_import = function (instance) {
|
||||||
type: 'ir.actions.client',
|
type: 'ir.actions.client',
|
||||||
tag: 'import',
|
tag: 'import',
|
||||||
params: {
|
params: {
|
||||||
model: self.dataset.model
|
model: self.dataset.model,
|
||||||
|
// self.dataset.get_context() could be a compound?
|
||||||
|
// not sure. action's context should be evaluated
|
||||||
|
// so safer bet. Odd that timezone & al in it
|
||||||
|
// though
|
||||||
|
context: self.getParent().action.context,
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
on_reverse_breadcrumb: function () {
|
on_reverse_breadcrumb: function () {
|
||||||
|
@ -127,6 +132,7 @@ openerp.base_import = function (instance) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.res_model = action.params.model;
|
this.res_model = action.params.model;
|
||||||
|
this.parent_context = action.params.context || {};
|
||||||
// import object id
|
// import object id
|
||||||
this.id = null;
|
this.id = null;
|
||||||
this.Import = new instance.web.Model('base_import.import');
|
this.Import = new instance.web.Model('base_import.import');
|
||||||
|
@ -353,11 +359,12 @@ openerp.base_import = function (instance) {
|
||||||
},
|
},
|
||||||
|
|
||||||
//- import itself
|
//- import itself
|
||||||
call_import: function (options) {
|
call_import: function (kwargs) {
|
||||||
var fields = this.$('.oe_import_fields input.oe_import_match_field').map(function (index, el) {
|
var fields = this.$('.oe_import_fields input.oe_import_match_field').map(function (index, el) {
|
||||||
return $(el).select2('val') || false;
|
return $(el).select2('val') || false;
|
||||||
}).get();
|
}).get();
|
||||||
return this.Import.call('do', [this.id, fields, this.import_options()], options)
|
kwargs.context = this.parent_context;
|
||||||
|
return this.Import.call('do', [this.id, fields, this.import_options()], kwargs)
|
||||||
.then(undefined, function (error, event) {
|
.then(undefined, function (error, event) {
|
||||||
// In case of unexpected exception, convert
|
// In case of unexpected exception, convert
|
||||||
// "JSON-RPC error" to an import failure, and
|
// "JSON-RPC error" to an import failure, and
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||||
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
|
# Copyright (C) 2010-2013 OpenERP s.a. (<http://openerp.com>).
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
@ -49,6 +49,7 @@ class board_board(osv.osv):
|
||||||
('value', 'in', refs),
|
('value', 'in', refs),
|
||||||
], context=context)
|
], context=context)
|
||||||
menu_ids = map(itemgetter('res_id'), IrValues.read(cr, uid, irv_ids, ['res_id'], context=context))
|
menu_ids = map(itemgetter('res_id'), IrValues.read(cr, uid, irv_ids, ['res_id'], context=context))
|
||||||
|
menu_ids = Menus._filter_visible_menus(cr, uid, menu_ids, context=context)
|
||||||
menu_names = Menus.name_get(cr, uid, menu_ids, context=context)
|
menu_names = Menus.name_get(cr, uid, menu_ids, context=context)
|
||||||
return [dict(id=m[0], name=m[1]) for m in menu_names]
|
return [dict(id=m[0], name=m[1]) for m in menu_names]
|
||||||
|
|
||||||
|
|
|
@ -179,6 +179,12 @@ class crm_lead(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def assign_geo_localize(self, cr, uid, ids, latitude=False, longitude=False, context=None):
|
def assign_geo_localize(self, cr, uid, ids, latitude=False, longitude=False, context=None):
|
||||||
|
if latitude and longitude:
|
||||||
|
self.write(cr, uid, ids, {
|
||||||
|
'partner_latitude': latitude,
|
||||||
|
'partner_longitude': longitude
|
||||||
|
}, context=context)
|
||||||
|
return True
|
||||||
# Don't pass context to browse()! We need country name in english below
|
# Don't pass context to browse()! We need country name in english below
|
||||||
for lead in self.browse(cr, uid, ids):
|
for lead in self.browse(cr, uid, ids):
|
||||||
if not lead.country_id:
|
if not lead.country_id:
|
||||||
|
@ -188,14 +194,11 @@ class crm_lead(osv.osv):
|
||||||
city=lead.city,
|
city=lead.city,
|
||||||
state=lead.state_id.name,
|
state=lead.state_id.name,
|
||||||
country=lead.country_id.name))
|
country=lead.country_id.name))
|
||||||
if not latitude and result:
|
if result:
|
||||||
latitude = result[0]
|
self.write(cr, uid, [lead.id], {
|
||||||
if not longitude and result:
|
'partner_latitude': result[0],
|
||||||
longitude = result[1]
|
'partner_longitude': result[1]
|
||||||
self.write(cr, uid, [lead.id], {
|
}, context=context)
|
||||||
'partner_latitude': latitude,
|
|
||||||
'partner_longitude': longitude
|
|
||||||
}, context=context)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def search_geo_partner(self, cr, uid, ids, context=None):
|
def search_geo_partner(self, cr, uid, ids, context=None):
|
||||||
|
|
|
@ -1234,17 +1234,27 @@ class account_invoice(osv.Model):
|
||||||
def invoice_validate(self, cr, uid, ids, context=None):
|
def invoice_validate(self, cr, uid, ids, context=None):
|
||||||
res = super(account_invoice, self).invoice_validate(cr, uid, ids, context=context)
|
res = super(account_invoice, self).invoice_validate(cr, uid, ids, context=context)
|
||||||
purchase_order_obj = self.pool.get('purchase.order')
|
purchase_order_obj = self.pool.get('purchase.order')
|
||||||
po_ids = purchase_order_obj.search(cr, uid, [('invoice_ids', 'in', ids)], context=context)
|
# read access on purchase.order object is not required
|
||||||
|
if not purchase_order_obj.check_access_rights(cr, uid, 'read', raise_exception=False):
|
||||||
|
user_id = SUPERUSER_ID
|
||||||
|
else:
|
||||||
|
user_id = uid
|
||||||
|
po_ids = purchase_order_obj.search(cr, user_id, [('invoice_ids', 'in', ids)], context=context)
|
||||||
for po_id in po_ids:
|
for po_id in po_ids:
|
||||||
purchase_order_obj.message_post(cr, uid, po_id, body=_("Invoice received"), context=context)
|
purchase_order_obj.message_post(cr, user_id, po_id, body=_("Invoice received"), context=context)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def confirm_paid(self, cr, uid, ids, context=None):
|
def confirm_paid(self, cr, uid, ids, context=None):
|
||||||
res = super(account_invoice, self).confirm_paid(cr, uid, ids, context=context)
|
res = super(account_invoice, self).confirm_paid(cr, uid, ids, context=context)
|
||||||
purchase_order_obj = self.pool.get('purchase.order')
|
purchase_order_obj = self.pool.get('purchase.order')
|
||||||
po_ids = purchase_order_obj.search(cr, uid, [('invoice_ids', 'in', ids)], context=context)
|
# read access on purchase.order object is not required
|
||||||
|
if not purchase_order_obj.check_access_rights(cr, uid, 'read', raise_exception=False):
|
||||||
|
user_id = SUPERUSER_ID
|
||||||
|
else:
|
||||||
|
user_id = uid
|
||||||
|
po_ids = purchase_order_obj.search(cr, user_id, [('invoice_ids', 'in', ids)], context=context)
|
||||||
if po_ids:
|
if po_ids:
|
||||||
purchase_order_obj.message_post(cr, uid, po_ids, body=_("Invoice paid"), context=context)
|
purchase_order_obj.message_post(cr, user_id, po_ids, body=_("Invoice paid"), context=context)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class account_invoice_line(osv.Model):
|
class account_invoice_line(osv.Model):
|
||||||
|
|
|
@ -27,6 +27,7 @@ import re
|
||||||
|
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
from openerp.osv import fields,osv
|
from openerp.osv import fields,osv
|
||||||
|
from openerp import SUPERUSER_ID
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -142,9 +143,10 @@ class ir_attachment(osv.osv):
|
||||||
if attach.store_fname:
|
if attach.store_fname:
|
||||||
self._file_delete(cr, uid, location, attach.store_fname)
|
self._file_delete(cr, uid, location, attach.store_fname)
|
||||||
fname = self._file_write(cr, uid, location, value)
|
fname = self._file_write(cr, uid, location, value)
|
||||||
super(ir_attachment, self).write(cr, uid, [id], {'store_fname': fname, 'file_size': file_size}, context=context)
|
# SUPERUSER_ID as probably don't have write access, trigger during create
|
||||||
|
super(ir_attachment, self).write(cr, SUPERUSER_ID, [id], {'store_fname': fname, 'file_size': file_size}, context=context)
|
||||||
else:
|
else:
|
||||||
super(ir_attachment, self).write(cr, uid, [id], {'db_datas': value, 'file_size': file_size}, context=context)
|
super(ir_attachment, self).write(cr, SUPERUSER_ID, [id], {'db_datas': value, 'file_size': file_size}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
_name = 'ir.attachment'
|
_name = 'ir.attachment'
|
||||||
|
@ -186,8 +188,6 @@ class ir_attachment(osv.osv):
|
||||||
In the 'document' module, it is overriden to relax this hard rule, since
|
In the 'document' module, it is overriden to relax this hard rule, since
|
||||||
more complex ones apply there.
|
more complex ones apply there.
|
||||||
"""
|
"""
|
||||||
if not ids:
|
|
||||||
return
|
|
||||||
res_ids = {}
|
res_ids = {}
|
||||||
if ids:
|
if ids:
|
||||||
if isinstance(ids, (int, long)):
|
if isinstance(ids, (int, long)):
|
||||||
|
@ -290,7 +290,7 @@ class ir_attachment(osv.osv):
|
||||||
return super(ir_attachment, self).unlink(cr, uid, ids, context)
|
return super(ir_attachment, self).unlink(cr, uid, ids, context)
|
||||||
|
|
||||||
def create(self, cr, uid, values, context=None):
|
def create(self, cr, uid, values, context=None):
|
||||||
self.check(cr, uid, [], mode='create', context=context, values=values)
|
self.check(cr, uid, [], mode='write', context=context, values=values)
|
||||||
if 'file_size' in values:
|
if 'file_size' in values:
|
||||||
del values['file_size']
|
del values['file_size']
|
||||||
return super(ir_attachment, self).create(cr, uid, values, context)
|
return super(ir_attachment, self).create(cr, uid, values, context)
|
||||||
|
|
|
@ -102,13 +102,10 @@ class res_config_configurable(osv.osv_memory):
|
||||||
res = next.action_launch(context=context)
|
res = next.action_launch(context=context)
|
||||||
res['nodestroy'] = False
|
res['nodestroy'] = False
|
||||||
return res
|
return res
|
||||||
# reload the client; open the first available root menu
|
|
||||||
menu_obj = self.pool['ir.ui.menu']
|
|
||||||
menu_ids = menu_obj.search(cr, uid, [('parent_id', '=', False)], context=context)
|
|
||||||
return {
|
return {
|
||||||
'type': 'ir.actions.client',
|
'type': 'ir.actions.client',
|
||||||
'tag': 'reload',
|
'tag': 'reload',
|
||||||
'params': {'menu_id': menu_ids and menu_ids[0] or False},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def start(self, cr, uid, ids, context=None):
|
def start(self, cr, uid, ids, context=None):
|
||||||
|
|
Loading…
Reference in New Issue