Browse Source

Merge PR #741 into 13.0

Signed-off-by AaronHForgeFlow
pull/744/merge
OCA-git-bot 4 years ago
parent
commit
6e0c909222
  1. 1
      partner_statement/readme/CONTRIBUTORS.rst
  2. 10
      partner_statement/report/activity_statement.py
  3. 13
      partner_statement/report/outstanding_statement.py
  4. 19
      partner_statement/views/activity_statement.xml
  5. 12
      partner_statement/views/outstanding_statement.xml

1
partner_statement/readme/CONTRIBUTORS.rst

@ -1,2 +1,3 @@
* Miquel Raïch <miquel.raich@forgeflow.com> * Miquel Raïch <miquel.raich@forgeflow.com>
* Graeme Gellatly <graeme@o4sb.com> * Graeme Gellatly <graeme@o4sb.com>
* Lois Rilo <lois.rilo@forgeflow.com>

10
partner_statement/report/activity_statement.py

@ -83,8 +83,11 @@ class ActivityStatement(models.AbstractModel):
THEN l.name THEN l.name
ELSE '/' ELSE '/'
END as name, END as name,
CASE WHEN (aj.type IN ('sale', 'purchase'))
CASE
WHEN (aj.type IN ('sale', 'purchase')) AND l.name IS NOT NULL
THEN l.ref THEN l.ref
WHEN aj.type IN ('sale', 'purchase') AND l.name IS NULL
THEN m.ref
WHEN (aj.type in ('bank', 'cash')) WHEN (aj.type in ('bank', 'cash'))
THEN 'Payment' THEN 'Payment'
ELSE '' ELSE ''
@ -115,8 +118,11 @@ class ActivityStatement(models.AbstractModel):
THEN l.name THEN l.name
ELSE '/' ELSE '/'
END, END,
CASE WHEN (aj.type IN ('sale', 'purchase'))
CASE
WHEN (aj.type IN ('sale', 'purchase')) AND l.name IS NOT NULL
THEN l.ref THEN l.ref
WHEN aj.type IN ('sale', 'purchase') AND l.name IS NULL
THEN m.ref
WHEN (aj.type in ('bank', 'cash')) WHEN (aj.type in ('bank', 'cash'))
THEN 'Payment' THEN 'Payment'
ELSE '' ELSE ''

13
partner_statement/report/outstanding_statement.py

@ -17,7 +17,11 @@ class OutstandingStatement(models.AbstractModel):
self._cr.mogrify( self._cr.mogrify(
""" """
SELECT m.name AS move_id, l.partner_id, l.date, l.name, SELECT m.name AS move_id, l.partner_id, l.date, l.name,
l.ref, l.blocked, l.currency_id, l.company_id,
l.blocked, l.currency_id, l.company_id,
CASE WHEN l.ref IS NOT NULL
THEN l.ref
ELSE m.ref
END as ref,
CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0) CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0)
THEN avg(l.amount_currency) THEN avg(l.amount_currency)
ELSE avg(l.debit) ELSE avg(l.debit)
@ -62,8 +66,11 @@ class OutstandingStatement(models.AbstractModel):
(pd.id IS NULL AND pc.id IS NULL) (pd.id IS NULL AND pc.id IS NULL)
) AND l.date <= %(date_end)s AND m.state IN ('posted') ) AND l.date <= %(date_end)s AND m.state IN ('posted')
GROUP BY l.partner_id, m.name, l.date, l.date_maturity, l.name, GROUP BY l.partner_id, m.name, l.date, l.date_maturity, l.name,
l.ref, l.blocked, l.currency_id,
l.balance, l.amount_currency, l.company_id
CASE WHEN l.ref IS NOT NULL
THEN l.ref
ELSE m.ref
END,
l.blocked, l.currency_id, l.balance, l.amount_currency, l.company_id
""", """,
locals(), locals(),
), ),

19
partner_statement/views/activity_statement.xml

@ -21,6 +21,10 @@
<strong>Date:</strong> <strong>Date:</strong>
<p t-esc="d['today']" class="m-0" /> <p t-esc="d['today']" class="m-0" />
</div> </div>
<div class="col-3 bm-2">
<strong>Partner Name:</strong>
<p t-field="o.name" class="m-0" />
</div>
<div t-if="o.ref" class="col-3 bm-2"> <div t-if="o.ref" class="col-3 bm-2">
<strong>Partner Code:</strong> <strong>Partner Code:</strong>
<p t-field="o.ref" class="m-0" /> <p t-field="o.ref" class="m-0" />
@ -80,12 +84,15 @@
</td> </td>
<td> <td>
<t t-if="line['name'] != '/'"> <t t-if="line['name'] != '/'">
<t t-if="not line['ref']">
<t t-if="not line['ref'] and line['name']">
<span t-esc="line['name']" /> <span t-esc="line['name']" />
</t> </t>
<t t-if="line['ref'] and not line['name']">
<span t-esc="line['ref']" />
</t>
<t t-if="line['ref'] and line['name']"> <t t-if="line['ref'] and line['name']">
<t <t
t-if="line['name'] not in line['ref']"
t-if="line['name'] not in line['ref'] or line['name'] == line['ref']"
> >
<span t-esc="line['name']" /> <span t-esc="line['name']" />
</t> </t>
@ -94,16 +101,10 @@
> >
<span t-esc="line['ref']" /> <span t-esc="line['ref']" />
</t> </t>
<t t-if="line['name'] == line['ref']">
<span t-esc="line['name']" />
</t>
</t> </t>
</t> </t>
<t t-if="line['name'] == '/'"> <t t-if="line['name'] == '/'">
<span
t-if="line['ref'] == 'Payment'"
>Payment</span>
<span t-else="" t-esc="line['ref']" />
<span t-esc="line['ref']" />
</t> </t>
</td> </td>
<td class="amount"> <td class="amount">

12
partner_statement/views/outstanding_statement.xml

@ -22,6 +22,10 @@
<strong>Date:</strong> <strong>Date:</strong>
<p t-esc="d['today']" class="m-0" /> <p t-esc="d['today']" class="m-0" />
</div> </div>
<div class="col-3 bm-2">
<strong>Partner Name:</strong>
<p t-field="o.name" class="m-0" />
</div>
<div t-if="o.ref" class="col-3 bm-2"> <div t-if="o.ref" class="col-3 bm-2">
<strong>Partner Code:</strong> <strong>Partner Code:</strong>
<p t-field="o.ref" class="m-0" /> <p t-field="o.ref" class="m-0" />
@ -71,9 +75,12 @@
<t t-if="not line['ref']"> <t t-if="not line['ref']">
<span t-esc="line['name']" /> <span t-esc="line['name']" />
</t> </t>
<t t-if="line['ref'] and not line['name']">
<span t-esc="line['ref']" />
</t>
<t t-if="line['ref'] and line['name']"> <t t-if="line['ref'] and line['name']">
<t <t
t-if="line['name'] not in line['ref']"
t-if="line['name'] not in line['ref'] or line['name'] == line['ref']"
> >
<span t-esc="line['name']" /> <span t-esc="line['name']" />
</t> </t>
@ -82,9 +89,6 @@
> >
<span t-esc="line['ref']" /> <span t-esc="line['ref']" />
</t> </t>
<t t-if="line['ref'] == line['name']">
<span t-esc="line['name']" />
</t>
</t> </t>
</t> </t>
<t t-if="line['name'] == '/'"> <t t-if="line['name'] == '/'">

Loading…
Cancel
Save