Skip to content

Commit

Permalink
[MIG] account_payment_order: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiadavid committed Jan 13, 2024
1 parent 6c5fd79 commit 182f9c8
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 48 deletions.
2 changes: 1 addition & 1 deletion account_payment_order/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{
"name": "Account Payment Order",
"version": "16.0.1.6.1",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV, "
"Therp BV, "
Expand Down
6 changes: 3 additions & 3 deletions account_payment_order/hooks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from odoo.tools import sql


def pre_init_hook(cr):
def pre_init_hook(env):
"""Prepare new partner_bank_id computed field.
Add column to avoid MemoryError on an existing Odoo instance
Expand All @@ -12,5 +12,5 @@ def pre_init_hook(cr):
(see AccountMoveLine._compute_partner_bank_id() in models/account_move_line.py
and AccountMove._compute_payment_order_ok() in models/account_move.py)
"""
if not sql.column_exists(cr, "account_move_line", "partner_bank_id"):
sql.create_column(cr, "account_move_line", "partner_bank_id", "int4")
if not sql.column_exists(env.cr, "account_move_line", "partner_bank_id"):
sql.create_column(env.cr, "account_move_line", "partner_bank_id", "int4")
1 change: 0 additions & 1 deletion account_payment_order/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class AccountMove(models.Model):
reference_type = fields.Selection(
selection=[("none", "Free Reference"), ("structured", "Structured Reference")],
readonly=True,
states={"draft": [("readonly", False)]},
default="none",
)
payment_line_count = fields.Integer(compute="_compute_payment_line_count")
Expand Down
5 changes: 0 additions & 5 deletions account_payment_order/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class AccountPaymentOrder(models.Model):
ondelete="restrict",
tracking=True,
readonly=True,
states={"draft": [("readonly", False)]},
check_company=True,
)
payment_type = fields.Selection(
Expand Down Expand Up @@ -57,7 +56,6 @@ class AccountPaymentOrder(models.Model):
string="Bank Journal",
ondelete="restrict",
readonly=True,
states={"draft": [("readonly", False)]},
tracking=True,
check_company=True,
)
Expand Down Expand Up @@ -93,12 +91,10 @@ class AccountPaymentOrder(models.Model):
default="due",
tracking=True,
readonly=True,
states={"draft": [("readonly", False)]},
)
date_scheduled = fields.Date(
string="Payment Execution Date",
readonly=True,
states={"draft": [("readonly", False)]},
tracking=True,
help="Select a requested date of execution if you selected 'Due Date' "
"as the Payment Execution Date Type.",
Expand All @@ -118,7 +114,6 @@ class AccountPaymentOrder(models.Model):
inverse_name="order_id",
string="Transactions",
readonly=True,
states={"draft": [("readonly", False)]},
)
payment_ids = fields.One2many(
comodel_name="account.payment",
Expand Down
2 changes: 2 additions & 0 deletions account_payment_order/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds several options on Payment Modes, cf Invoicing/Accounting >
Configuration > Management > Payment Modes.
32 changes: 32 additions & 0 deletions account_payment_order/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
* Alexis de Lattre <alexis.delattre@akretion.com>
* Adrien Peiffer <adrien.peiffer@acsone.eu>
* Stefan Rijnhart
* Laurent Mignon <laurent.mignon@acsone.eu>
* Alexandre Fayolle
* Danimar Ribeiro
* Erwin van der Ploeg
* Raphaël Valyi
* Sandy Carter
* Angel Moya <angel.moya@domatix.com>
* Jose María Alzaga <jose.alzaga@aselcis.com>
* Meyomesse Gilles <meyomesse.gilles@gmail.com>
* Denis Roussel <denis.roussel@acsone.eu>

* `DynApps <https://www.dynapps.be>`_:

* Raf Ven <raf.ven@dynapps.be>
* Andrea Stirpe <a.stirpe@onestein.nl>
* `Jarsa <https://www.jarsa.com.mx>`_:

* Alan Ramos <alan.ramos@jarsa.com.mx>
* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* Carlos Dauden
* Carlos Roca

* `Open Source Integrators <https://www.opensourceintegrators.com>`_:

* Ammar Officewala <aofficewala@opensourceintegrators.com>
* Marçal Isern <marsal.isern@qubiq.es>
1 change: 1 addition & 0 deletions account_payment_order/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds support for payment orders and debit orders.
7 changes: 7 additions & 0 deletions account_payment_order/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module depends on:

* account_payment_partner
* base_iban
* document

This modules is part of the OCA/bank-payment suite.
7 changes: 7 additions & 0 deletions account_payment_order/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
You can create a Payment order via the menu Invoicing/Accounting > Vendors > Payment Orders and then select the move lines to pay.

You can create a Debit order via the menu Invoicing/Accounting > Customers > Debit Orders and then select the move lines to debit.

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.
3 changes: 0 additions & 3 deletions account_payment_order/tests/test_payment_order_outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ def _create_supplier_refund(self, move, manual=False):
.with_context(active_model="account.move", active_ids=move.ids)
.create(
{
"date_mode": "entry",
"refund_method": "refund",
"journal_id": move.journal_id.id,
}
)
Expand Down Expand Up @@ -422,7 +420,6 @@ def test_supplier_refund_reference(self):
refund_line = self.refund.line_ids.filtered(
lambda line: line.account_type == "liability_payable"
)
(invoice_line | refund_line).reconcile()

self.env["account.invoice.payment.line.multi"].with_context(
active_model="account.move", active_ids=self.invoice.ids
Expand Down
20 changes: 6 additions & 14 deletions account_payment_order/views/account_invoice_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,21 @@
type="object"
string="Add to Debit Order"
groups="account_payment_order.group_account_payment"
attrs="{'invisible': ['|', '|',
('payment_order_ok', '=', False),
('state', '!=', 'posted'),
('move_type', 'not in', ('out_invoice', 'out_refund'))
]}"
invisible="not payment_order_ok or state != 'posted' or move_type not in ('out_invoice', 'out_refund')"
/>
<button
name="create_account_payment_line"
type="object"
string="Add to Payment Order"
groups="account_payment_order.group_account_payment"
attrs="{'invisible': ['|', '|',
('payment_order_ok', '=', False),
('state', '!=', 'posted'),
('move_type', 'not in', ('in_invoice', 'in_refund'))
]}"
invisible="not payment_order_ok or state != 'posted' or move_type not in ('in_invoice', 'in_refund')"
/>
</button>
<div name="button_box" position="inside">
<button
name="action_payment_lines"
type="object"
attrs="{'invisible': [('payment_line_count', '=', 0)]}"
invisible="not payment_line_count"
icon="fa-bars"
help="Payment Order Lines"
groups="account_payment_order.group_account_payment"
Expand All @@ -61,9 +53,9 @@
<field name="payment_reference" position="before">
<field
name="reference_type"
attrs="{'readonly':[('state','!=','draft')],
'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))],
'required': [('move_type', 'in', ('out_invoice', 'out_refund'))]}"
readonly="state != 'draft'"
invisible="move_type not in ('out_invoice', 'out_refund')"
required="move_type in ('out_invoice', 'out_refund')"
/>
</field>
</field>
Expand Down
2 changes: 1 addition & 1 deletion account_payment_order/views/account_payment_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
name="partner_bank_id"
context="{'default_partner_id': partner_id}"
domain="[('partner_id', '=', partner_id)]"
attrs="{'required': [('bank_account_required', '=', True)]}"
required="bank_account_required"
/>
<field name="bank_account_required" invisible="1" />
<field name="communication_type" />
Expand Down
6 changes: 3 additions & 3 deletions account_payment_order/views/account_payment_mode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
<group
name="payment_order_options"
string="Options for Payment Orders"
attrs="{'invisible': [('payment_order_ok', '=', False)]}"
invisible="not payment_order_ok"
>
<field
name="no_debit_before_maturity"
attrs="{'invisible': ['|', ('payment_type', '!=', 'inbound'), ('payment_order_ok', '!=', True)]}"
invisible="payment_type != 'inbound' or not payment_order_ok"
/>
<field name="default_date_prefered" />
<field name="group_lines" />
</group>
<group
name="payment_order_create_defaults"
string="Select Move Lines to Pay - Default Values"
attrs="{'invisible': [('payment_order_ok', '=', False)]}"
invisible="not payment_order_ok"
>
<field name="default_journal_ids" widget="many2many_tags" />
<field name="default_payment_mode" />
Expand Down
27 changes: 16 additions & 11 deletions account_payment_order/views/account_payment_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@
name="%(account_payment_line_create_action)d"
type="action"
string="Create Payment Lines from Journal Items"
states="draft"
invisible="state != 'draft'"
class="oe_highlight"
/>
<button
name="draft2open"
type="object"
states="draft"
invisible="state != 'draft'"
string="Confirm Payments"
class="oe_highlight"
/>
<button
name="open2generated"
type="object"
states="open"
invisible="state != 'open'"
string="Generate Payment File"
class="oe_highlight"
/>
<button
name="generated2uploaded"
type="object"
states="generated"
invisible="state != 'generated'"
string="File Successfully Uploaded"
class="oe_highlight"
/>
<button
name="cancel2draft"
type="object"
states="cancel"
invisible="state != 'cancel'"
string="Back to Draft"
/>
<button
name="action_cancel"
type="object"
states="draft,open,generated"
invisible="state not in ['draft', 'open', 'generated']"
string="Cancel Payments"
/>
<button
name="action_uploaded_cancel"
type="object"
states="uploaded"
invisible="state != 'uploaded'"
string="Cancel Payments"
/>
<field
Expand Down Expand Up @@ -83,11 +83,13 @@
<group name="head-left">
<field
name="payment_mode_id"
readonly="state != 'draft'"
domain="[('payment_order_ok', '=', True), ('payment_type', '=', payment_type)]"
/>
<field name="allowed_journal_ids" invisible="1" />
<field
name="journal_id"
readonly="state != 'draft'"
domain="[('id', 'in', allowed_journal_ids)]"
/>
<field name="bank_account_link" invisible="1" />
Expand All @@ -99,14 +101,16 @@
<field name="payment_type" invisible="0" />
<field
name="payment_count"
attrs="{'invisible': [('state', 'in', ('draft', 'cancel'))]}"
invisible="state in ('draft', 'cancel')"
/>
</group>
<group name="head-right">
<field name="date_prefered" />
<field name="date_prefered" readonly="state != 'draft'" />
<field
name="date_scheduled"
attrs="{'invisible': [('date_prefered', '!=', 'fixed')], 'required': [('date_prefered', '=', 'fixed')]}"
readonly="state != 'draft'"
invisible="date_prefered != 'fixed'"
required="date_prefered == 'fixed'"
/>
<field name="date_generated" />
<field name="generated_user_id" />
Expand All @@ -118,13 +122,14 @@
<page name="payment-lines" string="Transactions">
<field
name="payment_line_ids"
readonly="state != 'draft'"
context="{'default_payment_type': payment_type}"
/>
</page>
<page
name="payment-lines"
string="Payment Transactions"
attrs="{'invisible': [('state', 'in', ('draft', 'cancel'))]}"
invisible="state in ('draft', 'cancel')"
>
<field
name="payment_ids"
Expand Down
5 changes: 1 addition & 4 deletions account_payment_order/views/account_payment_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
<field name="inherit_id" ref="account.view_account_payment_form" />
<field name="arch" type="xml">
<field name="ref" position="after">
<field
name="payment_reference"
attrs="{'invisible': [('payment_reference', '=', False)]}"
/>
<field name="payment_reference" invisible="not payment_reference" />
</field>
</field>
</record>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
<field name="date_type" />
<field
name="move_date"
attrs="{'required': [('date_type', '=', 'move')], 'invisible': [('date_type', '!=', 'move')]}"
required="date_type == 'move'"
invisible="date_type != 'move'"
/>
<field
name="due_date"
attrs="{'required': [('date_type', '=', 'due')], 'invisible': [('date_type', '!=', 'due')]}"
required="date_type == 'due'"
invisible="date_type != 'due'"
/>
<field
name="journal_ids"
Expand Down

0 comments on commit 182f9c8

Please sign in to comment.