bzr revid: fp@tinyerp.com-20110924112529-o72j8k1lota6sm1s
This commit is contained in:
Fabien Pinckaers 2011-09-24 13:25:29 +02:00
parent a583b076bc
commit 3d97bddb63
1 changed files with 8 additions and 0 deletions

View File

@ -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: