[MERGE] forward port branch 10.0 up to 219c93252f
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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')
|
||||
@@ -651,7 +654,7 @@ class StockMove(models.Model):
|
||||
if move.state != 'assigned' and not self.env.context.get('reserve_only_ops'):
|
||||
qty_already_assigned = move.reserved_availability
|
||||
qty = move.product_qty - qty_already_assigned
|
||||
|
||||
|
||||
quants = Quant.quants_get_preferred_domain(qty, move, domain=main_domain[move.id], preferred_domain_list=[])
|
||||
Quant.quants_reserve(quants, move)
|
||||
|
||||
|
||||
@@ -109,6 +109,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
|
||||
|
||||
+3
-3
@@ -935,11 +935,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:
|
||||
@@ -952,7 +952,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
|
||||
|
||||
############################################################################
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user