From 3d97bddb638ec273877224bcc82ec38d62b3f2ec Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 24 Sep 2011 13:25:29 +0200 Subject: [PATCH] fix bzr revid: fp@tinyerp.com-20110924112529-o72j8k1lota6sm1s --- addons/sale/sale.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index f1efea38f50..f2f953398a2 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -479,6 +479,7 @@ class sale_order(osv.osv): picking_obj = self.pool.get('stock.picking') invoice = self.pool.get('account.invoice') obj_sale_order_line = self.pool.get('sale.order.line') + partner_currency = {} if context is None: context = {} # If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the @@ -486,6 +487,13 @@ class sale_order(osv.osv): if date_inv: context['date_inv'] = date_inv for o in self.browse(cr, uid, ids, context=context): + currency_id = o.pricelist_id.currency_id.id + if (o.partner_id.id in partner_currency) and (partner_currency[o.partner_id.id] <> currency_id): + raise osv.except_osv( + _('Error !'), + _('You cannot group sales having different currencies for the same partner.')) + + partner_currency[o.partner_id.id] = currency_id lines = [] for line in o.order_line: if line.invoiced: