[MERGE] Forward-port 8.0 up to d18d606a55
This commit is contained in:
@@ -652,7 +652,6 @@ class account_account(osv.osv):
|
||||
done_list = []
|
||||
account = self.browse(cr, uid, id, context=context)
|
||||
new_child_ids = []
|
||||
default.setdefault('code', _("%s (copy)") % (account['code'] or ''))
|
||||
if not local:
|
||||
done_list = []
|
||||
if account.id in done_list:
|
||||
@@ -666,6 +665,7 @@ class account_account(osv.osv):
|
||||
default['child_parent_ids'] = [(6, 0, new_child_ids)]
|
||||
else:
|
||||
default['child_parent_ids'] = False
|
||||
default.setdefault('code', _("%s (copy)") % (account['code'] or ''))
|
||||
return super(account_account, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
def _check_moves(self, cr, uid, ids, method, context=None):
|
||||
|
||||
@@ -151,15 +151,23 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header):
|
||||
for i in range(5):
|
||||
args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids),self.date_from,)
|
||||
dates_query = '(COALESCE(l.date_maturity,l.date)'
|
||||
date_partial = ''
|
||||
arg_partial = ()
|
||||
if form[str(i)]['start'] and form[str(i)]['stop']:
|
||||
dates_query += ' BETWEEN %s AND %s)'
|
||||
args_list += (form[str(i)]['start'], form[str(i)]['stop'])
|
||||
date_partial = 'AND l.date <= %s'
|
||||
arg_partial = (form[str(i)]['stop'],)
|
||||
elif form[str(i)]['start']:
|
||||
dates_query += ' >= %s)'
|
||||
args_list += (form[str(i)]['start'],)
|
||||
date_partial = 'AND l.date >= %s'
|
||||
arg_partial = (form[str(i)]['start'],)
|
||||
else:
|
||||
dates_query += ' <= %s)'
|
||||
args_list += (form[str(i)]['stop'],)
|
||||
date_partial = 'AND l.date <= %s'
|
||||
arg_partial = (form[str(i)]['stop'],)
|
||||
args_list += (self.date_from,)
|
||||
self.cr.execute('''SELECT l.partner_id, SUM(l.debit-l.credit), l.reconcile_partial_id
|
||||
FROM account_move_line AS l, account_account, account_move am
|
||||
@@ -186,7 +194,8 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header):
|
||||
JOIN account_account AS a ON l.account_id = a.id
|
||||
WHERE reconcile_partial_id = %s
|
||||
AND a.type IN %s
|
||||
''', (partner_info[2], tuple(self.ACCOUNT_TYPE),))
|
||||
''' + date_partial
|
||||
, (partner_info[2], tuple(self.ACCOUNT_TYPE),) + arg_partial)
|
||||
date = self.cr.fetchall()
|
||||
# Just in case date is not defined (but it should be defined)
|
||||
if date and not date[0][0]:
|
||||
|
||||
@@ -23,7 +23,7 @@ try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
import json # noqa
|
||||
import urllib
|
||||
import urllib2
|
||||
|
||||
from openerp.osv import osv, fields
|
||||
from openerp import tools
|
||||
@@ -33,10 +33,10 @@ from openerp.exceptions import UserError
|
||||
|
||||
def geo_find(addr):
|
||||
url = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
|
||||
url += urllib.quote(addr.encode('utf8'))
|
||||
url += urllib2.quote(addr.encode('utf8'))
|
||||
|
||||
try:
|
||||
result = json.load(urllib.urlopen(url))
|
||||
result = json.load(urllib2.urlopen(url))
|
||||
except Exception, e:
|
||||
raise UserError(_('Cannot contact geolocation servers. Please make sure that your internet connection is up and running (%s).') % e)
|
||||
if result['status'] != 'OK':
|
||||
|
||||
+1
-1
@@ -744,7 +744,7 @@ class BaseModel(object):
|
||||
field = cls._fields.get(name)
|
||||
if not field:
|
||||
_logger.warning("method %s.%s: @constrains parameter %r is not a field name", cls._name, attr, name)
|
||||
elif not (field.store or field.column and field.column._fnct_inv):
|
||||
elif not (field.store or field.column and field.column._fnct_inv or field.inherited):
|
||||
_logger.warning("method %s.%s: @constrains parameter %r is not writeable", cls._name, attr, name)
|
||||
methods.append(func)
|
||||
|
||||
|
||||
+10
-1
@@ -202,7 +202,16 @@ def file_open(name, mode="r", subdir='addons', pathinfo=False):
|
||||
|
||||
|
||||
def _fileopen(path, mode, basedir, pathinfo, basename=None):
|
||||
name = os.path.normpath(os.path.join(basedir, path))
|
||||
name = os.path.normpath(os.path.normcase(os.path.join(basedir, path)))
|
||||
|
||||
import openerp.modules as addons
|
||||
paths = addons.module.ad_paths + [config['root_path']]
|
||||
for addons_path in paths:
|
||||
addons_path = os.path.normpath(os.path.normcase(addons_path)) + os.sep
|
||||
if name.startswith(addons_path):
|
||||
break
|
||||
else:
|
||||
raise ValueError("Unknown path: %s" % name)
|
||||
|
||||
if basename is None:
|
||||
basename = name
|
||||
|
||||
Reference in New Issue
Block a user