mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
@@ -4,12 +4,15 @@
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="view_account_config_settings" model="ir.ui.view">
|
||||
<record id="res_config_settings_view_form" model="ir.ui.view">
|
||||
<field name="name">pain.group.on.account.config.settings</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form" />
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_payment_order.res_config_settings_view_form"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='analytic']" position="after">
|
||||
<xpath expr="//div[@id='transfer_journal']" position="after">
|
||||
<h2>SEPA/PAIN</h2>
|
||||
<div class="row mt16 o_settings_container" id="pain">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_account_config_settings" model="ir.ui.view">
|
||||
<record id="res_config_settings_view_form" model="ir.ui.view">
|
||||
<field name="name">sepa_direct_debit.account_config_settings.form
|
||||
</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_banking_pain_base.view_account_config_settings"
|
||||
ref="account_banking_pain_base.res_config_settings_view_form"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='pain']/div/div/div" position="inside">
|
||||
|
||||
@@ -7,7 +7,7 @@ Account Payment Order
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:1002ea7b869db85508b1fe87a2ff885dd1dd9b803d058c034d9717464b81d8ff
|
||||
!! source digest: sha256:333c07fd51f51a7fe368eacbce8df286cd0089528fcd8548d494fd76ee6272b5
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
|
||||
@@ -61,7 +61,11 @@ You can create a Debit order via the menu Invoicing/Accounting > Customers > Deb
|
||||
|
||||
This module also adds an action *Add to Payment Order* on supplier invoices and *Add to Debit Order* on customer invoices.
|
||||
|
||||
You can print a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the payment oder to print.
|
||||
You can print a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the payment order to print.
|
||||
|
||||
You can set a transfer journal via Accounting Settings or on the Payment Mode.
|
||||
If there is no transfer journal, the bank journal itself will be used for the journal entry
|
||||
created when confirming a payment order.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
@@ -119,6 +123,7 @@ Contributors
|
||||
|
||||
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
||||
* Marçal Isern <marsal.isern@qubiq.es>
|
||||
* Luc De Meyer <luc.demeyer@noviat.com> (https://noviat.com)
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"data/payment_seq.xml",
|
||||
"report/print_account_payment_order.xml",
|
||||
"report/account_payment_order.xml",
|
||||
"wizard/res_config_settings.xml",
|
||||
],
|
||||
"demo": ["demo/payment_demo.xml"],
|
||||
"installable": True,
|
||||
|
||||
@@ -7,3 +7,4 @@ from . import res_bank
|
||||
from . import account_payment_method
|
||||
from . import account_journal
|
||||
from . import account_payment
|
||||
from . import res_company
|
||||
|
||||
@@ -17,7 +17,9 @@ class AccountPayment(models.Model):
|
||||
for pay in self:
|
||||
if pay.payment_order_id:
|
||||
pay.available_payment_method_line_ids = (
|
||||
pay.journal_id._get_available_payment_method_lines(pay.payment_type)
|
||||
pay.payment_order_id.journal_id._get_available_payment_method_lines(
|
||||
pay.payment_type
|
||||
)
|
||||
)
|
||||
else:
|
||||
pay.available_payment_method_line_ids = (
|
||||
@@ -33,3 +35,16 @@ class AccountPayment(models.Model):
|
||||
)
|
||||
)
|
||||
return res
|
||||
|
||||
@api.constrains("payment_method_line_id")
|
||||
def _check_payment_method_line_id(self):
|
||||
for pay in self:
|
||||
transfer_journal = (
|
||||
pay.payment_order_id.payment_mode_id.transfer_journal_id
|
||||
or pay.company_id.transfer_journal_id
|
||||
)
|
||||
if pay.journal_id == transfer_journal:
|
||||
continue
|
||||
else:
|
||||
super(AccountPayment, pay)._check_payment_method_line_id()
|
||||
return
|
||||
|
||||
@@ -237,4 +237,11 @@ class AccountPaymentLine(models.Model):
|
||||
vals[
|
||||
"destination_account_id"
|
||||
] = self.partner_id.property_account_payable_id.id
|
||||
|
||||
transfer_journal = (
|
||||
self.order_id.payment_mode_id.transfer_journal_id
|
||||
or self.company_id.transfer_journal_id
|
||||
)
|
||||
if transfer_journal:
|
||||
vals["journal_id"] = transfer_journal.id
|
||||
return vals
|
||||
|
||||
@@ -71,6 +71,12 @@ class AccountPaymentMode(models.Model):
|
||||
"(other modules can set additional fields to restrict the "
|
||||
"grouping.)",
|
||||
)
|
||||
transfer_journal_id = fields.Many2one(
|
||||
comodel_name="account.journal",
|
||||
string="Transfer journal on payment/debit orders",
|
||||
domain="[('type', '=', 'general')]",
|
||||
help="Journal to write payment entries when confirming payment/debit orders",
|
||||
)
|
||||
|
||||
@api.onchange("payment_method_id")
|
||||
def payment_method_id_change(self):
|
||||
|
||||
15
account_payment_order/models/res_company.py
Normal file
15
account_payment_order/models/res_company.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright 2023 Noviat
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = "res.company"
|
||||
|
||||
transfer_journal_id = fields.Many2one(
|
||||
comodel_name="account.journal",
|
||||
string="Transfer journal on payment/debit orders",
|
||||
domain="[('type', '=', 'general')]",
|
||||
help="Journal to write payment entries when confirming payment/debit orders",
|
||||
)
|
||||
@@ -30,3 +30,4 @@
|
||||
|
||||
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
||||
* Marçal Isern <marsal.isern@qubiq.es>
|
||||
* Luc De Meyer <luc.demeyer@noviat.com> (https://noviat.com)
|
||||
|
||||
@@ -4,4 +4,8 @@ You can create a Debit order via the menu Invoicing/Accounting > Customers > Deb
|
||||
|
||||
This module also adds an action *Add to Payment Order* on supplier invoices and *Add to Debit Order* on customer invoices.
|
||||
|
||||
You can print a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the payment oder to print.
|
||||
You can print a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the payment order to print.
|
||||
|
||||
You can set a transfer journal via Accounting Settings or on the Payment Mode.
|
||||
If there is no transfer journal, the bank journal itself will be used for the journal entry
|
||||
created when confirming a payment order.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
@@ -366,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:1002ea7b869db85508b1fe87a2ff885dd1dd9b803d058c034d9717464b81d8ff
|
||||
!! source digest: sha256:333c07fd51f51a7fe368eacbce8df286cd0089528fcd8548d494fd76ee6272b5
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/bank-payment/tree/16.0/account_payment_order"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_payment_order"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module adds support for payment orders and debit orders.</p>
|
||||
@@ -405,7 +406,10 @@ Configuration > Management > Payment Modes.</p>
|
||||
<p>You can create a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the move lines to pay.</p>
|
||||
<p>You can create a Debit order via the menu Invoicing/Accounting > Customers > Debit Orders and then select the move lines to debit.</p>
|
||||
<p>This module also adds an action <em>Add to Payment Order</em> on supplier invoices and <em>Add to Debit Order</em> on customer invoices.</p>
|
||||
<p>You can print a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the payment oder to print.</p>
|
||||
<p>You can print a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the payment order to print.</p>
|
||||
<p>You can set a transfer journal via Accounting Settings or on the Payment Mode.
|
||||
If there is no transfer journal, the bank journal itself will be used for the journal entry
|
||||
created when confirming a payment order.</p>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
|
||||
@@ -463,6 +467,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
</ul>
|
||||
</li>
|
||||
<li>Marçal Isern <<a class="reference external" href="mailto:marsal.isern@qubiq.es">marsal.isern@qubiq.es</a>></li>
|
||||
<li>Luc De Meyer <<a class="reference external" href="mailto:luc.demeyer@noviat.com">luc.demeyer@noviat.com</a>> (<a class="reference external" href="https://noviat.com">https://noviat.com</a>)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
||||
@@ -3,3 +3,4 @@ from . import test_bank
|
||||
from . import test_payment_order_inbound
|
||||
from . import test_payment_order_outbound
|
||||
from . import test_account_payment
|
||||
from . import test_payment_order_transfer_journal
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# Copyright 2023 Noviat
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
import odoo.tests
|
||||
from odoo import fields
|
||||
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
|
||||
|
||||
@odoo.tests.tagged("post_install", "-at_install")
|
||||
class TestPaymentOrderTranserJournal(AccountTestInvoicingCommon):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
today = fields.Date.today()
|
||||
cls.in_invoice = cls.init_invoice(
|
||||
"in_invoice", invoice_date=today, products=cls.product_a
|
||||
)
|
||||
cls.bank_journal = cls.company_data["default_journal_bank"]
|
||||
cls.misc_journal = cls.company_data["default_journal_misc"]
|
||||
cls.payment_mode = cls.env["account.payment.mode"].create(
|
||||
{
|
||||
"name": "Test Credit Transfer to Suppliers",
|
||||
"company_id": cls.env.company.id,
|
||||
"payment_method_id": cls.env.ref(
|
||||
"account.account_payment_method_manual_out"
|
||||
).id,
|
||||
"fixed_journal_id": cls.bank_journal.id,
|
||||
"bank_account_link": "fixed",
|
||||
}
|
||||
)
|
||||
|
||||
def test_payment_order_transfer_journal(self):
|
||||
self.in_invoice._post()
|
||||
self.payment_mode.transfer_journal_id = self.misc_journal
|
||||
ap_aml = self.in_invoice.line_ids.filtered(
|
||||
lambda r: r.account_type == "liability_payable"
|
||||
)
|
||||
payline_vals = {
|
||||
"move_line_id": ap_aml.id,
|
||||
"partner_id": self.in_invoice.partner_id.id,
|
||||
"communication": "F0123",
|
||||
"amount_currency": -ap_aml.amount_currency,
|
||||
}
|
||||
order_vals = {
|
||||
"payment_type": "outbound",
|
||||
"payment_mode_id": self.payment_mode.id,
|
||||
"payment_line_ids": [(0, 0, payline_vals)],
|
||||
}
|
||||
order = self.env["account.payment.order"].create(order_vals)
|
||||
order.draft2open()
|
||||
self.assertEqual(order.mapped("move_ids.journal_id"), self.misc_journal)
|
||||
@@ -8,6 +8,9 @@
|
||||
<field name="payment_type" position="after">
|
||||
<field name="payment_order_ok" />
|
||||
</field>
|
||||
<field name="variable_journal_ids" position="after">
|
||||
<field name="transfer_journal_id" />
|
||||
</field>
|
||||
<group name="main" position="after">
|
||||
<group
|
||||
name="payment_order_options"
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
from . import account_payment_line_create
|
||||
from . import account_invoice_payment_line_multi
|
||||
from . import res_config_settings
|
||||
|
||||
12
account_payment_order/wizard/res_config_settings.py
Normal file
12
account_payment_order/wizard/res_config_settings.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright 2023 Noviat
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = "res.config.settings"
|
||||
|
||||
transfer_journal_id = fields.Many2one(
|
||||
related="company_id.transfer_journal_id", readonly=False
|
||||
)
|
||||
30
account_payment_order/wizard/res_config_settings.xml
Normal file
30
account_payment_order/wizard/res_config_settings.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="res_config_settings_view_form" model="ir.ui.view">
|
||||
<field name="name">res.config.settings.payment</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='analytic']" position="after">
|
||||
<h2>Payment Orders</h2>
|
||||
<div class="row mt16 o_settings_container" id="transfer_journal">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_right_pane">
|
||||
<div class="content-group">
|
||||
<div class="row mt16">
|
||||
<label
|
||||
for="transfer_journal_id"
|
||||
class="col-md-6 o_light_label"
|
||||
/>
|
||||
<field name="transfer_journal_id" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user