mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] account_payment_order: set partner_bank_id + order generation from invoice tree + attachment file name
- fix set partner_bank_id in account move lines Case: The bank account isn't set properly in the payment order lines, because the bank account is only got from account.move.line or the first bank account in the partner_id, but never from the invoice (account.move). Solution: With this fix, the bank account will be get from account.move when matching the criteria. - fix payment orders from invoice tree view Case: User can't add invoices to payment/debit orders from the tree view but it's still possible to add them one by one from the form view. Solution: Remove binding_views="form": by default are "tree & form". With this fix, users can add payment/debit orders from the invoice tree view - fix the attachment file name & dowload. Case: After the configuration of a debit order and generating the .xml file, user can't download it from the next step screen using the download link. Solution: This fix makes the .xml file downloadable from the .xml file name as it was in older versions
This commit is contained in:
committed by
Pedro M. Baeza
parent
a274542d2e
commit
0c571a2028
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "Account Payment Order",
|
"name": "Account Payment Order",
|
||||||
"version": "13.0.1.1.0",
|
"version": "13.0.1.3.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "ACSONE SA/NV, "
|
"author": "ACSONE SA/NV, "
|
||||||
"Therp BV, "
|
"Therp BV, "
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.fields import first
|
from odoo.fields import first
|
||||||
|
|
||||||
|
|
||||||
@@ -12,6 +12,9 @@ class AccountMoveLine(models.Model):
|
|||||||
partner_bank_id = fields.Many2one(
|
partner_bank_id = fields.Many2one(
|
||||||
comodel_name="res.partner.bank",
|
comodel_name="res.partner.bank",
|
||||||
string="Partner Bank Account",
|
string="Partner Bank Account",
|
||||||
|
compute="_compute_partner_bank_id",
|
||||||
|
readonly=False,
|
||||||
|
store=True,
|
||||||
help="Bank account on which we should pay the supplier",
|
help="Bank account on which we should pay the supplier",
|
||||||
)
|
)
|
||||||
bank_payment_line_id = fields.Many2one(
|
bank_payment_line_id = fields.Many2one(
|
||||||
@@ -23,6 +26,23 @@ class AccountMoveLine(models.Model):
|
|||||||
string="Payment lines",
|
string="Payment lines",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.depends(
|
||||||
|
"move_id", "move_id.invoice_partner_bank_id", "move_id.payment_mode_id"
|
||||||
|
)
|
||||||
|
def _compute_partner_bank_id(self):
|
||||||
|
for ml in self:
|
||||||
|
if (
|
||||||
|
ml.move_id.type in ("in_invoice", "in_refund")
|
||||||
|
and not ml.reconciled
|
||||||
|
and ml.payment_mode_id.payment_order_ok
|
||||||
|
and ml.account_id.internal_type in ("receivable", "payable")
|
||||||
|
and not any(
|
||||||
|
p_state in ("draft", "open", "generated")
|
||||||
|
for p_state in ml.payment_line_ids.mapped("state")
|
||||||
|
)
|
||||||
|
):
|
||||||
|
ml.partner_bank_id = ml.move_id.invoice_partner_bank_id.id
|
||||||
|
|
||||||
def _prepare_payment_line_vals(self, payment_order):
|
def _prepare_payment_line_vals(self, payment_order):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
assert payment_order, "Missing payment order"
|
assert payment_order, "Missing payment order"
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
name="Add to Payment/Debit Order"
|
name="Add to Payment/Debit Order"
|
||||||
res_model="account.invoice.payment.line.multi"
|
res_model="account.invoice.payment.line.multi"
|
||||||
binding_model="account.move"
|
binding_model="account.move"
|
||||||
binding_views="form"
|
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
target="new"
|
target="new"
|
||||||
id="account_invoice_create_account_payment_line_action"
|
id="account_invoice_create_account_payment_line_action"
|
||||||
|
|||||||
@@ -13,12 +13,7 @@
|
|||||||
<field name="name" />
|
<field name="name" />
|
||||||
</h1>
|
</h1>
|
||||||
<group name="main">
|
<group name="main">
|
||||||
<field
|
<field name="datas" filename="name" string="Generated File" />
|
||||||
name="datas"
|
|
||||||
filename="store_fname"
|
|
||||||
string="Generated File"
|
|
||||||
/>
|
|
||||||
<field name="store_fname" invisible="1" />
|
|
||||||
<label for="create_uid" string="Created by" />
|
<label for="create_uid" string="Created by" />
|
||||||
<div name="creation_div">
|
<div name="creation_div">
|
||||||
<field name="create_uid" readonly="1" class="oe_inline" />
|
<field name="create_uid" readonly="1" class="oe_inline" />
|
||||||
|
|||||||
Reference in New Issue
Block a user