summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2016-12-27 13:56:51 +0100
committerChristophe Simonis <chs@odoo.com>2017-01-04 18:51:00 +0100
commitb9f4a98774594237dc11e1c300b8cafb2f64858b (patch)
tree6e8fe96bcde0c7950e7f9192a04fac1960cb0129
parent4f49da2da90f77f4dc495a38b21ea07ff32663d6 (diff)
[IMP] account,payment: account journal visibility
Remove field 'display_on_footer' to stop displaying account journal on report documents. As the field is removed but also used in payment to generate default 'Thanks Message', put a new field on account.journal in payment module, to keep the role 'display_on_footer' had in payment.
-rw-r--r--addons/account/__manifest__.py1
-rw-r--r--addons/account/models/account.py3
-rw-r--r--addons/account/report/inherited_layouts.xml22
-rw-r--r--addons/account/views/account_view.xml8
-rw-r--r--addons/payment/__manifest__.py1
-rw-r--r--addons/payment/models/__init__.py1
-rw-r--r--addons/payment/models/account_journal.py10
-rw-r--r--addons/payment/views/account_journal_views.xml15
-rw-r--r--addons/payment_transfer/models/payment.py2
9 files changed, 32 insertions, 31 deletions
diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py
index ff810f5247d..9d94457643f 100644
--- a/addons/account/__manifest__.py
+++ b/addons/account/__manifest__.py
@@ -42,7 +42,6 @@ You could use this simplified accounting in case you work with an (external) acc
'views/account.xml',
'views/report_invoice.xml',
'report/account_invoice_report_view.xml',
- 'report/inherited_layouts.xml',
'views/report_overdue.xml',
'views/report_overdue.xml',
'wizard/account_report_common_view.xml',
diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index ffedce436c3..5a603938870 100644
--- a/addons/account/models/account.py
+++ b/addons/account/models/account.py
@@ -58,7 +58,7 @@ class AccountAccount(models.Model):
help="Forces all moves for this account to have this secondary currency.")
code = fields.Char(size=64, required=True, index=True)
deprecated = fields.Boolean(index=True, default=False)
- user_type_id = fields.Many2one('account.account.type', string='Type', required=True, oldname="user_type",
+ user_type_id = fields.Many2one('account.account.type', string='Type', required=True, oldname="user_type",
help="Account Type is used for information purpose, to generate country-specific legal reports, and set the rules to close a fiscal year and generate opening entries.")
internal_type = fields.Selection(related='user_type_id.type', string="Internal Type", store=True, readonly=True)
#has_unreconciled_entries = fields.Boolean(compute='_compute_has_unreconciled_entries',
@@ -242,7 +242,6 @@ class AccountJournal(models.Model):
# Bank journals fields
bank_account_id = fields.Many2one('res.partner.bank', string="Bank Account", ondelete='restrict', copy=False)
- display_on_footer = fields.Boolean("Show in Invoices Footer", help="Display this bank account on the footer of printed documents like invoices and sales orders.")
bank_statements_source = fields.Selection([('no_feeds', 'No Feeds'),('manual', 'Record Manually')], string='Bank Feeds', default='no_feeds')
bank_acc_number = fields.Char(related='bank_account_id.acc_number')
bank_id = fields.Many2one('res.bank', related='bank_account_id.bank_id')
diff --git a/addons/account/report/inherited_layouts.xml b/addons/account/report/inherited_layouts.xml
deleted file mode 100644
index 14fefba8b8c..00000000000
--- a/addons/account/report/inherited_layouts.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
-<data>
-
-<template id="external_layout_footer" inherit_id="report.external_layout_footer_default">
- <xpath expr="//ul[@name='financial_infos']" position="inside">
- <t t-if="not company.custom_footer">
- <t t-set="is_first" t-value="True"/>
- <t t-foreach="company.bank_journal_ids" t-as="journal">
- <t t-set="bank_acc" t-value="journal.bank_account_id"/>
- <t t-if="journal.display_on_footer">
- <li t-if="(is_first and company.vat) or (not is_first)">&amp;bull;</li>
- <li><span t-esc="bank_acc.bank_name"/><t t-if="bank_acc.bank_bic"> (<span t-esc="bank_acc.bank_bic"/>)</t>: <span t-esc="bank_acc.acc_number"/></li>
- <t t-set="is_first" t-value="False"/>
- </t>
- </t>
- </t>
- </xpath>
-</template>
-
-</data>
-</odoo>
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index a714a6bb8f0..5f83012ad07 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -24,7 +24,7 @@
<field name="internal_type" invisible="1" readonly="1"/>
<label for="reconcile"/>
<div>
- <field name="reconcile"/>
+ <field name="reconcile"/>
<button name="action_open_reconcile" class="oe_link" type="object" string=" -> Reconcile" attrs="{'invisible': [('reconcile', '=', False)]}"/>
</div>
<field name="deprecated"/>
@@ -299,7 +299,6 @@
<group>
<field name="bank_acc_number"/>
<field name="bank_id"/>
- <field name="display_on_footer"/>
</group>
<group >
<field name="bank_statements_source" widget="radio" attrs="{'required': [('type', '=', 'bank')]}"/>
@@ -338,7 +337,6 @@
</div>
<group col="4">
<field name="bank_id"/>
- <field name="display_on_footer"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
<field name="inbound_payment_method_ids" widget="many2many_checkboxes"/>
@@ -356,7 +354,7 @@
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_account_bank_journal_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_account_bank_journal_form')})]"/>
<field name="domain">[('type', '=', 'bank')]</field>
- <field name="context">{'default_type': 'bank', 'default_display_on_footer': True}</field>
+ <field name="context">{'default_type': 'bank'}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a bank account.
@@ -1205,7 +1203,7 @@
<field name="move_id" string="Number (Move)"/>
<field name="account_id"/>
<field name="partner_id"/>
- <field name="journal_id"/>
+ <field name="journal_id"/>
<group expand="0" string="Group By">
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" domain="[]" context="{'group_by':'journal_id'}"/>
diff --git a/addons/payment/__manifest__.py b/addons/payment/__manifest__.py
index 545c528f610..daa20389586 100644
--- a/addons/payment/__manifest__.py
+++ b/addons/payment/__manifest__.py
@@ -12,6 +12,7 @@
'data/payment_acquirer_data.xml',
'views/payment_views.xml',
'views/account_payment_views.xml',
+ 'views/account_journal_views.xml',
'views/payment_templates.xml',
'views/res_partner_views.xml',
'security/ir.model.access.csv',
diff --git a/addons/payment/models/__init__.py b/addons/payment/models/__init__.py
index e5b3f93737c..28a6594b0e5 100644
--- a/addons/payment/models/__init__.py
+++ b/addons/payment/models/__init__.py
@@ -3,3 +3,4 @@
import payment_acquirer
import res_partner
import account_payment
+import account_journal
diff --git a/addons/payment/models/account_journal.py b/addons/payment/models/account_journal.py
new file mode 100644
index 00000000000..043e646ead7
--- /dev/null
+++ b/addons/payment/models/account_journal.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class AccountJournal(models.Model):
+ _inherit = "account.journal"
+
+ use_in_payment = fields.Boolean("Use in payment", help="Display this bank account on messages in payment process.")
diff --git a/addons/payment/views/account_journal_views.xml b/addons/payment/views/account_journal_views.xml
new file mode 100644
index 00000000000..86f77bb503b
--- /dev/null
+++ b/addons/payment/views/account_journal_views.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<odoo>
+
+ <record id="account_bank_journal_view_form" model="ir.ui.view">
+ <field name="name">account.bank.journal.inherit.payment</field>
+ <field name="model">account.journal</field>
+ <field name="inherit_id" ref="account.view_account_bank_journal_form"/>
+ <field name="arch" type="xml">
+ <xpath expr='//field[@name="bank_id"]' position="after">
+ <field name="use_in_payment"/>
+ </xpath>
+ </field>
+ </record>
+
+</odoo>
diff --git a/addons/payment_transfer/models/payment.py b/addons/payment_transfer/models/payment.py
index 4a19e336f3f..b8bc7e2fe86 100644
--- a/addons/payment_transfer/models/payment.py
+++ b/addons/payment_transfer/models/payment.py
@@ -21,7 +21,7 @@ class TransferPaymentAcquirer(models.Model):
def _format_transfer_data(self):
company_id = self.env.user.company_id.id
# filter only bank accounts marked as visible
- journals = self.env['account.journal'].search([('type', '=', 'bank'), ('display_on_footer', '=', True), ('company_id', '=', company_id)])
+ journals = self.env['account.journal'].search([('type', '=', 'bank'), ('use_in_payment', '=', True), ('company_id', '=', company_id)])
accounts = journals.mapped('bank_account_id').name_get()
bank_title = _('Bank Accounts') if len(accounts) > 1 else _('Bank Account')
bank_accounts = ''.join(['<ul>'] + ['<li>%s</li>' % name for id, name in accounts] + ['</ul>'])