Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions sale_action_paid/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
================
Sale Action Paid
================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6725c12efe97b9cbb57c78e5103c318dae43a39b6ed4e2246e082db670362775
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_action_paid
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_action_paid
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Adds a button "Paid" on a sent sales order.

The action will confirm the SO and the pending payment transaction. Note
that marking as done the payment transaction will change the invoicing
policy to on order (odoo standard). This can also enable standard
automatic invoicing.

This is especially convenient for wire transfer, to mark the SO as paid.
It can also serve for other payment mode in case the postprocessing
failed but the payment went through.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_action_paid%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* BCIM

Contributors
------------

- Jacques-Etienne Baudoux (BCIM) <<je.bcim.be>>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_action_paid>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_action_paid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions sale_action_paid/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Sale Action Paid",
"summary": """
Allow to mark the payment transaction as paid
""",
"author": "BCIM, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"category": "Sales Management",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"depends": ["sale"],
"data": [
"views/sale_order_views.xml",
],
}
26 changes: 26 additions & 0 deletions sale_action_paid/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_action_paid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-27 12:26+0000\n"
"PO-Revision-Date: 2025-06-27 12:26+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_action_paid
#: model_terms:ir.ui.view,arch_db:sale_action_paid.view_order_form
msgid "Paid"
msgstr "Payé"

#. module: sale_action_paid
#: model:ir.model,name:sale_action_paid.model_sale_order
msgid "Sales Order"
msgstr "Commande client"
1 change: 1 addition & 0 deletions sale_action_paid/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
38 changes: 38 additions & 0 deletions sale_action_paid/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2025 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models
from odoo.tools import str2bool


class SaleOrder(models.Model):
_inherit = "sale.order"

def action_paid(self):
auto_invoice = str2bool(
self.env["ir.config_parameter"].sudo().get_param("sale.automatic_invoice")
)
for order in self.filtered(lambda so: so.state in ("draft", "sent")):
txs = order.sudo().transaction_ids.filtered(
lambda t: t.state in ("draft", "pending")
)
tx = txs._get_last()
if not tx:
tx = txs.sorted()[:1]

Check warning on line 21 in sale_action_paid/models/sale_order.py

View check run for this annotation

Codecov / codecov/patch

sale_action_paid/models/sale_order.py#L21

Added line #L21 was not covered by tests
if tx:
tx._set_done()
# Prevent to generate a new payment for marking the invoice as paid.
# This will disable the send_payment_succeeded_for_order_mail,
# auto invoice, invoice sending.
tx.operation = "validation"
tx._post_process()
# recover invoice creation to allow manual payment reconciliation
if auto_invoice:
# Invoice the sales orders of confirmed transactions
# instead of only confirmed orders to create the invoice
# even if only a partial payment was made.
tx._invoice_sale_orders()
tx.invoice_ids.filtered(
lambda inv: inv.state == "draft"
).action_post()
tx.is_post_processed = True
3 changes: 3 additions & 0 deletions sale_action_paid/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions sale_action_paid/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Jacques-Etienne Baudoux (BCIM) \<<je.bcim.be>\>
10 changes: 10 additions & 0 deletions sale_action_paid/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Adds a button "Paid" on a sent sales order.

The action will confirm the SO and the pending payment transaction.
Note that marking as done the payment transaction will change the invoicing
policy to on order (odoo standard). This can also enable standard automatic
invoicing.

This is especially convenient for wire transfer, to mark the SO as paid.
It can also serve for other payment mode in case the postprocessing failed but
the payment went through.
Loading