Skip to content

Commit

Permalink
Sale orders with state cancel now also removed by abandoned_carts
Browse files Browse the repository at this point in the history
  • Loading branch information
ozoromo committed Jul 24, 2024
1 parent 2edd484 commit 690886c
Show file tree
Hide file tree
Showing 9 changed files with 499 additions and 9 deletions.
4 changes: 2 additions & 2 deletions abandoned_carts/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Abandoned Carts
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b2bb1241a503d410a6cd3968a08bfd8862738faaa20fb4bc813277877c2afa0d
!! source digest: sha256:fb4138f2fc2971fec299a8ed6402ebb4f0d234d4c1835ef022c7a0ca9a98b24b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -43,7 +43,7 @@ Algorithm

This module identifies orders as abandoned (and to be deleted) if all of the following is true:

`("state = draft" or "state = sent") and "website_id is set" and "(current_time - create_date) < abandoned_carts.order_retention_period" and "create_uid = system_user"`
`("state = draft" or "state = sent" or "state = cancelled") and "website_id is set" and "(current_time - create_date) < abandoned_carts.order_retention_period" and "create_uid = system_user"`

These orders will be displayed in "Abandoned orders" and can be deleted manually.

Expand Down
2 changes: 1 addition & 1 deletion abandoned_carts/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Algorithm

This module identifies orders as abandoned (and to be deleted) if all of the following is true:

`("state = draft" or "state = sent") and "website_id is set" and "(current_time - create_date) < abandoned_carts.order_retention_period" and "create_uid = system_user"`
`("state = draft" or "state = sent" or "state = cancelled") and "website_id is set" and "(current_time - create_date) < abandoned_carts.order_retention_period" and "create_uid = system_user"`

These orders will be displayed in "Abandoned orders" and can be deleted manually.

Expand Down
4 changes: 2 additions & 2 deletions abandoned_carts/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Abandoned Carts</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b2bb1241a503d410a6cd3968a08bfd8862738faaa20fb4bc813277877c2afa0d
!! source digest: sha256:fb4138f2fc2971fec299a8ed6402ebb4f0d234d4c1835ef022c7a0ca9a98b24b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/odoo-modules/tree/15.0/abandoned_carts"><img alt="OCA/odoo-modules" src="https://img.shields.io/badge/github-OCA%2Fodoo--modules-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/odoo-modules-15-0/odoo-modules-15-0-abandoned_carts"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/odoo-modules&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to delete Quotations and related partner records when those are older than a definable retention period.</p>
Expand All @@ -380,7 +380,7 @@ <h1 class="title">Abandoned Carts</h1>
<div class="section" id="algorithm">
<h1>Algorithm</h1>
<p>This module identifies orders as abandoned (and to be deleted) if all of the following is true:</p>
<p><cite>(“state = draft” or “state = sent”) and “website_id is set” and “(current_time - create_date) &lt; abandoned_carts.order_retention_period” and “create_uid = system_user”</cite></p>
<p><cite>(“state = draft” or “state = sent” or “state = cancelled”) and “website_id is set” and “(current_time - create_date) &lt; abandoned_carts.order_retention_period” and “create_uid = system_user”</cite></p>
<p>These orders will be displayed in “Abandoned orders” and can be deleted manually.</p>
<p>Customers, which have
<cite>“lead = 0” and “meetings = 0” and “is_employee = false” and “helpdesk_tickets = 0” and “newsletter_subscriptions = 0” and “phonecalls = 0” and “orders = 0” and “account moves = 0” and “tasks = 0” and “portal or user account = 0” and “parent_id = NULL” and “is_company = false” and “create_uid = system_user” and “payment_transaction = 0”</cite></p>
Expand Down
2 changes: 1 addition & 1 deletion abandoned_carts/wizard/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def default_get(self, fields):
res = super().default_get(fields)
system_user = self.sudo().env.ref("base.user_root", False)
domain = [
("state", "in", ["draft", "sent"]),
("state", "in", ["draft", "sent", "cancel"]),
("create_date", "<", date.strftime(DF)),
("website_id", "!=", False),
]
Expand Down
71 changes: 71 additions & 0 deletions datev_export_dtvf_nitrokey/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
=============================
DATEV, nitrokey customization
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:10da060214e3bf7dfdceff5df497ae58135bd3218e4e1ff8c8afcb23213090e1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fodoo--modules-lightgray.png?logo=github
:target: https://github.com/OCA/odoo-modules/tree/15.0/datev_export_dtvf_nitrokey
:alt: OCA/odoo-modules
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/odoo-modules-15-0/odoo-modules-15-0-datev_export_dtvf_nitrokey
: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/odoo-modules&target_branch=15.0
:alt: Try me on Runboat

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

This module Exports Data for DATEV (dtvf)

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/odoo-modules/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/odoo-modules/issues/new?body=module:%20datev_export_dtvf_nitrokey%0Aversion:%2015.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
~~~~~~~

* Hunki Enterprises BV

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/odoo-modules <https://github.com/OCA/odoo-modules/tree/15.0/datev_export_dtvf_nitrokey>`_ 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 datev_export_dtvf_nitrokey/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
"depends": [
"datev_export_dtvf",
],
"website": "https://github.com/OCA/server-tools",
}
7 changes: 4 additions & 3 deletions datev_export_dtvf_nitrokey/models/datev_export_dtvf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
class DatevExportDtvfExport(models.Model):
_inherit = "datev_export_dtvf.export"


def _get_data_transaction(self, move):
"""Try to export whatever looks like an SO number as "Belegfeld 1" """
for data in super()._get_data_transaction(move):
for line in move.line_ids:
for field_name in ('ref', 'name', 'move_name'):
if (line[field_name] or '').startswith('SO') or (line[field_name] or '').startswith('EK'):
for field_name in ("ref", "name", "move_name"):
if (line[field_name] or "").startswith("SO") or (
line[field_name] or ""
).startswith("EK"):
data["Belegfeld 1"] = line[field_name]
yield data
1 change: 1 addition & 0 deletions datev_export_dtvf_nitrokey/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module Exports Data for DATEV (dtvf)
Loading

0 comments on commit 690886c

Please sign in to comment.