mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] multicurrency in communication
We add an aggregation level to aggregate credit_control_line by currency too. So communication (letter, mail) are aggregated by partner, level, currency
This commit is contained in:
@@ -83,11 +83,12 @@ class CreditCommunication(TransientModel):
|
||||
if not line_ids:
|
||||
return []
|
||||
comms = []
|
||||
sql = ("SELECT distinct partner_id, policy_level_id, credit_control_policy_level.level"
|
||||
sql = ("SELECT distinct partner_id, policy_level_id, "
|
||||
" credit_control_line.currency_id, credit_control_policy_level.level"
|
||||
" FROM credit_control_line JOIN credit_control_policy_level "
|
||||
" ON (credit_control_line.policy_level_id = credit_control_policy_level.id)"
|
||||
" WHERE credit_control_line.id in %s"
|
||||
" ORDER by credit_control_policy_level.level")
|
||||
" ORDER by credit_control_policy_level.level, credit_control_line.currency_id")
|
||||
|
||||
cr.execute(sql, (tuple(line_ids),))
|
||||
res = cr.dictfetchall()
|
||||
@@ -101,8 +102,6 @@ class CreditCommunication(TransientModel):
|
||||
data['partner_id'] = level_assoc['partner_id']
|
||||
data['current_policy_level'] = level_assoc['policy_level_id']
|
||||
comm_id = self.create(cr, uid, data, context=context)
|
||||
|
||||
|
||||
comms.append(self.browse(cr, uid, comm_id, context=context))
|
||||
return comms
|
||||
|
||||
|
||||
Reference in New Issue
Block a user