mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] add capability to set transfer journal setting on company level via conig settings
This commit is contained in:
@@ -7,7 +7,7 @@ Account Payement Order Transfer Journal
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e52099ef175e833fe269292c0e7ed67f491c0f1006c5f05c122147f541a3369c
|
||||
!! source digest: sha256:7d2e037a2c586245868f0ae3b21aa749db74cbe752b5ad62a7e907e223b86ffb
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -38,7 +38,7 @@ This module allow to generate payment order entries on a transfer journal
|
||||
Usage
|
||||
=====
|
||||
|
||||
Set transfer jounrnal via Accounting Settings or on the payment mode.
|
||||
Set transfer jounrnal via Accounting Settings or on the Payment Mode.
|
||||
If there is no transfer journal, the bank journal itself will be used.
|
||||
|
||||
Bug Tracker
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
from . import models
|
||||
from . import wizards
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"depends": ["account_payment_order"],
|
||||
"data": [
|
||||
"views/account_payment_mode_views.xml",
|
||||
"wizards/res_config_settings.xml",
|
||||
],
|
||||
"demo": [],
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
from . import account_payment_line
|
||||
from . import account_payment_mode
|
||||
from . import res_company
|
||||
|
||||
@@ -9,6 +9,10 @@ class AccountPaymentLine(models.Model):
|
||||
|
||||
def _prepare_account_payment_vals(self):
|
||||
vals = super()._prepare_account_payment_vals()
|
||||
if self.order_id.payment_mode_id.transfer_journal_id:
|
||||
vals["journal_id"] = self.order_id.payment_mode_id.transfer_journal_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
|
||||
|
||||
15
account_payment_order_transfer_journal/models/res_company.py
Normal file
15
account_payment_order_transfer_journal/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",
|
||||
)
|
||||
@@ -1,2 +1,2 @@
|
||||
Set transfer jounrnal via Accounting Settings or on the payment mode.
|
||||
Set transfer jounrnal via Accounting Settings or on the Payment Mode.
|
||||
If there is no transfer journal, the bank journal itself will be used.
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e52099ef175e833fe269292c0e7ed67f491c0f1006c5f05c122147f541a3369c
|
||||
!! source digest: sha256:7d2e037a2c586245868f0ae3b21aa749db74cbe752b5ad62a7e907e223b86ffb
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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_transfer_journal"><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_transfer_journal"><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 allow to generate payment order entries on a transfer journal</p>
|
||||
@@ -386,7 +386,7 @@ ul.auto-toc {
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
|
||||
<p>Set transfer jounrnal via Accounting Settings or on the payment mode.
|
||||
<p>Set transfer jounrnal via Accounting Settings or on the Payment Mode.
|
||||
If there is no transfer journal, the bank journal itself will be used.</p>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from . import res_config_settings
|
||||
@@ -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
|
||||
)
|
||||
@@ -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="pain">
|
||||
<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-3 o_light_label"
|
||||
/>
|
||||
<field name="transfer_journal_id" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user