From 93d86f80e94a829ff31e785c7c2d9aa7f72bd4b6 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 5 Dec 2018 17:03:47 +0100 Subject: [PATCH] sequence_reset_period: backport from v11 to v10 Use new readme subdirectory and improve readme Fix summary and website in manifest --- sequence_reset_period/README.rst | 38 ------------------- sequence_reset_period/__manifest__.py | 8 ++-- sequence_reset_period/models/ir_sequence.py | 5 ++- sequence_reset_period/readme/CONTRIBUTORS.rst | 1 + sequence_reset_period/readme/DESCRIPTION.rst | 1 + sequence_reset_period/readme/USAGE.rst | 3 ++ sequence_reset_period/tests/test_period.py | 3 +- 7 files changed, 15 insertions(+), 44 deletions(-) delete mode 100644 sequence_reset_period/README.rst create mode 100644 sequence_reset_period/readme/CONTRIBUTORS.rst create mode 100644 sequence_reset_period/readme/DESCRIPTION.rst create mode 100644 sequence_reset_period/readme/USAGE.rst diff --git a/sequence_reset_period/README.rst b/sequence_reset_period/README.rst deleted file mode 100644 index ef1ba94..0000000 --- a/sequence_reset_period/README.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.png - :alt: License: LGPL-3 - -===================== -Sequence Reset period -===================== - -This module was written to reset the sequences on the specified times, because -by default they are reset yearly. - -Usage -===== - -* Access sequences and configurate the model to use. -* When sequence is computed, date_range will follow the specified rules - -Credits -======= - -Contributors ------------- - -* Enric Tobella - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -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. - -To contribute to this module, please visit https://odoo-community.org. diff --git a/sequence_reset_period/__manifest__.py b/sequence_reset_period/__manifest__.py index d8402ce..54ebaf1 100644 --- a/sequence_reset_period/__manifest__.py +++ b/sequence_reset_period/__manifest__.py @@ -1,17 +1,19 @@ +# -*- coding: utf-8 -*- # Copyright (C) 2017 Creu Blanca # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). { "name": "Reset Sequences on selected period ranges", - "version": "11.0.1.0.0", + "version": "10.0.1.0.0", "category": "Reporting", - "website": "https://github.com/OCA/server-tools", + "website": "https://github.com/OCA/server-ux", "author": "Creu Blanca, " "Odoo Community Association (OCA)", "license": "LGPL-3", "installable": True, "application": False, - "summary": "Adds a check digit on sequences", + "summary": "Auto-generate yearly/monthly/weekly/daily sequence " + "period ranges", "depends": [ "base", ], diff --git a/sequence_reset_period/models/ir_sequence.py b/sequence_reset_period/models/ir_sequence.py index 2e2aca7..aa4a7db 100644 --- a/sequence_reset_period/models/ir_sequence.py +++ b/sequence_reset_period/models/ir_sequence.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (C) 2017 Creu Blanca # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). @@ -13,7 +14,7 @@ class IrSequence(models.Model): ('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly'), - ('yearly', 'Yearly') + ('yearly', 'Yearly'), ]) def _compute_date_from_to(self, date): @@ -34,7 +35,7 @@ class IrSequence(models.Model): def _create_date_range_seq(self, date): self.ensure_one() if not self.range_reset: - return super()._create_date_range_seq(date) + return super(IrSequence, self)._create_date_range_seq(date) date_from, date_to = self._compute_date_from_to(date) date_range = self.env['ir.sequence.date_range'].search( [('sequence_id', '=', self.id), ('date_from', '>=', date), diff --git a/sequence_reset_period/readme/CONTRIBUTORS.rst b/sequence_reset_period/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..93ec993 --- /dev/null +++ b/sequence_reset_period/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Enric Tobella diff --git a/sequence_reset_period/readme/DESCRIPTION.rst b/sequence_reset_period/readme/DESCRIPTION.rst new file mode 100644 index 0000000..96b0122 --- /dev/null +++ b/sequence_reset_period/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +On a sequence, when the option *Use subsequence per date_range* is enabled, Odoo will auto-create new yearly subsequence when you start to work on a new year. This module adds a new configuration option to auto-create daily, weekly, monthly or yealy subsequence. diff --git a/sequence_reset_period/readme/USAGE.rst b/sequence_reset_period/readme/USAGE.rst new file mode 100644 index 0000000..b070e00 --- /dev/null +++ b/sequence_reset_period/readme/USAGE.rst @@ -0,0 +1,3 @@ +* Go to the menu *Settings > Technical > Sequences and Identifiers > Sequences* and select the sequence you want to reconfigure. +* Enable the option *Use subsequence par date_range* +* You will see a new field *Range reset* for which you can choose between Daily, Weekly, Monthly or Yearly. diff --git a/sequence_reset_period/tests/test_period.py b/sequence_reset_period/tests/test_period.py index 07cbce6..e7f6d3a 100644 --- a/sequence_reset_period/tests/test_period.py +++ b/sequence_reset_period/tests/test_period.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright 2017 Creu Blanca # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). @@ -8,7 +9,7 @@ from datetime import datetime class TestSequence(common.TransactionCase): def setUp(self): - super().setUp() + super(TestSequence, self).setUp() self.date = datetime(2018, 3, 14).strftime('%Y-%m-%d') def get_sequence(self, method):