summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-12-12 15:35:11 +0100
committerChristophe Simonis <chs@odoo.com>2017-12-12 15:35:11 +0100
commit5701010d0ddbc9fb09ccc9262e83ac3ca6935a4e (patch)
tree4b0b519a12e5149f896e66519ec7c428dd6e6e51
parent791e0cf47a84d7c3bd4cfb6404144f9aff2ca78c (diff)
parent744c2934b3ad748c41a0b3a97272d38a75b14e76 (diff)
[MERGE] forward port branch saas-14 up to 744c2934b3a
-rw-r--r--addons/account/models/account_invoice.py3
-rw-r--r--addons/product_extended/models/product.py10
-rw-r--r--addons/purchase/models/account_invoice.py7
-rw-r--r--addons/stock/models/stock_location.py12
-rw-r--r--addons/stock/models/stock_move.py7
-rw-r--r--addons/website_portal/controllers/main.py2
-rw-r--r--odoo/addons/base/ir/ir_qweb/assetsbundle.py3
-rw-r--r--odoo/fields.py6
8 files changed, 31 insertions, 19 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py
index b6eb9f69efa..92860df9ece 100644
--- a/addons/account/models/account_invoice.py
+++ b/addons/account/models/account_invoice.py
@@ -1331,9 +1331,6 @@ class AccountInvoiceLine(models.Model):
self.price_unit = 0.0
domain['uom_id'] = []
else:
- # Use the purchase uom by default
- self.uom_id = self.product_id.uom_po_id
-
if part.lang:
product = self.product_id.with_context(lang=part.lang)
else:
diff --git a/addons/product_extended/models/product.py b/addons/product_extended/models/product.py
index f0f886b66d4..0efd659dd79 100644
--- a/addons/product_extended/models/product.py
+++ b/addons/product_extended/models/product.py
@@ -41,10 +41,12 @@ class ProductProduct(models.Model):
# No attribute_value_ids means the bom line is not variant specific
price += sbom.product_id.uom_id._compute_price(sbom.product_id.standard_price, sbom.product_uom_id) * sbom_data['qty']
if bom.routing_id:
- total_cost = 0.0
- for order in bom.routing_id.operation_ids:
- total_cost += (order.time_cycle/60) * order.workcenter_id.costs_hour
- price += bom.product_uom_id._compute_price(total_cost, bom.product_id.uom_id)
+ # FIXME master: remove me
+ if hasattr(self.env['mrp.workcenter'], 'costs_hour'):
+ total_cost = 0.0
+ for order in bom.routing_id.operation_ids:
+ total_cost += (order.time_cycle/60) * order.workcenter_id.costs_hour
+ price += bom.product_uom_id._compute_price(total_cost, bom.product_id.uom_id)
# Convert on product UoM quantities
if price > 0:
price = bom.product_uom_id._compute_price(price / bom.product_qty, self.uom_id)
diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py
index e068a788e6a..ec35351ddd0 100644
--- a/addons/purchase/models/account_invoice.py
+++ b/addons/purchase/models/account_invoice.py
@@ -59,6 +59,13 @@ class AccountInvoice(models.Model):
data['account_id'] = account.id
return data
+ def _onchange_product_id(self):
+ domain = super(AccountInvoice, self)._onchange_product_id()
+ if self.purchase_id:
+ # Use the purchase uom by default
+ self.uom_id = self.product_id.uom_po_id
+ return domain
+
# Load all unsold PO lines
@api.onchange('purchase_id')
def purchase_order_change(self):
diff --git a/addons/stock/models/stock_location.py b/addons/stock/models/stock_location.py
index afc0ae9f1c8..221d0532cb1 100644
--- a/addons/stock/models/stock_location.py
+++ b/addons/stock/models/stock_location.py
@@ -70,15 +70,13 @@ class Location(models.Model):
_sql_constraints = [('barcode_company_uniq', 'unique (barcode,company_id)', 'The barcode for a location must be unique per company !')]
@api.one
- @api.depends('name', 'location_id.name')
+ @api.depends('name', 'location_id.complete_name')
def _compute_complete_name(self):
""" Forms complete name of location from parent location to child location. """
- name = self.name
- current = self
- while current.location_id:
- current = current.location_id
- name = '%s/%s' % (current.name, name)
- self.complete_name = name
+ if self.location_id.complete_name:
+ self.complete_name = '%s/%s' % (self.location_id.complete_name, self.name)
+ else:
+ self.complete_name = self.name
@api.multi
def name_get(self):
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py
index 44967fb6901..b632c65fd72 100644
--- a/addons/stock/models/stock_move.py
+++ b/addons/stock/models/stock_move.py
@@ -179,10 +179,13 @@ class StockMove(models.Model):
else:
self.lot_ids = self.mapped('reserved_quant_ids').mapped('lot_id').ids
- @api.one
+ @api.multi
@api.depends('reserved_quant_ids.qty')
def _compute_reserved_availability(self):
- self.reserved_availability = sum(self.mapped('reserved_quant_ids').mapped('qty'))
+ result = {data['reservation_id'][0]: data['qty'] for data in
+ self.env['stock.quant'].read_group([('reservation_id', 'in', self.ids)], ['reservation_id','qty'], ['reservation_id'])}
+ for rec in self:
+ rec.reserved_availability = result.get(rec.id, 0.0)
@api.one
@api.depends('state', 'product_id', 'product_qty', 'location_id')
diff --git a/addons/website_portal/controllers/main.py b/addons/website_portal/controllers/main.py
index 5aac2b4b2e3..ea74d9c8107 100644
--- a/addons/website_portal/controllers/main.py
+++ b/addons/website_portal/controllers/main.py
@@ -121,6 +121,8 @@ class website_account(http.Controller):
# vat validation
if data.get("vat") and hasattr(request.env["res.partner"], "check_vat"):
+ if data.get("country_id"):
+ data["vat"] = request.env["res.partner"].fix_eu_vat_number(int(data.get("country_id")), data.get("vat"))
if request.website.company_id.sudo().vat_check_vies:
# force full VIES online check
check_func = request.env["res.partner"].vies_vat_check
diff --git a/odoo/addons/base/ir/ir_qweb/assetsbundle.py b/odoo/addons/base/ir/ir_qweb/assetsbundle.py
index 47a7cd1b8b8..3c11e9d0bc0 100644
--- a/odoo/addons/base/ir/ir_qweb/assetsbundle.py
+++ b/odoo/addons/base/ir/ir_qweb/assetsbundle.py
@@ -198,12 +198,15 @@ class AssetsBundle(object):
return self.env['ir.attachment'].sudo().browse(attachment_ids)
def save_attachment(self, type, content, inc=None):
+ assert type in ('js', 'css')
ira = self.env['ir.attachment']
fname = '%s%s.%s' % (self.name, ('' if inc is None else '.%s' % inc), type)
+ mimetype = 'application/javascript' if type == 'js' else 'text/css'
values = {
'name': "/web/content/%s" % type,
'datas_fname': fname,
+ 'mimetype' : mimetype,
'res_model': 'ir.ui.view',
'res_id': False,
'type': 'binary',
diff --git a/odoo/fields.py b/odoo/fields.py
index 3f32f68a765..861eee4132b 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -974,11 +974,11 @@ class Field(object):
spec = self.modified_draft(record)
# set value in cache, inverse field, and mark record as dirty
- record._cache[self] = value
+ env.cache[self][record.id] = value
if env.in_onchange:
for invf in record._field_inverses[self]:
invf._update(record[self.name], record)
- record._set_dirty(self.name)
+ env.dirty[record].add(self.name)
# determine more dependent fields, and invalidate them
if self.relational:
@@ -991,7 +991,7 @@ class Field(object):
record.write({self.name: write_value})
# Update the cache unless value contains a new record
if not (self.relational and not all(value)):
- record._cache[self] = value
+ env.cache[self][record.id] = value
############################################################################
#