diff --git a/addons/account/models/account_analytic_line.py b/addons/account/models/account_analytic_line.py index 83faccaa15c..c5c0d5ed746 100644 --- a/addons/account/models/account_analytic_line.py +++ b/addons/account/models/account_analytic_line.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from openerp import api, fields, models, _ +from math import copysign class AccountAnalyticLine(models.Model): @@ -20,8 +21,12 @@ class AccountAnalyticLine(models.Model): help='Utility field to express amount currency') currency_id = fields.Many2one('res.currency', related='move_id.currency_id', string='Account Currency', store=True, help="The related account currency if not equal to the company one.", readonly=True) amount_currency = fields.Monetary(related='move_id.amount_currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True) + analytic_amount_currency = fields.Monetary(string='Amount Currency', compute="_get_analytic_amount_currency", help="The amount expressed in the related account currency if not equal to the company one.", readonly=True) partner_id = fields.Many2one('res.partner', related='account_id.partner_id', string='Partner', store=True, readonly=True) + def _get_analytic_amount_currency(self): + self.analytic_amount_currency = abs(self.amount_currency) * copysign(1, self.amount) + @api.v8 @api.onchange('product_id', 'product_uom_id', 'unit_amount', 'currency_id') def on_change_unit_amount(self): diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 0deff04529b..e07cada8e2e 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1263,7 +1263,7 @@ class AccountMoveLine(models.Model): """ Prepare the values used to create() an account.analytic.line upon validation of an account.move.line having an analytic account. This method is intended to be extended in other modules. """ - amount = (self.debit or 0.0) - (self.credit or 0.0) + amount = (self.credit or 0.0) - (self.debit or 0.0) return { 'name': self.name, 'date': self.date, diff --git a/addons/account/views/account_analytic_view.xml b/addons/account/views/account_analytic_view.xml index 8b4af3f9bcf..71a3d48ad7b 100644 --- a/addons/account/views/account_analytic_view.xml +++ b/addons/account/views/account_analytic_view.xml @@ -15,7 +15,8 @@ - + + diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 09f270c3b3d..58bc567625c 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -280,7 +280,7 @@ var ScaleScreenWidget = ScreenWidget.extend({ return self.pos.proxy.scale_read().then(function(weight){ self.set_weight(weight.weight); }); - },{duration:50, repeat: true}); + },{duration:150, repeat: true}); }, get_product: function(){ diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py index a27f8bfdb05..3c4c9d5f4ce 100644 --- a/addons/sale_mrp/sale_mrp.py +++ b/addons/sale_mrp/sale_mrp.py @@ -90,5 +90,5 @@ class AccountInvoiceLine(models.Model): prod_quantity = factor * quantity average_price_unit += self._compute_average_price(prod_qty_done, prod_quantity, prod_moves) price_unit = average_price_unit or price_unit - price_unit = uom_obj._compute_qty_obj(self.uom_id, price_unit, self.product_id.uom_id, round=False) + price_unit = self.product_id.uom_id._compute_price(self.product_id.uom_id.id, price_unit, to_uom_id=self.uom_id.id) return price_unit diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 718dd84da55..bc107a37a00 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -379,7 +379,7 @@ class AccountInvoiceLine(models.Model): # on the moves we encounter. average_price_unit = self._compute_average_price(qty_done, quantity, moves) price_unit = average_price_unit or price_unit - price_unit = uom_obj._compute_qty_obj(self.uom_id, price_unit, self.product_id.uom_id, round=False) + price_unit = self.product_id.uom_id._compute_price(self.product_id.uom_id.id, price_unit, to_uom_id=self.uom_id.id) return price_unit def _compute_average_price(self, qty_done, quantity, moves): diff --git a/addons/stock/models/stock_location.py b/addons/stock/models/stock_location.py index 5763903b071..f71f82df366 100644 --- a/addons/stock/models/stock_location.py +++ b/addons/stock/models/stock_location.py @@ -25,7 +25,6 @@ class Location(models.Model): return res name = fields.Char('Location Name', required=True, translate=True) - # TDE CLEAME: unnecessary field, use name_get instead complete_name = fields.Char("Full Location Name", compute='_compute_complete_name', store=True) active = fields.Boolean('Active', default=True, help="By unchecking the active field, you may hide a location without deleting it.") usage = fields.Selection([ @@ -75,14 +74,22 @@ class Location(models.Model): """ Forms complete name of location from parent location to child location. """ name = self.name current = self - while current.location_id and current.usage != 'view': + while current.location_id: current = current.location_id name = '%s/%s' % (current.name, name) self.complete_name = name @api.multi def name_get(self): - return [(location.id, location.complete_name) for location in self] + ret_list = [] + for location in self: + orig_location = location + name = location.name + while location.location_id and location.usage != 'view': + location = location.location_id + name = location.name + "/" + name + ret_list.append((orig_location.id, name)) + return ret_list def get_putaway_strategy(self, product): ''' Returns the location where the product has to be put, if any compliant putaway strategy is found. Otherwise returns None.''' diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 51b22be1e8e..1c450e90411 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -869,7 +869,7 @@ class Picking(models.Model): moves_reassign = any(x.origin_returned_move_id or x.move_orig_ids for x in picking.move_lines if x.state not in ['done', 'cancel']) if moves_reassign and picking.location_id.usage not in ("supplier", "production", "inventory"): # unnecessary to assign other quants than those involved with pack operations as they will be unreserved anyways. - picking.with_context(reserve_only_ops=True, no_state_change=True).rereserve_quants(move_ids=todo_moves.ids) + picking.with_context(reserve_only_ops=True, no_state_change=True).rereserve_quants(move_ids=picking.move_lines.ids) picking.do_recompute_remaining_quantities() # split move lines if needed diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index e92ae8a65c9..a76f468423d 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -202,6 +202,7 @@