[MERGE] forward port branch 10.0 up to 0f0c5db49d

This commit is contained in:
Christophe Simonis
2019-03-04 12:02:31 +01:00
4 changed files with 26 additions and 3 deletions
@@ -1472,6 +1472,8 @@ td {
body { body {
margin: 0; margin: 0;
color: white !important; color: white !important;
/* avoid black background if backgrounds are printed */
background: initial;
} }
.oe_leftbar, .oe_leftbar,
.oe_loading, .oe_loading,
+19
View File
@@ -4,6 +4,7 @@
from odoo import api, fields, models, _ from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError from odoo.exceptions import UserError
from odoo.osv import expression
from odoo.tools.float_utils import float_round from odoo.tools.float_utils import float_round
from datetime import datetime from datetime import datetime
import operator as py_operator import operator as py_operator
@@ -370,6 +371,15 @@ class Product(models.Model):
def action_view_routes(self): def action_view_routes(self):
return self.mapped('product_tmpl_id').action_view_routes() return self.mapped('product_tmpl_id').action_view_routes()
@api.model
def search(self, domain=None, *args, **kwargs):
# ONLY FOR 10.0 UP TO SAAS-15
# ignore dummy fields used for search context²
for index in range(len(domain or [])):
if domain[index][0] in ('location_id', 'warehouse_id'):
domain[index] = expression.TRUE_LEAF
return super(Product, self).search(domain, *args, **kwargs)
@api.multi @api.multi
def write(self, values): def write(self, values):
res = super(Product, self).write(values) res = super(Product, self).write(values)
@@ -507,6 +517,15 @@ class ProductTemplate(models.Model):
def onchange_tracking(self): def onchange_tracking(self):
return self.mapped('product_variant_ids').onchange_tracking() return self.mapped('product_variant_ids').onchange_tracking()
@api.model
def search(self, domain=None, *args, **kwargs):
# ONLY FOR 10.0 UP TO SAAS-15
# ignore dummy fields used for search context
for index in range(len(domain or [])):
if domain[index][0] in ('location_id', 'warehouse_id'):
domain[index] = expression.TRUE_LEAF
return super(ProductTemplate, self).search(domain, *args, **kwargs)
@api.multi @api.multi
def write(self, vals): def write(self, vals):
if 'uom_id' in vals: if 'uom_id' in vals:
+2 -2
View File
@@ -193,8 +193,8 @@ class StockMove(models.Model):
if self.state == 'done': if self.state == 'done':
self.availability = self.product_qty self.availability = self.product_qty
else: else:
quants = self.env['stock.quant'].search([('location_id', 'child_of', self.location_id.id), ('product_id', '=', self.product_id.id), ('reservation_id', '=', False)]) qty_tot = self.env['stock.quant'].read_group([('location_id', 'child_of', self.location_id.id), ('product_id', '=', self.product_id.id), ('reservation_id', '=', False)], ['qty'], [])[0]
self.availability = min(self.product_qty, sum(quants.mapped('qty'))) self.availability = min(self.product_qty, qty_tot['qty'] or 0)
@api.multi @api.multi
def _compute_string_qty_information(self): def _compute_string_qty_information(self):
+3 -1
View File
@@ -20,6 +20,8 @@ except ImportError:
import logging import logging
from odoo.tools.parse_version import parse_version
unsafe_eval = eval unsafe_eval = eval
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -146,7 +148,7 @@ class QWebException(Exception):
return str(self) return str(self)
# Avoid DeprecationWarning while still remaining compatible with werkzeug pre-0.9 # Avoid DeprecationWarning while still remaining compatible with werkzeug pre-0.9
escape = (lambda text: _escape(text, quote=True)) if getattr(werkzeug, '__version__', '0.0') < '0.9.0' else _escape escape = (lambda text: _escape(text, quote=True)) if parse_version(getattr(werkzeug, '__version__', '0.0')) < parse_version('0.9.0') else _escape
def unicodifier(val): def unicodifier(val):
if val is None or val is False: if val is None or val is False: