Skip to content

Commit

Permalink
Merge PR #1033 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Nov 24, 2023
2 parents 5041355 + 8eddba9 commit f1c698a
Show file tree
Hide file tree
Showing 16 changed files with 676 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ odoo_test_flavor: OCB
odoo_version: 12.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups: []
rebel_module_groups:
- pos_bank_statement_line_no_change
- pos_payment_change
repo_description: This project aims to deal with Odoo modules related to the Point
of Sale.
repo_name: Point of Sale
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ jobs:
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest
include: "pos_payment_change"
name: test with OCB
makepot: "true"
- container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest
include: "pos_bank_statement_line_no_change"
name: test with OCB
makepot: "true"
- container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest
exclude: "pos_payment_change,pos_bank_statement_line_no_change"
name: test with OCB
makepot: "true"
services:
Expand All @@ -47,6 +56,9 @@ jobs:
POSTGRES_DB: odoo
ports:
- 5432:5432
env:
INCLUDE: "${{ matrix.include }}"
EXCLUDE: "${{ matrix.exclude }}"
steps:
- uses: actions/checkout@v3
with:
Expand Down
87 changes: 87 additions & 0 deletions pos_bank_statement_line_no_change/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
=====================================
Point of Sale - No Unlink Order Lines
=====================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fpos-lightgray.png?logo=github
:target: https://github.com/OCA/pos/tree/12.0/pos_order_line_no_unlink
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_order_line_no_unlink
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/184/12.0
:alt: Try me on Runbot

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

This module extends the functionality of Point of Sale to prevent to delete
order lines, if there are related to done or invoiced orders.

This module is a fix of Odoo Core.

You should install it if you have certification module installed. Otherwise,
unlinking order lines will break the certification.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_order_line_no_unlink%0Aversion:%2012.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
~~~~~~~

* GRAP

Contributors
~~~~~~~~~~~~

* Sylvain LE GAL <https://twitter.com/legalsylvain>

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.

.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
:target: https://github.com/legalsylvain
:alt: legalsylvain

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/12.0/pos_order_line_no_unlink>`_ 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 pos_bank_statement_line_no_change/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions pos_bank_statement_line_no_change/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2023 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Point of Sale - No Alter Bank statement lines of Pos Orders",
"summary": "Prevent to write or unlink bank statements lines"
" related to paid or invoiced Pos Orders",
"version": "12.0.1.0.1",
"category": "Point of Sale",
"author": "GRAP,Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": ["point_of_sale"],
}
Empty file.
1 change: 1 addition & 0 deletions pos_bank_statement_line_no_change/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_bank_statement_line
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (C) 2023 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import _, api, models
from odoo.exceptions import UserError


class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"

_POS_PROTECTED_FIELDS = [
"amount",
"partner_id",
]

@api.multi
def write(self, vals):
if (self.filtered(
lambda x: x.pos_statement_id.state in ["paid", "done", "invoiced"]
) and set(vals.keys()).intersection(self._POS_PROTECTED_FIELDS)):
raise UserError(_(
"You can not alter bank statement lines that are related"
" to orders in paid, done or invoiced state."))
return super().write(vals)

@api.multi
def unlink(self):
if self.filtered(
lambda x: x.pos_statement_id.state in ["paid", "done", "invoiced"]
):
raise UserError(_(
"You can not unlink bank statement lines that are related"
" to orders in paid, done or invoiced state."))
return super().unlink()
1 change: 1 addition & 0 deletions pos_bank_statement_line_no_change/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Sylvain LE GAL <https://twitter.com/legalsylvain>
4 changes: 4 additions & 0 deletions pos_bank_statement_line_no_change/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module extends the functionality of Point of Sale to prevent to update or delete
bank statement lines, if there are related to done or invoiced orders.

This module is a fix of Odoo Core.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f1c698a

Please sign in to comment.