diff --git a/addons/account/account.py b/addons/account/account.py
index a5b170a9e46..7c84a164b9c 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 @@
-
-
-
+
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 5e98bcba49e..41b3fbbf253 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 @@
[('warehouse_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])]
+
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 17eb0f69bd5..262b20a3fe7 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -671,7 +671,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.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;
diff --git a/addons/product/product.py b/addons/product/product.py
index 2110f243a70..f64529982a8 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -790,7 +790,7 @@ class product_product(osv.osv):
if not limit or len(ids) < limit:
# we may underrun the limit because of dupes in the results, that's fine
limit2 = (limit - len(ids)) if limit else False
- ids.update(self.search(cr, user, args + [('name', operator, name)], limit=limit2, context=context))
+ ids.update(self.search(cr, user, args + [('name', operator, name), ('id', 'not in', list(ids))], limit=limit2, 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)
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 8365739a3e9..475a4960239 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -474,7 +474,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
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index e075c172b03..34b72c56630 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2340,6 +2340,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 \
@@ -2371,7 +2374,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.
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index 6b665262f2c..9f11fdf7412 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -1521,7 +1521,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(
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 5607b8aa496..11ca49ead47 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -4109,7 +4109,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;