Browse Source

[ADD] setup.py

pull/64/head
OCA-git-bot 6 years ago
committed by Jaume Planas
parent
commit
26271dce58
  1. 67
      base_export_manager/i18n/base_export_manager.pot
  2. 2
      base_tier_validation_formula/__manifest__.py
  3. 38
      sequence_reset_period/README.rst
  4. 1
      sequence_reset_period/__init__.py
  5. 22
      sequence_reset_period/__manifest__.py
  6. 47
      sequence_reset_period/i18n/es.po
  7. 45
      sequence_reset_period/i18n/sequence_reset_period.pot
  8. 1
      sequence_reset_period/models/__init__.py
  9. 58
      sequence_reset_period/models/ir_sequence.py
  10. BIN
      sequence_reset_period/static/description/icon.png
  11. 1
      sequence_reset_period/tests/__init__.py
  12. 71
      sequence_reset_period/tests/test_period.py
  13. 12
      sequence_reset_period/views/sequence_views.xml
  14. 2
      setup/_metapackage/VERSION.txt
  15. 1
      setup/_metapackage/setup.py
  16. 1
      setup/base_export_manager/odoo/addons/base_export_manager
  17. 6
      setup/base_export_manager/setup.py

67
base_export_manager/i18n/base_export_manager.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
@ -14,15 +14,14 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: base_export_manager #. module: base_export_manager
#: model:ir.model.fields,help:base_export_manager.field_ir_exports_line__model1_id
#: model:ir.model.fields,help:base_export_manager.field_ir_exports__model_id #: model:ir.model.fields,help:base_export_manager.field_ir_exports__model_id
#: model:ir.model.fields,help:base_export_manager.field_ir_exports_line__model1_id
msgid "Database model to export." msgid "Database model to export."
msgstr "" msgstr ""
#. module: base_export_manager #. module: base_export_manager
#. openerp-web #. openerp-web
#: code:addons/base_export_manager/static/src/js/base_export_manager.js:18 #: code:addons/base_export_manager/static/src/js/base_export_manager.js:18
#: code:addons/base_export_manager/static/src/js/base_export_manager.js:39
#, python-format #, python-format
msgid "Export" msgid "Export"
msgstr "" msgstr ""
@ -32,6 +31,11 @@ msgstr ""
msgid "Export Access" msgid "Export Access"
msgstr "" msgstr ""
#. module: base_export_manager
#: model:ir.model.fields,field_description:base_export_manager.field_ir_exports__name
msgid "Export Name"
msgstr ""
#. module: base_export_manager #. module: base_export_manager
#: model_terms:ir.ui.view,arch_db:base_export_manager.ir_exports_form_view #: model_terms:ir.ui.view,arch_db:base_export_manager.ir_exports_form_view
msgid "Export Profile" msgid "Export Profile"
@ -44,6 +48,16 @@ msgstr ""
msgid "Export Profiles" msgid "Export Profiles"
msgstr "" msgstr ""
#. module: base_export_manager
#: model:ir.model,name:base_export_manager.model_ir_exports
msgid "Exports"
msgstr ""
#. module: base_export_manager
#: model:ir.model,name:base_export_manager.model_ir_exports_line
msgid "Exports Line"
msgstr ""
#. module: base_export_manager #. module: base_export_manager
#: code:addons/base_export_manager/models/ir_exports_line.py:171 #: code:addons/base_export_manager/models/ir_exports_line.py:171
#, python-format #, python-format
@ -62,6 +76,16 @@ msgstr ""
msgid "Field '%s' not found in model '%s'" msgid "Field '%s' not found in model '%s'"
msgstr "" msgstr ""
#. module: base_export_manager
#: model:ir.model.fields,field_description:base_export_manager.field_ir_exports_line__name
msgid "Field Name"
msgstr ""
#. module: base_export_manager
#: model:ir.model.fields,help:base_export_manager.field_ir_exports_line__name
msgid "Field's technical name."
msgstr ""
#. module: base_export_manager #. module: base_export_manager
#: model:ir.model.fields,field_description:base_export_manager.field_ir_exports_line__field1_id #: model:ir.model.fields,field_description:base_export_manager.field_ir_exports_line__field1_id
msgid "First field" msgid "First field"
@ -82,6 +106,11 @@ msgstr ""
msgid "Fourth model" msgid "Fourth model"
msgstr "" msgstr ""
#. module: base_export_manager
#: model:ir.model,name:base_export_manager.model_ir_http
msgid "HTTP Routing"
msgstr ""
#. module: base_export_manager #. module: base_export_manager
#: code:addons/base_export_manager/models/ir_exports_line.py:135 #: code:addons/base_export_manager/models/ir_exports_line.py:135
#, python-format #, python-format
@ -98,13 +127,28 @@ msgstr ""
msgid "Model" msgid "Model"
msgstr "" msgstr ""
#. module: base_export_manager
#: model:ir.model,name:base_export_manager.model_ir_model_access
msgid "Model Access"
msgstr ""
#. module: base_export_manager
#: model:ir.model.fields,help:base_export_manager.field_ir_exports__resource
msgid "Model's technical name."
msgstr ""
#. module: base_export_manager
#: model:ir.model.fields,field_description:base_export_manager.field_ir_exports__resource
msgid "Resource"
msgstr ""
#. module: base_export_manager #. module: base_export_manager
#: model:ir.model.fields,field_description:base_export_manager.field_ir_exports_line__field2_id #: model:ir.model.fields,field_description:base_export_manager.field_ir_exports_line__field2_id
msgid "Second field" msgid "Second field"
msgstr "" msgstr ""
#. module: base_export_manager #. module: base_export_manager
#: model:ir.model.fields,field_description:base_export_manager.field_ir_exports_line_model2_id
#: model:ir.model.fields,field_description:base_export_manager.field_ir_exports_line__model2_id
msgid "Second model" msgid "Second model"
msgstr "" msgstr ""
@ -134,18 +178,3 @@ msgstr ""
msgid "You must supply a model or resource." msgid "You must supply a model or resource."
msgstr "" msgstr ""
#. module: base_export_manager
#: model:ir.model,name:base_export_manager.model_ir_exports
msgid "Exports"
msgstr ""
#. module: base_export_manager
#: model:ir.model,name:base_export_manager.model_ir_exports_line
msgid "Exports Line"
msgstr ""
#. module: base_export_manager
#: model:ir.model,name:base_export_manager.model_ir_model_access
msgid "Model Access"
msgstr ""

