mirror of
https://github.com/bringout/oca-payment.git
synced 2026-04-23 17:42:02 +02:00
Restructure: move packages from packages/ subdirectory to root
Flattened directory structure by moving payment packages from redundant packages/ subdirectory to the root level of oca-payment repository. Changes: - Moved odoo-bringout-oca-payment-* from packages/ to root - Updated CLAUDE.md to reflect new flat structure - Removed redundant packages/ directory 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
99c650f4f5
commit
7f7e88ab3d
202 changed files with 1 additions and 1 deletions
|
|
@ -0,0 +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
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# © 2016 Akretion (<https://www.akretion.com>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class AccountInvoicePaymentLineMulti(models.TransientModel):
|
||||
_name = "account.invoice.payment.line.multi"
|
||||
_description = "Create payment lines from invoice tree view"
|
||||
|
||||
def run(self):
|
||||
self.ensure_one()
|
||||
assert (
|
||||
self._context["active_model"] == "account.move"
|
||||
), "Active model should be account.move"
|
||||
invoices = self.env["account.move"].browse(self._context["active_ids"])
|
||||
action = invoices.create_account_payment_line()
|
||||
return action
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="account_invoice_payment_line_multi_form" model="ir.ui.view">
|
||||
<field name="name">account_invoice_payment_line_multi.form</field>
|
||||
<field name="model">account.invoice.payment.line.multi</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Payment Lines">
|
||||
<p>This wizard will create payment lines for the selected invoices:</p>
|
||||
<ul>
|
||||
<li
|
||||
>if there are existing draft payment orders for the payment modes of the invoices, the payment lines will be added to those payment orders</li>
|
||||
<li
|
||||
>otherwise, new payment orders will be created (one per payment mode).</li>
|
||||
</ul>
|
||||
<footer>
|
||||
<button
|
||||
type="object"
|
||||
name="run"
|
||||
string="Create"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
<button special="cancel" string="Cancel" class="oe_link" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
# © 2009 EduSense BV (<http://www.edusense.nl>)
|
||||
# © 2011-2013 Therp BV (<https://therp.nl>)
|
||||
# © 2014-2015 ACSONE SA/NV (<https://acsone.eu>)
|
||||
# © 2015-2016 Akretion (<https://www.akretion.com>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
|
||||
|
||||
class AccountPaymentLineCreate(models.TransientModel):
|
||||
_name = "account.payment.line.create"
|
||||
_description = "Wizard to create payment lines"
|
||||
|
||||
order_id = fields.Many2one(
|
||||
comodel_name="account.payment.order", string="Payment Order"
|
||||
)
|
||||
journal_ids = fields.Many2many(
|
||||
comodel_name="account.journal", string="Journals Filter"
|
||||
)
|
||||
partner_ids = fields.Many2many(
|
||||
comodel_name="res.partner",
|
||||
string="Partners",
|
||||
domain=[("parent_id", "=", False)],
|
||||
)
|
||||
target_move = fields.Selection(
|
||||
selection=[("posted", "All Posted Entries"), ("all", "All Entries")],
|
||||
string="Target Moves",
|
||||
)
|
||||
allow_blocked = fields.Boolean(string="Allow Litigation Move Lines")
|
||||
invoice = fields.Boolean(string="Linked to an Invoice or Refund")
|
||||
date_type = fields.Selection(
|
||||
selection=[("due", "Due Date"), ("move", "Move Date")],
|
||||
string="Type of Date Filter",
|
||||
required=True,
|
||||
)
|
||||
due_date = fields.Date()
|
||||
move_date = fields.Date(default=fields.Date.context_today)
|
||||
payment_mode = fields.Selection(
|
||||
selection=[("same", "Same"), ("same_or_null", "Same or Empty"), ("any", "Any")],
|
||||
)
|
||||
move_line_ids = fields.Many2many(
|
||||
comodel_name="account.move.line", string="Move Lines"
|
||||
)
|
||||
|
||||
@api.model
|
||||
def default_get(self, field_list):
|
||||
res = super(AccountPaymentLineCreate, self).default_get(field_list)
|
||||
context = self.env.context
|
||||
assert (
|
||||
context.get("active_model") == "account.payment.order"
|
||||
), "active_model should be payment.order"
|
||||
assert context.get("active_id"), "Missing active_id in context !"
|
||||
order = self.env["account.payment.order"].browse(context["active_id"])
|
||||
mode = order.payment_mode_id
|
||||
res.update(
|
||||
{
|
||||
"journal_ids": mode.default_journal_ids.ids or False,
|
||||
"target_move": mode.default_target_move,
|
||||
"invoice": mode.default_invoice,
|
||||
"date_type": mode.default_date_type,
|
||||
"payment_mode": mode.default_payment_mode,
|
||||
"order_id": order.id,
|
||||
}
|
||||
)
|
||||
return res
|
||||
|
||||
def _prepare_move_line_domain(self):
|
||||
self.ensure_one()
|
||||
domain = [
|
||||
("reconciled", "=", False),
|
||||
("company_id", "=", self.order_id.company_id.id),
|
||||
]
|
||||
if self.journal_ids:
|
||||
domain += [("journal_id", "in", self.journal_ids.ids)]
|
||||
if self.partner_ids:
|
||||
domain += [("partner_id", "in", self.partner_ids.ids)]
|
||||
if self.target_move == "posted":
|
||||
domain += [("move_id.state", "=", "posted")]
|
||||
if not self.allow_blocked:
|
||||
domain += [("blocked", "!=", True)]
|
||||
if self.date_type == "due":
|
||||
domain += [
|
||||
"|",
|
||||
("date_maturity", "<=", self.due_date),
|
||||
("date_maturity", "=", False),
|
||||
]
|
||||
elif self.date_type == "move":
|
||||
domain.append(("date", "<=", self.move_date))
|
||||
if self.invoice:
|
||||
domain.append(
|
||||
(
|
||||
"move_id.move_type",
|
||||
"in",
|
||||
("in_invoice", "out_invoice", "in_refund", "out_refund"),
|
||||
)
|
||||
)
|
||||
if self.payment_mode:
|
||||
if self.payment_mode == "same":
|
||||
domain.append(
|
||||
("payment_mode_id", "=", self.order_id.payment_mode_id.id)
|
||||
)
|
||||
elif self.payment_mode == "same_or_null":
|
||||
domain += [
|
||||
"|",
|
||||
("payment_mode_id", "=", False),
|
||||
("payment_mode_id", "=", self.order_id.payment_mode_id.id),
|
||||
]
|
||||
|
||||
if self.order_id.payment_type == "outbound":
|
||||
# For payables, propose all unreconciled credit lines,
|
||||
# including partially reconciled ones.
|
||||
# If they are partially reconciled with a supplier refund,
|
||||
# the residual will be added to the payment order.
|
||||
#
|
||||
# For receivables, propose all unreconciled credit lines.
|
||||
# (ie customer refunds): they can be refunded with a payment.
|
||||
# Do not propose partially reconciled credit lines,
|
||||
# as they are deducted from a customer invoice, and
|
||||
# will not be refunded with a payment.
|
||||
domain += [
|
||||
("credit", ">", 0),
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["liability_payable", "asset_receivable"],
|
||||
),
|
||||
]
|
||||
elif self.order_id.payment_type == "inbound":
|
||||
domain += [
|
||||
("debit", ">", 0),
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
),
|
||||
]
|
||||
# Exclude lines that are already in a non-cancelled
|
||||
# and non-uploaded payment order; lines that are in a
|
||||
# uploaded payment order are proposed if they are not reconciled,
|
||||
paylines = self.env["account.payment.line"].search(
|
||||
[
|
||||
("state", "in", ("draft", "open", "generated")),
|
||||
("move_line_id", "!=", False),
|
||||
]
|
||||
)
|
||||
if paylines:
|
||||
move_lines_ids = [payline.move_line_id.id for payline in paylines]
|
||||
domain += [("id", "not in", move_lines_ids)]
|
||||
return domain
|
||||
|
||||
def populate(self):
|
||||
domain = self._prepare_move_line_domain()
|
||||
lines = self.env["account.move.line"].search(domain)
|
||||
self.move_line_ids = lines
|
||||
action = {
|
||||
"name": _("Select Move Lines to Create Transactions"),
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "account.payment.line.create",
|
||||
"view_mode": "form",
|
||||
"target": "new",
|
||||
"res_id": self.id,
|
||||
"context": self._context,
|
||||
}
|
||||
return action
|
||||
|
||||
@api.onchange(
|
||||
"date_type",
|
||||
"move_date",
|
||||
"due_date",
|
||||
"journal_ids",
|
||||
"invoice",
|
||||
"target_move",
|
||||
"allow_blocked",
|
||||
"payment_mode",
|
||||
"partner_ids",
|
||||
)
|
||||
def move_line_filters_change(self):
|
||||
domain = self._prepare_move_line_domain()
|
||||
res = {"domain": {"move_line_ids": domain}}
|
||||
return res
|
||||
|
||||
def create_payment_lines(self):
|
||||
if self.move_line_ids:
|
||||
self.move_line_ids.create_payment_line_from_move_line(self.order_id)
|
||||
return True
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
© 2013-2016 Akretion (https://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="account_payment_line_create_form" model="ir.ui.view">
|
||||
<field name="name">account_payment_line_create.form</field>
|
||||
<field name="model">account.payment.line.create</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Choose Move Lines Filter Options">
|
||||
<group name="main">
|
||||
<field name="order_id" invisible="1" />
|
||||
<field name="date_type" />
|
||||
<field
|
||||
name="move_date"
|
||||
attrs="{'required': [('date_type', '=', 'move')], 'invisible': [('date_type', '!=', 'move')]}"
|
||||
/>
|
||||
<field
|
||||
name="due_date"
|
||||
attrs="{'required': [('date_type', '=', 'due')], 'invisible': [('date_type', '!=', 'due')]}"
|
||||
/>
|
||||
<field
|
||||
name="journal_ids"
|
||||
widget="many2many_tags"
|
||||
placeholder="Keep empty for using all journals"
|
||||
/>
|
||||
<field
|
||||
name="partner_ids"
|
||||
widget="many2many_tags"
|
||||
placeholder="Keep empty to use all partners"
|
||||
/>
|
||||
<field name="payment_mode" />
|
||||
<field name="target_move" widget="radio" />
|
||||
<field name="invoice" />
|
||||
<field name="allow_blocked" />
|
||||
<label
|
||||
for="populate"
|
||||
string="Click on Add All Move Lines to auto-select the move lines matching the above criteria or click on Add an item to manually select the move lines filtered by the above criteria."
|
||||
colspan="2"
|
||||
/>
|
||||
<button
|
||||
name="populate"
|
||||
type="object"
|
||||
string="Add All Move Lines"
|
||||
colspan="2"
|
||||
/>
|
||||
</group>
|
||||
<group
|
||||
name="move_lines"
|
||||
string="Selected Move Lines to Create Transactions"
|
||||
>
|
||||
<field
|
||||
name="move_line_ids"
|
||||
nolabel="1"
|
||||
force_save="1"
|
||||
context="{'tree_view_ref': 'account_payment_order.view_move_line_tree', 'form_view_ref':'account_payment_order.view_move_line_form_no_edit'}"
|
||||
colspan="2"
|
||||
>
|
||||
<tree>
|
||||
<field name="date" />
|
||||
<field name="move_id" required="0" />
|
||||
<field name="journal_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="account_id" />
|
||||
<field name="date_maturity" />
|
||||
<field name="debit" />
|
||||
<field name="credit" />
|
||||
<field name="amount_residual" sum="Total Residual" />
|
||||
<field name="amount_currency" />
|
||||
<field name="amount_residual_currency" />
|
||||
<field name="company_currency_id" invisible="1" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
name="create_payment_lines"
|
||||
type="object"
|
||||
string="Create Transactions"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
<button string="Cancel" special="cancel" class="oe_link" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="account_payment_line_create_action" model="ir.actions.act_window">
|
||||
<field name="name">Create Transactions from Move Lines</field>
|
||||
<field name="res_model">account.payment.line.create</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -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
|
||||
|
|
@ -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>
|
||||
|
|
@ -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="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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue