commit
f47ef74041
|
@ -18,14 +18,14 @@ class ActivityStatement(models.AbstractModel):
|
|||
self._cr.mogrify(
|
||||
"""
|
||||
SELECT l.partner_id, l.currency_id, l.company_id,
|
||||
CASE WHEN l.currency_id is not null AND l.amount_currency > 0.0
|
||||
THEN sum(l.amount_currency)
|
||||
ELSE sum(l.debit)
|
||||
END as debit,
|
||||
CASE WHEN l.currency_id is not null AND l.amount_currency < 0.0
|
||||
THEN sum(l.amount_currency * (-1))
|
||||
ELSE sum(l.credit)
|
||||
END as credit
|
||||
sum(CASE WHEN l.currency_id is not null AND l.amount_currency > 0.0
|
||||
THEN l.amount_currency
|
||||
ELSE l.debit
|
||||
END) as debit,
|
||||
sum(CASE WHEN l.currency_id is not null AND l.amount_currency < 0.0
|
||||
THEN l.amount_currency * (-1)
|
||||
ELSE l.credit
|
||||
END) as credit
|
||||
FROM account_move_line l
|
||||
JOIN account_account aa ON (aa.id = l.account_id)
|
||||
JOIN account_account_type at ON (at.id = aa.user_type_id)
|
||||
|
@ -34,7 +34,7 @@ class ActivityStatement(models.AbstractModel):
|
|||
AND at.type = %(account_type)s
|
||||
AND l.date < %(date_start)s AND not l.blocked
|
||||
AND m.state IN ('posted')
|
||||
GROUP BY l.partner_id, l.currency_id, l.amount_currency, l.company_id
|
||||
GROUP BY l.partner_id, l.currency_id, l.company_id
|
||||
""",
|
||||
locals(),
|
||||
),
|
||||
|
@ -94,14 +94,14 @@ class ActivityStatement(models.AbstractModel):
|
|||
ELSE ''
|
||||
END as ref,
|
||||
l.blocked, l.currency_id, l.company_id,
|
||||
CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0)
|
||||
THEN sum(l.amount_currency)
|
||||
ELSE sum(l.debit)
|
||||
END as debit,
|
||||
CASE WHEN (l.currency_id is not null AND l.amount_currency < 0.0)
|
||||
THEN sum(l.amount_currency * (-1))
|
||||
ELSE sum(l.credit)
|
||||
END as credit,
|
||||
sum(CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0)
|
||||
THEN l.amount_currency
|
||||
ELSE l.debit
|
||||
END) as debit,
|
||||
sum(CASE WHEN (l.currency_id is not null AND l.amount_currency < 0.0)
|
||||
THEN l.amount_currency * (-1)
|
||||
ELSE l.credit
|
||||
END) as credit,
|
||||
CASE WHEN l.date_maturity is null
|
||||
THEN l.date
|
||||
ELSE l.date_maturity
|
||||
|
@ -130,7 +130,7 @@ class ActivityStatement(models.AbstractModel):
|
|||
THEN 'Payment'
|
||||
ELSE ''
|
||||
END,
|
||||
l.blocked, l.currency_id, l.amount_currency, l.company_id
|
||||
l.blocked, l.currency_id, l.company_id
|
||||
""",
|
||||
locals(),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue