[MERGE] forward port branch 10.0 up to 9001a75f23
This commit is contained in:
@@ -20,21 +20,24 @@ class AccountAnalyticAccount(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def _compute_debit_credit_balance(self):
|
def _compute_debit_credit_balance(self):
|
||||||
analytic_line_obj = self.env['account.analytic.line']
|
analytic_line_obj = self.env['account.analytic.line']
|
||||||
domain = [('account_id', 'in', self.mapped('id'))]
|
domain = [('account_id', 'in', self.ids)]
|
||||||
if self._context.get('from_date', False):
|
if self._context.get('from_date', False):
|
||||||
domain.append(('date', '>=', self._context['from_date']))
|
domain.append(('date', '>=', self._context['from_date']))
|
||||||
if self._context.get('to_date', False):
|
if self._context.get('to_date', False):
|
||||||
domain.append(('date', '<=', self._context['to_date']))
|
domain.append(('date', '<=', self._context['to_date']))
|
||||||
|
|
||||||
account_amounts = analytic_line_obj.search_read(domain, ['account_id', 'amount'])
|
credit_groups = analytic_line_obj.read_group(
|
||||||
account_ids = set([line['account_id'][0] for line in account_amounts])
|
domain=domain + [('amount', '>=', 0.0)],
|
||||||
data_debit = {account_id: 0.0 for account_id in account_ids}
|
fields=['account_id', 'amount'],
|
||||||
data_credit = {account_id: 0.0 for account_id in account_ids}
|
groupby=['account_id']
|
||||||
for account_amount in account_amounts:
|
)
|
||||||
if account_amount['amount'] < 0.0:
|
data_credit = {l['account_id'][0]: l['amount'] for l in credit_groups}
|
||||||
data_debit[account_amount['account_id'][0]] += account_amount['amount']
|
debit_groups = analytic_line_obj.read_group(
|
||||||
else:
|
domain=domain + [('amount', '<', 0.0)],
|
||||||
data_credit[account_amount['account_id'][0]] += account_amount['amount']
|
fields=['account_id', 'amount'],
|
||||||
|
groupby=['account_id']
|
||||||
|
)
|
||||||
|
data_debit = {l['account_id'][0]: l['amount'] for l in debit_groups}
|
||||||
|
|
||||||
for account in self:
|
for account in self:
|
||||||
account.debit = abs(data_debit.get(account.id, 0.0))
|
account.debit = abs(data_debit.get(account.id, 0.0))
|
||||||
|
|||||||
@@ -289,7 +289,9 @@ class AccountFrFec(models.TransientModel):
|
|||||||
END
|
END
|
||||||
AS PieceRef,
|
AS PieceRef,
|
||||||
TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate,
|
TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate,
|
||||||
CASE WHEN aml.name IS NULL THEN '/' ELSE replace(aml.name, '|', '/') END AS EcritureLib,
|
CASE WHEN aml.name IS NULL THEN '/'
|
||||||
|
WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/'
|
||||||
|
ELSE replace(aml.name, '|', '/') END AS EcritureLib,
|
||||||
replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '000000000000000D99') END, '.', ',') AS Debit,
|
replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '000000000000000D99') END, '.', ',') AS Debit,
|
||||||
replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '000000000000000D99') END, '.', ',') AS Credit,
|
replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '000000000000000D99') END, '.', ',') AS Credit,
|
||||||
CASE WHEN rec.name IS NULL THEN '' ELSE rec.name END AS EcritureLet,
|
CASE WHEN rec.name IS NULL THEN '' ELSE rec.name END AS EcritureLet,
|
||||||
|
|||||||
@@ -2103,6 +2103,11 @@ msgstr ""
|
|||||||
msgid "Quantity To Produce"
|
msgid "Quantity To Produce"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: mrp
|
||||||
|
#: model:ir.model.fields,field_description:mrp.field_stock_move_quantity_done_store
|
||||||
|
msgid "Quantity done store"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: mrp
|
#. module: mrp
|
||||||
#: model:ir.model.fields,field_description:mrp.field_mrp_routing_workcenter_batch_size
|
#: model:ir.model.fields,field_description:mrp.field_mrp_routing_workcenter_batch_size
|
||||||
msgid "Quantity to Process"
|
msgid "Quantity to Process"
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class StockMove(models.Model):
|
|||||||
quantity_available = fields.Float(
|
quantity_available = fields.Float(
|
||||||
'Quantity Available', compute="_qty_available",
|
'Quantity Available', compute="_qty_available",
|
||||||
digits=dp.get_precision('Product Unit of Measure'))
|
digits=dp.get_precision('Product Unit of Measure'))
|
||||||
quantity_done_store = fields.Float('Quantity', digits=0)
|
quantity_done_store = fields.Float('Quantity done store', digits=0)
|
||||||
quantity_done = fields.Float(
|
quantity_done = fields.Float(
|
||||||
'Quantity', compute='_qty_done_compute', inverse='_qty_done_set',
|
'Quantity', compute='_qty_done_compute', inverse='_qty_done_set',
|
||||||
digits=dp.get_precision('Product Unit of Measure'))
|
digits=dp.get_precision('Product Unit of Measure'))
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ exports.PosModel = Backbone.Model.extend({
|
|||||||
// we attribute a role to the user, 'cashier' or 'manager', depending
|
// we attribute a role to the user, 'cashier' or 'manager', depending
|
||||||
// on the group the user belongs.
|
// on the group the user belongs.
|
||||||
var pos_users = [];
|
var pos_users = [];
|
||||||
|
var current_cashier = self.get_cashier();
|
||||||
for (var i = 0; i < users.length; i++) {
|
for (var i = 0; i < users.length; i++) {
|
||||||
var user = users[i];
|
var user = users[i];
|
||||||
for (var j = 0; j < user.groups_id.length; j++) {
|
for (var j = 0; j < user.groups_id.length; j++) {
|
||||||
@@ -272,6 +273,8 @@ exports.PosModel = Backbone.Model.extend({
|
|||||||
// replace the current user with its updated version
|
// replace the current user with its updated version
|
||||||
if (user.id === self.user.id) {
|
if (user.id === self.user.id) {
|
||||||
self.user = user;
|
self.user = user;
|
||||||
|
}
|
||||||
|
if (user.id === current_cashier.id) {
|
||||||
self.set_cashier(user);
|
self.set_cashier(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,12 +252,20 @@ function get_file(options) {
|
|||||||
if (options.error) {
|
if (options.error) {
|
||||||
var body = this.contentDocument.body;
|
var body = this.contentDocument.body;
|
||||||
var nodes = body.children.length === 0 ? body.childNodes : body.children;
|
var nodes = body.children.length === 0 ? body.childNodes : body.children;
|
||||||
options.error({
|
var errorParams = {};
|
||||||
message: nodes.length > 1 ? nodes[1].textContent : '',
|
|
||||||
data: {
|
try { // Case of a serialized Odoo Exception: It is Json Parsable
|
||||||
title: nodes.length > 0 ? nodes[0].textContent : '',
|
var node = nodes[1] || nodes[0];
|
||||||
},
|
errorParams = JSON.parse(node.textContent);
|
||||||
});
|
} catch (e) { // Arbitrary uncaught python side exception
|
||||||
|
errorParams = {
|
||||||
|
message: nodes.length > 1 ? nodes[1].textContent : '',
|
||||||
|
data: {
|
||||||
|
title: nodes.length > 0 ? nodes[0].textContent : '',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options.error(errorParams);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
complete();
|
complete();
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ def redirect_with_hash(url, code=303):
|
|||||||
# See extensive test page at http://greenbytes.de/tech/tc/httpredirects/
|
# See extensive test page at http://greenbytes.de/tech/tc/httpredirects/
|
||||||
if request.httprequest.user_agent.browser in ('firefox',):
|
if request.httprequest.user_agent.browser in ('firefox',):
|
||||||
return werkzeug.utils.redirect(url, code)
|
return werkzeug.utils.redirect(url, code)
|
||||||
|
url = url.strip()
|
||||||
if urlparse.urlparse(url, scheme='http').scheme not in ('http', 'https'):
|
if urlparse.urlparse(url, scheme='http').scheme not in ('http', 'https'):
|
||||||
url = 'http://' + url
|
url = 'http://' + url
|
||||||
url = url.replace("'", "%27").replace("<", "%3C")
|
url = url.replace("'", "%27").replace("<", "%3C")
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class Registry(Mapping):
|
|||||||
# Indicates that the registry is
|
# Indicates that the registry is
|
||||||
self.ready = False
|
self.ready = False
|
||||||
|
|
||||||
# Inter-process signaling (used only when odoo.multi_process is True):
|
# Inter-process signaling:
|
||||||
# The `base_registry_signaling` sequence indicates the whole registry
|
# The `base_registry_signaling` sequence indicates the whole registry
|
||||||
# must be reloaded.
|
# must be reloaded.
|
||||||
# The `base_cache_signaling sequence` indicates all caches must be
|
# The `base_cache_signaling sequence` indicates all caches must be
|
||||||
@@ -357,7 +357,7 @@ class Registry(Mapping):
|
|||||||
|
|
||||||
def setup_signaling(self):
|
def setup_signaling(self):
|
||||||
""" Setup the inter-process signaling on this registry. """
|
""" Setup the inter-process signaling on this registry. """
|
||||||
if not odoo.multi_process:
|
if self.in_test_mode():
|
||||||
return
|
return
|
||||||
|
|
||||||
with self.cursor() as cr:
|
with self.cursor() as cr:
|
||||||
@@ -383,7 +383,7 @@ class Registry(Mapping):
|
|||||||
""" Check whether the registry has changed, and performs all necessary
|
""" Check whether the registry has changed, and performs all necessary
|
||||||
operations to update the registry. Return an up-to-date registry.
|
operations to update the registry. Return an up-to-date registry.
|
||||||
"""
|
"""
|
||||||
if not odoo.multi_process:
|
if self.in_test_mode():
|
||||||
return self
|
return self
|
||||||
|
|
||||||
with closing(self.cursor()) as cr:
|
with closing(self.cursor()) as cr:
|
||||||
@@ -409,7 +409,7 @@ class Registry(Mapping):
|
|||||||
|
|
||||||
def signal_registry_change(self):
|
def signal_registry_change(self):
|
||||||
""" Notifies other processes that the registry has changed. """
|
""" Notifies other processes that the registry has changed. """
|
||||||
if odoo.multi_process:
|
if not self.in_test_mode():
|
||||||
_logger.info("Registry changed, signaling through the database")
|
_logger.info("Registry changed, signaling through the database")
|
||||||
with closing(self.cursor()) as cr:
|
with closing(self.cursor()) as cr:
|
||||||
cr.execute("select nextval('base_registry_signaling')")
|
cr.execute("select nextval('base_registry_signaling')")
|
||||||
@@ -417,7 +417,7 @@ class Registry(Mapping):
|
|||||||
|
|
||||||
def signal_caches_change(self):
|
def signal_caches_change(self):
|
||||||
""" Notifies other processes if caches have been invalidated. """
|
""" Notifies other processes if caches have been invalidated. """
|
||||||
if odoo.multi_process and self.cache_cleared:
|
if self.cache_cleared and not self.in_test_mode():
|
||||||
# signal it through the database to other processes
|
# signal it through the database to other processes
|
||||||
_logger.info("At least one model cache has been invalidated, signaling through the database.")
|
_logger.info("At least one model cache has been invalidated, signaling through the database.")
|
||||||
with closing(self.cursor()) as cr:
|
with closing(self.cursor()) as cr:
|
||||||
|
|||||||
@@ -91,9 +91,6 @@ class RequestHandler(werkzeug.serving.WSGIRequestHandler):
|
|||||||
me = threading.currentThread()
|
me = threading.currentThread()
|
||||||
me.name = 'odoo.service.http.request.%s' % (me.ident,)
|
me.name = 'odoo.service.http.request.%s' % (me.ident,)
|
||||||
|
|
||||||
# _reexec() should set LISTEN_* to avoid connection refused during reload time. It
|
|
||||||
# should also work with systemd socket activation. This is currently untested
|
|
||||||
# and not yet used.
|
|
||||||
|
|
||||||
class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer):
|
class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer):
|
||||||
""" werkzeug Threaded WSGI Server patched to allow reusing a listen socket
|
""" werkzeug Threaded WSGI Server patched to allow reusing a listen socket
|
||||||
@@ -105,14 +102,15 @@ class ThreadedWSGIServerReloadable(LoggingBaseWSGIServerMixIn, werkzeug.serving.
|
|||||||
handler=RequestHandler)
|
handler=RequestHandler)
|
||||||
|
|
||||||
def server_bind(self):
|
def server_bind(self):
|
||||||
envfd = os.environ.get('LISTEN_FDS')
|
SD_LISTEN_FDS_START = 3
|
||||||
if envfd and os.environ.get('LISTEN_PID') == str(os.getpid()):
|
if os.environ.get('LISTEN_FDS') == '1' and os.environ.get('LISTEN_PID') == str(os.getpid()):
|
||||||
self.reload_socket = True
|
self.reload_socket = True
|
||||||
self.socket = socket.fromfd(int(envfd), socket.AF_INET, socket.SOCK_STREAM)
|
self.socket = socket.fromfd(SD_LISTEN_FDS_START, socket.AF_INET, socket.SOCK_STREAM)
|
||||||
# should we os.close(int(envfd)) ? it seem python duplicate the fd.
|
_logger.info('HTTP service (werkzeug) running through socket activation')
|
||||||
else:
|
else:
|
||||||
self.reload_socket = False
|
self.reload_socket = False
|
||||||
super(ThreadedWSGIServerReloadable, self).server_bind()
|
super(ThreadedWSGIServerReloadable, self).server_bind()
|
||||||
|
_logger.info('HTTP service (werkzeug) running on %s:%s', self.server_name, self.server_port)
|
||||||
|
|
||||||
def server_activate(self):
|
def server_activate(self):
|
||||||
if not self.reload_socket:
|
if not self.reload_socket:
|
||||||
@@ -251,7 +249,6 @@ class ThreadedServer(CommonServer):
|
|||||||
t = threading.Thread(target=self.http_thread, name="odoo.service.httpd")
|
t = threading.Thread(target=self.http_thread, name="odoo.service.httpd")
|
||||||
t.setDaemon(True)
|
t.setDaemon(True)
|
||||||
t.start()
|
t.start()
|
||||||
_logger.info('HTTP service (werkzeug) running on %s:%s', self.interface, self.port)
|
|
||||||
|
|
||||||
def start(self, stop=False):
|
def start(self, stop=False):
|
||||||
_logger.debug("Setting signal handlers")
|
_logger.debug("Setting signal handlers")
|
||||||
@@ -867,7 +864,8 @@ def _reexec(updated_modules=None):
|
|||||||
args += ["-u", ','.join(updated_modules)]
|
args += ["-u", ','.join(updated_modules)]
|
||||||
if not args or args[0] != exe:
|
if not args or args[0] != exe:
|
||||||
args.insert(0, exe)
|
args.insert(0, exe)
|
||||||
os.execv(sys.executable, args)
|
# We should keep the LISTEN_* environment variabled in order to support socket activation on reexec
|
||||||
|
os.execve(sys.executable, args, os.environ)
|
||||||
|
|
||||||
def load_test_file_yml(registry, test_file):
|
def load_test_file_yml(registry, test_file):
|
||||||
with registry.cursor() as cr:
|
with registry.cursor() as cr:
|
||||||
|
|||||||
Reference in New Issue
Block a user