diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-12-12 16:15:04 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-12-12 16:15:04 +0100 |
| commit | a2ea4ba095cd82adae4cac917aa2485d30c8071e (patch) | |
| tree | c98812e852122b4197c2995b666935115929347e /addons | |
| parent | d0d9196da406baba37d634dd78ac0e12e83f754d (diff) | |
| parent | 5701010d0ddbc9fb09ccc9262e83ac3ca6935a4e (diff) | |
[MERGE] forward port branch saas-15 up to 5701010d0dd
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_invoice.py | 3 | ||||
| -rw-r--r-- | addons/product_extended/models/product.py | 10 | ||||
| -rw-r--r-- | addons/purchase/models/account_invoice.py | 7 | ||||
| -rw-r--r-- | addons/stock/models/stock_location.py | 12 | ||||
| -rw-r--r-- | addons/stock/models/stock_move.py | 7 | ||||
| -rw-r--r-- | addons/website_portal/controllers/main.py | 2 |
6 files changed, 25 insertions, 16 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 7fdc8935f4b..b61fa11273d 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1339,9 +1339,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 |
