Browse Source

sequence_reset_period: backport from v11 to v10

Use new readme subdirectory and improve readme
Fix summary and website in manifest
pull/43/head
Alexis de Lattre 6 years ago
parent
commit
93d86f80e9
  1. 38
      sequence_reset_period/README.rst
  2. 8
      sequence_reset_period/__manifest__.py
  3. 5
      sequence_reset_period/models/ir_sequence.py
  4. 1
      sequence_reset_period/readme/CONTRIBUTORS.rst
  5. 1
      sequence_reset_period/readme/DESCRIPTION.rst
  6. 3
      sequence_reset_period/readme/USAGE.rst
  7. 3
      sequence_reset_period/tests/test_period.py

38
sequence_reset_period/README.rst

@ -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 <etobella@creublanca.es>
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.

8
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",
],

5
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),

1
sequence_reset_period/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Enric Tobella <etobella@creublanca.es>

1
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.

3
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.

3
sequence_reset_period/tests/test_period.py

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Creu Blanca <https://creublanca.es/>
# 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):

Loading…
Cancel
Save