From 16a23041b25b6568f98e46e5f6323dea610c50a4 Mon Sep 17 00:00:00 2001 From: Ravi Gohil Date: Fri, 17 Oct 2014 19:00:49 +0530 Subject: [PATCH 1/8] [FIX] point_of_sale: fixed rounding issue for pos order when discount added(maintenance: 615322). --- addons/point_of_sale/static/src/js/models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index b7b36d05b4e..606ee1e78c0 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -494,7 +494,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal get_all_prices: function(){ var self = this; var currency_rounding = this.pos.get('currency').rounding; - var base = round_pr(this.get_quantity() * this.get_unit_price() * (1.0 - (this.get_discount() / 100.0)), currency_rounding); + var base = round_pr(round_pr(this.get_quantity() * this.get_unit_price(), currency_rounding) * (1.0 - (this.get_discount() / 100.0)), currency_rounding); var totalTax = base; var totalNoTax = base; From 69d60465ee67969d72210a61a9e23204d037378a Mon Sep 17 00:00:00 2001 From: Rifakat Haradwala Date: Wed, 22 Oct 2014 15:37:00 +0530 Subject: [PATCH 2/8] [FIX] web: date autocompletion should use user's locale search bar does not suggest date field format based on user's locale and always shows based on mmddyy using Date.parse, opw:615276 Note: starting in 9.0, datejs has been replaced by momentjs, so this problem should be solved in a better way. --- addons/web/static/src/js/search.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index c09661f430d..89cf5521db1 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1497,7 +1497,11 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst return instance.web.date_to_str(facetValue.get('value')); }, complete: function (needle) { - var d = Date.parse(needle); + try { + var d = instance.web.str_to_date(instance.web.parse_value(needle, {'widget': 'date'})); + } catch (e) { + return false; + } if (!d) { return $.when(null); } var date_string = instance.web.format_value(d, this.attrs); var label = _.str.sprintf(_.str.escapeHTML( From 1a826e07fe61b8e55291f207da81eddf55baf14b Mon Sep 17 00:00:00 2001 From: Samus CTO Date: Thu, 13 Nov 2014 16:23:08 +0100 Subject: [PATCH 3/8] [IMP] Speedup test account_assert_test.xml in account --- addons/account/account.py | 13 +++++++++++++ addons/account/account_assert_test.xml | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index a12b5bd1052..c1aca3ee8ec 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1157,6 +1157,19 @@ class account_move(osv.osv): _description = "Account Entry" _order = 'id desc' + def account_assert_balanced(self, cr, uid, context=None): + cr.execute("""\ + SELECT move_id + FROM account_move_line + WHERE state = 'valid' + GROUP BY move_id + HAVING abs(sum(debit) - sum(credit)) > 0.00001 + """) + assert len(cr.fetchall()) == 0, \ + "For all Journal Items, the state is valid implies that the sum " \ + "of credits equals the sum of debits" + return True + def account_move_prepare(self, cr, uid, journal_id, date=False, ref='', company_id=False, context=None): ''' Prepares and returns a dictionary of values, ready to be passed to create() based on the parameters received. diff --git a/addons/account/account_assert_test.xml b/addons/account/account_assert_test.xml index 88025514763..32e8afb1b50 100644 --- a/addons/account/account_assert_test.xml +++ b/addons/account/account_assert_test.xml @@ -1,8 +1,6 @@ - - - + From 7f4c4a5e8a94c4cea0700a3fcc928fa11fbdc96f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 13 Nov 2014 18:01:25 +0100 Subject: [PATCH 4/8] [IMP] purchase: error message linked to product, not company --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index d1bb845e38d..e6f4989c9a3 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -471,7 +471,7 @@ class purchase_order(osv.osv): if not acc_id: acc_id = po_line.product_id.categ_id.property_account_expense_categ.id if not acc_id: - raise osv.except_osv(_('Error!'), _('Define expense account for this company: "%s" (id:%d).') % (po_line.product_id.name, po_line.product_id.id,)) + raise osv.except_osv(_('Error!'), _('Define expense account for this product: "%s" (id:%d).') % (po_line.product_id.name, po_line.product_id.id,)) else: acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context=context).id fpos = po_line.order_id.fiscal_position or False From cf488682c82a320589b1241f4b6bd9d59018bfed Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 14 Nov 2014 11:10:15 +0100 Subject: [PATCH 5/8] [FIX] stock: multicompany reception When a picking is confirmed, the generated account.move(.line) should take the company, accounts, journals and period with the same company as the picking, not the one of the current user. This was problematic if a user in a company confirm a picking linked to a purchase order done in another company. For real time valuations, the generated accounting entries were mixing both companies. Fixes #3466 --- addons/stock/stock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 16565871de3..bd15c45e421 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2355,6 +2355,9 @@ class stock_move(osv.osv): context = {} src_company_ctx = dict(context,force_company=move.location_id.company_id.id) dest_company_ctx = dict(context,force_company=move.location_dest_id.company_id.id) + # do not take the company of the one of the user + # used to select the correct period + company_ctx = dict(context, company_id=move.company_id.id) account_moves = [] # Outgoing moves (or cross-company output part) if move.location_id.company_id \ @@ -2386,7 +2389,8 @@ class stock_move(osv.osv): { 'journal_id': j_id, 'line_id': move_lines, - 'ref': move.picking_id and move.picking_id.name}, context=context) + 'company_id': move.company_id.id, + 'ref': move.picking_id and move.picking_id.name}, context=company_ctx) def action_done(self, cr, uid, ids, context=None): """ Makes the move done and if all moves are done, it will finish the picking. From 5b2f13abdfed218db9098325061cd6b14eac0d3c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 14 Nov 2014 13:40:02 +0100 Subject: [PATCH 6/8] [FIX] product: more accurate name_search First, name_search searches on default_code, then, if the limit is not reached, it searches on the product name The results found from the default code search must be removed from the search domain when doing the search on the product name, to avoid having results already found by the search on the default_code opw-618015 --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index b70fa030dd0..ce5b9bacddf 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -691,7 +691,7 @@ class product_product(osv.osv): ids.update(self.search(cr, user, args + [('default_code',operator,name)], limit=limit, context=context)) if not limit or len(ids) < limit: # we may underrun the limit because of dupes in the results, that's fine - ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit and (limit-len(ids)) or False) , context=context)) + ids.update(self.search(cr, user, args + [('name',operator,name), ('id', 'not in', list(ids))], limit=(limit and (limit-len(ids)) or False) , context=context)) ids = list(ids) elif not ids and operator in expression.NEGATIVE_TERM_OPERATORS: ids = self.search(cr, user, args + ['&', ('default_code', operator, name), ('name', operator, name)], limit=limit, context=context) From 3613b74df37a5a0c7bc2479a4b18471e6036e0a9 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 14 Nov 2014 14:14:58 +0100 Subject: [PATCH 7/8] [FIX] point_of_sale: missing multi-company rule --- addons/point_of_sale/security/point_of_sale_security.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/point_of_sale/security/point_of_sale_security.xml b/addons/point_of_sale/security/point_of_sale_security.xml index 47cdf47fda4..4804dc20dc8 100644 --- a/addons/point_of_sale/security/point_of_sale_security.xml +++ b/addons/point_of_sale/security/point_of_sale_security.xml @@ -25,5 +25,11 @@ ['|',('shop_id.company_id','=',False),('shop_id.company_id','child_of',[user.company_id.id])] + + Point Of Sale Order Analysis multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + From da15c9d27b420e7643048dfab07aebcf94b92b4a Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 14 Nov 2014 15:49:39 +0100 Subject: [PATCH 8/8] [FIX] web: do not set the one2many dirty on field validation This rev. 06104ba553702b16878d52c5b8ab089355216a5e Added the dirty flag on the o2m field when the editor of the editable list was enabled (meaning that the editable list has been altered)) because the dirty flag was not set correctly by the one2many during the edition, at the time. It looks like this is now the case Besides, as now, we valid all the editable list of the form, wether or not the editable list was altered, we must not set the o2m as dirty anymore. --- addons/web/static/src/js/view_form.js | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 819920f89b3..be16faa309a 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3885,7 +3885,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ if (!this.fields_view || !this.editable()){ return true; } - this.o2m._dirty_flag = true; var r; return _.every(this.records.records, function(record){ r = record;