2
base_tier_validation_formula/__manifest__.py

@ -8,7 +8,7 @@
'version': '12.0.1.0.0', 'version': '12.0.1.0.0',
'license': 'AGPL-3', 'license': 'AGPL-3',
'author': 'Creu Blanca,Odoo Community Association (OCA)', 'author': 'Creu Blanca,Odoo Community Association (OCA)',
'website': 'www.creublanca.es',
'website': 'https://github.com/OCA/server-ux',
'depends': [ 'depends': [
'base_tier_validation' 'base_tier_validation'
], ],

38
sequence_reset_period/README.rst

@ -0,0 +1,38 @@
.. 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.

1
sequence_reset_period/__init__.py

@ -0,0 +1 @@
from . import models

22
sequence_reset_period/__manifest__.py

@ -0,0 +1,22 @@
# 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",
"category": "Reporting",
"website": "https://github.com/OCA/server-ux",
"author": "Creu Blanca, "
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"installable": True,
"application": False,
"summary": "Auto-generate yearly/monthly/weekly/daily sequence "
"period ranges",
"depends": [
"base",
],
"data": [
"views/sequence_views.xml",
],
}

47
sequence_reset_period/i18n/es.po

@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sequence_reset_period
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2018-07-13 08:46+0000\n"
"Last-Translator: Enric Tobella <etobella@creublanca.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.0.1\n"
#. module: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Daily"
msgstr "Diario"
#. module: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Monthly"
msgstr "Mensual"
#. module: sequence_reset_period
#: model:ir.model.fields,field_description:sequence_reset_period.field_ir_sequence_range_reset
msgid "Range Reset"
msgstr "Reinicio del Rango"
#. module: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Weekly"
msgstr "Semanal"
#. module: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Yearly"
msgstr "Anual"
#. module: sequence_reset_period
#: model:ir.model,name:sequence_reset_period.model_ir_sequence
msgid "ir.sequence"
msgstr "ir.sequence"

45
sequence_reset_period/i18n/sequence_reset_period.pot

@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sequence_reset_period
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \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: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Daily"
msgstr ""
#. module: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Monthly"
msgstr ""
#. module: sequence_reset_period
#: model:ir.model.fields,field_description:sequence_reset_period.field_ir_sequence_range_reset
msgid "Range Reset"
msgstr ""
#. module: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Weekly"
msgstr ""
#. module: sequence_reset_period
#: selection:ir.sequence,range_reset:0
msgid "Yearly"
msgstr ""
#. module: sequence_reset_period
#: model:ir.model,name:sequence_reset_period.model_ir_sequence
msgid "ir.sequence"
msgstr ""

1
sequence_reset_period/models/__init__.py

@ -0,0 +1 @@
from . import ir_sequence

58
sequence_reset_period/models/ir_sequence.py

