Merge PR #1170 into 16.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2024-04-20 09:19:10 +00:00
9 changed files with 80 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ Account Payment Order
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7770aeb8f31eacf1b549225db47abcb160f8c5324d0a12eb9e828a6e843b0b45
!! source digest: sha256:4fd043df58062557f068abf08f254c3a17a70a13d803604022782b977cd8c337
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png

View File

@@ -26,6 +26,7 @@
"security/ir.model.access.csv",
"wizard/account_payment_line_create_view.xml",
"wizard/account_invoice_payment_line_multi_view.xml",
"wizard/account_payment_update_views.xml",
"views/account_payment_mode.xml",
"views/account_payment_views.xml",
"views/account_payment_order.xml",

View File

@@ -1,8 +1,9 @@
# Copyright 2019 ACSONE SA/NV
# Copyright 2022 Tecnativa - Pedro M. Baeza
# Copyright 2023 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo import _, api, fields, models
class AccountPayment(models.Model):
@@ -10,6 +11,9 @@ class AccountPayment(models.Model):
payment_order_id = fields.Many2one(comodel_name="account.payment.order")
payment_line_ids = fields.Many2many(comodel_name="account.payment.line")
order_state = fields.Selection(
related="payment_order_id.state", string="Payment Order State"
)
@api.depends("payment_type", "journal_id")
def _compute_payment_method_line_fields(self):
@@ -48,3 +52,18 @@ class AccountPayment(models.Model):
else:
super(AccountPayment, pay)._check_payment_method_line_id()
return
def update_payment_reference(self):
view = self.env.ref("account_payment_order.account_payment_update_view_form")
return {
"name": _("Update Payment Reference"),
"view_type": "form",
"view_mode": "form",
"res_model": "account.payment.update",
"view_id": view.id,
"target": "new",
"type": "ir.actions.act_window",
"context": dict(
self.env.context, default_payment_reference=self.payment_reference
),
}

View File

@@ -6,3 +6,4 @@ base.access_res_partner_bank_group_partner_manager,Full access on res.partner.ba
base.access_res_bank_group_partner_manager,Full access on res.bank to Account Payment group,base.model_res_bank,group_account_payment,1,1,1,1
access_account_payment_line_create,access_account_payment_line_create,model_account_payment_line_create,group_account_payment,1,1,1,1
access_account_invoice_payment_line_multi,access_account_invoice_payment_line_multi,model_account_invoice_payment_line_multi,group_account_payment,1,1,1,1
access_account_payment_update,access_account_payment_update,model_account_payment_update,group_account_payment,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 base.access_res_bank_group_partner_manager Full access on res.bank to Account Payment group base.model_res_bank group_account_payment 1 1 1 1
7 access_account_payment_line_create access_account_payment_line_create model_account_payment_line_create group_account_payment 1 1 1 1
8 access_account_invoice_payment_line_multi access_account_invoice_payment_line_multi model_account_invoice_payment_line_multi group_account_payment 1 1 1 1
9 access_account_payment_update access_account_payment_update model_account_payment_update group_account_payment 1 1 1 1

View File

@@ -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:7770aeb8f31eacf1b549225db47abcb160f8c5324d0a12eb9e828a6e843b0b45
!! source digest: sha256:4fd043df58062557f068abf08f254c3a17a70a13d803604022782b977cd8c337
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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&amp;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>

View File

@@ -8,6 +8,14 @@
<field name="arch" type="xml">
<field name="name" position="after">
<field name="payment_reference" />
<field name="order_state" invisible="1" />
<button
name="update_payment_reference"
attrs="{'invisible': [('order_state', '!=', 'open')]}"
title="Update Payment Reference"
type="object"
icon="fa-undo"
/>
</field>
</field>
</record>

View File

@@ -1,3 +1,4 @@
from . import account_payment_line_create
from . import account_invoice_payment_line_multi
from . import account_payment_update
from . import res_config_settings

View File

@@ -0,0 +1,16 @@
# Copyright 2009-2023 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class AccountPaymentUpdate(models.TransientModel):
_name = "account.payment.update"
_description = "Update Payment Reference"
payment_reference = fields.Char(required=True)
def update_payment_reference(self):
payment = self.env["account.payment"].browse(self.env.context.get("active_id"))
payment.payment_reference = self.payment_reference
payment.ref = self.payment_reference

View File

@@ -0,0 +1,30 @@
<odoo>
<record id="account_payment_update_view_form" model="ir.ui.view">
<field name="name">Update Payment Communication</field>
<field name="model">account.payment.update</field>
<field name="arch" type="xml">
<form>
<group>
<field name="payment_reference" />
</group>
<footer>
<button
string="Update Payment Reference"
name="update_payment_reference"
type="object"
class="btn-primary"
data-hotkey="q"
/>
<button
string="Cancel"
class="btn-secondary"
special="cancel"
data-hotkey="z"
/>
</footer>
</form>
</field>
</record>
</odoo>