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