@ -0,0 +1,58 @@
# Copyright (C) 2017 Creu Blanca
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models
from datetime import datetime, timedelta, date as datetime_date
from dateutil.relativedelta import relativedelta
class IrSequence(models.Model):
_inherit = "ir.sequence"
range_reset = fields.Selection([
('daily', 'Daily'),
('weekly', 'Weekly'),
('monthly', 'Monthly'),
('yearly', 'Yearly')
])
def _compute_date_from_to(self, date):
self.ensure_one()
date_from = date_to = fields.Date.from_string(date)
if self.range_reset == 'weekly':
date_from = date_from - timedelta(days=date_from.weekday())
date_to = date_from + timedelta(days=6)
elif self.range_reset == 'monthly':
date_from = datetime_date(date_from.year, date_from.month, 1)
date_to = date_from + relativedelta(months=1)
date_to += relativedelta(days=-1)
elif self.range_reset == 'yearly':
date_from = datetime_date(date_from.year, 1, 1)
date_to = datetime_date(date_from.year, 12, 31)
return date_from.strftime('%Y-%m-%d'), date_to.strftime('%Y-%m-%d')
def _create_date_range_seq(self, date):
self.ensure_one()
if not self.range_reset:
return super()._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),
('date_from', '<=', date_to)], order='date_from desc', limit=1)
if date_range:
date_to = datetime.strptime(date_range.date_from,
'%Y-%m-%d') + timedelta(days=-1)
date_to = date_to.strftime('%Y-%m-%d')
date_range = self.env['ir.sequence.date_range'].search(
[('sequence_id', '=', self.id), ('date_to', '>=', date_from),
('date_to', '<=', date)], order='date_to desc', limit=1)
if date_range:
date_from = datetime.strptime(date_range.date_to,
'%Y-%m-%d') + timedelta(days=1)
date_from = date_from.strftime('%Y-%m-%d')
seq_date_range = self.env['ir.sequence.date_range'].sudo().create({
'date_from': date_from,
'date_to': date_to,
'sequence_id': self.id,
})
return seq_date_range

BIN
sequence_reset_period/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

1
sequence_reset_period/tests/__init__.py

@ -0,0 +1 @@
from . import test_period

71
sequence_reset_period/tests/test_period.py

@ -0,0 +1,71 @@
# Copyright 2017 Creu Blanca <https://creublanca.es/>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.tests import common
from datetime import datetime
class TestSequence(common.TransactionCase):
def setUp(self):
super().setUp()
self.date = datetime(2018, 3, 14).strftime('%Y-%m-%d')
def get_sequence(self, method):
return self.env['ir.sequence'].create({
'name': 'Test sequence',
'implementation': 'standard',
'use_date_range': True,
'range_reset': method,
'padding': '5'
})
def test_none(self):
sequence = self.get_sequence(False)
self.assertFalse(sequence.date_range_ids)
self.assertEqual('00001', sequence.with_context(
ir_sequence_date=self.date).next_by_id())
range = sequence.date_range_ids
self.assertTrue(range)
self.assertEqual('2018-01-01', range.date_from)
self.assertEqual('2018-12-31', range.date_to)
def test_daily(self):
sequence = self.get_sequence('daily')
self.assertFalse(sequence.date_range_ids)
self.assertEqual('00001', sequence.with_context(
ir_sequence_date=self.date).next_by_id())
range = sequence.date_range_ids
self.assertTrue(range)
self.assertEqual(self.date, range.date_from)
self.assertEqual(self.date, range.date_to)
def test_weekly(self):
sequence = self.get_sequence('weekly')
self.assertFalse(sequence.date_range_ids)
self.assertEqual('00001', sequence.with_context(
ir_sequence_date=self.date).next_by_id())
range = sequence.date_range_ids
self.assertTrue(range)
self.assertEqual('2018-03-12', range.date_from)
self.assertEqual('2018-03-18', range.date_to)
def test_monthly(self):
sequence = self.get_sequence('monthly')
self.assertFalse(sequence.date_range_ids)
self.assertEqual('00001', sequence.with_context(
ir_sequence_date=self.date).next_by_id())
range = sequence.date_range_ids
self.assertTrue(range)
self.assertEqual('2018-03-01', range.date_from)
self.assertEqual('2018-03-31', range.date_to)
def test_yearly(self):
sequence = self.get_sequence('yearly')
self.assertFalse(sequence.date_range_ids)
self.assertEqual('00001', sequence.with_context(
ir_sequence_date=self.date).next_by_id())
range = sequence.date_range_ids
self.assertTrue(range)
self.assertEqual('2018-01-01', range.date_from)
self.assertEqual('2018-12-31', range.date_to)

12
sequence_reset_period/views/sequence_views.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="sequence_view" model="ir.ui.view">
<field name="model">ir.sequence</field>
<field name="inherit_id" ref="base.sequence_view"/>
<field name="arch" type="xml">
<field name="use_date_range" position="after">
<field name="range_reset" attrs="{'invisible': [('use_date_range','=', False)]}"/>
</field>
</field>
</record>
</odoo>

2
setup/_metapackage/VERSION.txt

@ -1 +1 @@
12.0.20190528.0
12.0.20190605.0

1
setup/_metapackage/setup.py

@ -8,6 +8,7 @@ setuptools.setup(
description="Meta package for oca-server-ux Odoo addons", description="Meta package for oca-server-ux Odoo addons",
version=version, version=version,
install_requires=[ install_requires=[
'odoo12-addon-base_export_manager',
'odoo12-addon-base_technical_features', 'odoo12-addon-base_technical_features',
'odoo12-addon-base_tier_validation', 'odoo12-addon-base_tier_validation',
'odoo12-addon-base_tier_validation_formula', 'odoo12-addon-base_tier_validation_formula',

1
setup/base_export_manager/odoo/addons/base_export_manager

@ -0,0 +1 @@
../../../../base_export_manager

6
setup/base_export_manager/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save