Browse Source

[MIG] partner_statement: Migration to 14.0

pull/762/head
Rujia Liu 4 years ago
parent
commit
c7c13cd98f
  1. 3
      partner_statement/__manifest__.py
  2. 9
      partner_statement/report/activity_statement.py
  3. 9
      partner_statement/report/outstanding_statement.py
  4. 9
      partner_statement/report/report_statement_common.py
  5. 3
      partner_statement/security/ir.model.access.csv
  6. 16
      partner_statement/views/activity_statement.xml
  7. 16
      partner_statement/views/outstanding_statement.xml
  8. 70
      partner_statement/wizard/statement_wizard.xml

3
partner_statement/__manifest__.py

@ -3,7 +3,7 @@
{
"name": "Partner Statement",
"version": "13.0.1.1.0",
"version": "14.0.1.1.0",
"category": "Accounting & Finance",
"summary": "OCA Financial Reports",
"author": "ForgeFlow, Odoo Community Association (OCA)",
@ -12,6 +12,7 @@
"depends": ["account"],
"external_dependencies": {"python": ["dateutil"]},
"data": [
"security/ir.model.access.csv",
"security/statement_security.xml",
"views/activity_statement.xml",
"views/outstanding_statement.xml",

9
partner_statement/report/activity_statement.py

@ -27,9 +27,10 @@ class ActivityStatement(models.AbstractModel):
ELSE sum(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)
JOIN account_move m ON (l.move_id = m.id)
WHERE l.partner_id IN %(partners)s
AND l.account_internal_type = %(account_type)s
WHERE l.partner_id IN %(partners)s 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,
@ -106,10 +107,12 @@ class ActivityStatement(models.AbstractModel):
ELSE l.date_maturity
END as date_maturity
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)
JOIN account_move m ON (l.move_id = m.id)
JOIN account_journal aj ON (l.journal_id = aj.id)
WHERE l.partner_id IN %(partners)s
AND l.account_internal_type = %(account_type)s
AND at.type = %(account_type)s
AND %(date_start)s <= l.date
AND l.date <= %(date_end)s
AND m.state IN ('posted')

9
partner_statement/report/outstanding_statement.py

@ -35,14 +35,16 @@ class OutstandingStatement(models.AbstractModel):
ELSE l.balance + sum(coalesce(pc.amount, 0.0))
END AS open_amount,
CASE WHEN l.balance > 0.0
THEN l.amount_currency - sum(coalesce(pd.amount_currency, 0.0))
ELSE l.amount_currency + sum(coalesce(pc.amount_currency, 0.0))
THEN l.amount_currency - sum(coalesce(pd.debit_amount_currency, 0.0))
ELSE l.amount_currency + sum(coalesce(pc.credit_amount_currency, 0.0))
END AS open_amount_currency,
CASE WHEN l.date_maturity is null
THEN l.date
ELSE l.date_maturity
END as date_maturity
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)
JOIN account_move m ON (l.move_id = m.id)
LEFT JOIN (SELECT pr.*
FROM account_partial_reconcile pr
@ -56,8 +58,7 @@ class OutstandingStatement(models.AbstractModel):
ON pr.debit_move_id = l2.id
WHERE l2.date <= %(date_end)s
) as pc ON pc.credit_move_id = l.id
WHERE l.partner_id IN %(partners)s
AND l.account_internal_type = %(account_type)s
WHERE l.partner_id IN %(partners)s AND at.type = %(account_type)s
AND (
(pd.id IS NOT NULL AND
pd.max_date <= %(date_end)s) OR

9
partner_statement/report/report_statement_common.py

@ -44,8 +44,8 @@ class ReportStatementCommon(models.AbstractModel):
ELSE l.balance + sum(coalesce(pc.amount, 0.0))
END AS open_due,
CASE WHEN l.balance > 0.0
THEN l.amount_currency - sum(coalesce(pd.amount_currency, 0.0))
ELSE l.amount_currency + sum(coalesce(pc.amount_currency, 0.0))
THEN l.amount_currency - sum(coalesce(pd.debit_amount_currency, 0.0))
ELSE l.amount_currency + sum(coalesce(pc.credit_amount_currency, 0.0))
END AS open_due_currency,
CASE WHEN l.date_maturity is null
THEN l.date
@ -53,6 +53,8 @@ class ReportStatementCommon(models.AbstractModel):
END as date_maturity
FROM account_move_line l
JOIN account_move m ON (l.move_id = m.id)
JOIN account_account aa ON (aa.id = l.account_id)
JOIN account_account_type at ON (at.id = aa.user_type_id)
LEFT JOIN (SELECT pr.*
FROM account_partial_reconcile pr
INNER JOIN account_move_line l2
@ -65,8 +67,7 @@ class ReportStatementCommon(models.AbstractModel):
ON pr.debit_move_id = l2.id
WHERE l2.date <= %(date_end)s
) as pc ON pc.credit_move_id = l.id
WHERE l.partner_id IN %(partners)s
AND l.account_internal_type = %(account_type)s
WHERE l.partner_id IN %(partners)s AND at.type = %(account_type)s
AND (
(pd.id IS NOT NULL AND
pd.max_date <= %(date_end)s) OR

3
partner_statement/security/ir.model.access.csv

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_activity_statement_wizard,access_activity_statement_wizard,model_activity_statement_wizard,account.group_account_invoice,1,1,1,0
access_outstanding_statement_wizard,access_outstanding_statement_wizard,model_outstanding_statement_wizard,account.group_account_invoice,1,1,1,0

16
partner_statement/views/activity_statement.xml

@ -161,13 +161,11 @@
</t>
</t>
</template>
<report
id="action_print_activity_statement"
model="res.partner"
report_type="qweb-pdf"
menu="False"
string="Activity Statement"
name="partner_statement.activity_statement"
file="partner_statement.activity_statement"
/>
<record id="action_print_activity_statement" model="ir.actions.report">
<field name="name">Activity Statement</field>
<field name="model">res.partner</field>
<field name="report_name">partner_statement.activity_statement</field>
<field name="report_type">qweb-pdf</field>
<field name="report_file">partner_statement.activity_statement</field>
</record>
</odoo>

16
partner_statement/views/outstanding_statement.xml

@ -157,13 +157,11 @@
</t>
</t>
</template>
<report
id="action_print_outstanding_statement"
model="res.partner"
report_type="qweb-pdf"
menu="False"
string="Outstanding Statement"
name="partner_statement.outstanding_statement"
file="partner_statement.outstanding_statement"
/>
<record id="action_print_outstanding_statement" model="ir.actions.report">
<field name="name">Outstanding Statement</field>
<field name="model">res.partner</field>
<field name="report_name">partner_statement.outstanding_statement</field>
<field name="report_type">qweb-pdf</field>
<field name="report_file">partner_statement.outstanding_statement</field>
</record>
</odoo>

70
partner_statement/wizard/statement_wizard.xml

@ -3,24 +3,28 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- wizard action on res.partner -->
<act_window
id="activity_statement_wizard_action"
name="Partner Activity Statement"
binding_model="res.partner"
res_model="activity.statement.wizard"
view_mode="form"
target="new"
groups="partner_statement.group_activity_statement"
<record id="activity_statement_wizard_action" model="ir.actions.act_window">
<field name="name">Partner Activity Statement</field>
<field name="binding_model_id" ref="base.model_res_partner" />
<field name="res_model">activity.statement.wizard</field>
<field name="view_mode">form</field>
<field
name="groups_id"
eval="[(4, ref('partner_statement.group_activity_statement'))]"
/>
<act_window
id="outstanding_statement_wizard_action"
name="Partner Outstanding Statement"
binding_model="res.partner"
res_model="outstanding.statement.wizard"
view_mode="form"
target="new"
groups="partner_statement.group_outstanding_statement"
<field name="target">new</field>
</record>
<record id="outstanding_statement_wizard_action" model="ir.actions.act_window">
<field name="name">Partner Outstanding Statement</field>
<field name="binding_model_id" ref="base.model_res_partner" />
<field name="res_model">outstanding.statement.wizard</field>
<field name="view_mode">form</field>
<field
name="groups_id"
eval="[(4, ref('partner_statement.group_outstanding_statement'))]"
/>
<field name="target">new</field>
</record>
<!-- wizard view -->
<record id="statement_common_view" model="ir.ui.view">
<field name="name">Statement Common Wizard View</field>
@ -28,11 +32,11 @@
<field name="arch" type="xml">
<form name="Report Options">
<div style="text-align:justify" name="info">
<label
string="Aging details can be shown in the report, expressed in aging
buckets, so the partner can review how much is open, due or overdue."
for=""
/>
<span
class="o_form_label"
>Aging details can be shown in the report, expressed in aging
buckets, so the partner can review how much is open, due or overdue.
</span>
</div>
<hr />
<group>
@ -86,14 +90,14 @@
<field name="inherit_id" ref="partner_statement.statement_common_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//div[@name='info']/label" position="before">
<label
string="The outstanding statement provides details of all partner's outstanding
<xpath expr="//div[@name='info']/span" position="before">
<span
class="o_form_label"
>The outstanding statement provides details of all partner's outstanding
receivables and payables up to a particular date. This includes all unpaid invoices, unclaimed
refunds and outstanding payments. The list is displayed in chronological order and is
split by currencies."
for=""
/>
split by currencies.
</span>
<br />
<br />
</xpath>
@ -105,15 +109,15 @@
<field name="inherit_id" ref="partner_statement.statement_common_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//div[@name='info']/label" position="before">
<label
string="The activity statement provides details of all activity on
<xpath expr="//div[@name='info']/span" position="before">
<span
class="o_form_label"
>The activity statement provides details of all activity on
a partner's receivables and payables between two selected dates. This includes all invoices,
refunds and payments. Any outstanding balance dated prior to the chosen statement
period will appear as a forward balance at the top of the statement. The list is
displayed in chronological order and is split by currencies."
for=""
/>
displayed in chronological order and is split by currencies.
</span>
<br />
<br />
</xpath>

Loading…
Cancel
Save