Skip to content
Permalink
Browse files

⬆️1️⃣1️⃣ autostaging_base *Port*

  • Loading branch information...
Ommo73 committed Feb 11, 2019
1 parent f8ff6e4 commit 6502ef93ac5058ace221524eed335de9e6ab60d3
@@ -1,5 +1,49 @@
Autostaging (technical core)
============================
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3

==================
Autostaging base
==================

Tested on Odoo 8.0 a0797d3b35cc235048e7947dd7a3d38e18c3e350
Change stages of records automatically after a specified time

The records which are not modified within the idle timeout automatically moved to the next stage

Credits
=======

Contributors
------------
* 'Ildar Nasyrov <iledarn@it-projects.info>'__

Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__

Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__

To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/autostaging_base/>`__.

Thank you for understanding!

`IT-Projects Team <https://www.it-projects.info/team>`__

Further information
===================

Demo: http://runbot.it-projects.info/demo/misc-addons/11.0

HTML Description: https://apps.odoo.com/apps/modules/11.0/autostaging_base/

Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Notifications on updates: `via Atom <https://github.com/it-projects-llc/misc-addons/commits/11.0/autostaging_base.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/misc-addons/commits/11.0/autostaging_base.atom>`_

Tested on Odoo 11.0 a54b65bbb2f582136b0a358a4a576d3c38b0369e
@@ -1 +1,2 @@
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from . import models
@@ -1,12 +1,50 @@
# Copyright 2015-2017 Ildar Nasyrov <https://it-projects.info/>
# Copyright 2018 Ruslan Ronzhin <https://it-projects.info/team/rusllan/>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
{
'name': "Autostaging (technical core)",
'author': "IT-Projects LLC, Ildar Nasyrov",
'license': 'LGPL-3',
'website': "https://twitter.com/nasyrov_ildar",
'category': 'Autostaging',
'version': '1.0.0',
'data': [
'data.xml',
],
"installable": False
"name": """Autostaging (technical core)""",
"summary": """Change stages automatically after a specified time""",
"category": "Hidden",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version=11.0",
"images": [],
"version": "11.0.1.0.0",
"application": False,

"author": "IT-Projects LLC, Ildar Nasyrov",
"support": "apps@it-projects.info",
"website": "https://it-projects.info/",
"license": "LGPL-3",
# "price": 9.00,
# "currency": "EUR",

"depends": [
],
"external_dependencies": {"python": [], "bin": []},
"data": [
"data.xml",
],
"demo": [
],
"qweb": [
],

"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"uninstall_hook": None,

"auto_install": False,
"installable": True,

# "demo_title": "{MODULE_NAME}",
# "demo_addons": [
# ],
# "demo_addons_hidden": [
# ],
# "demo_url": "DEMO-URL",
# "demo_summary": "{SHORT_DESCRIPTION_OF_THE_MODULE}",
# "demo_images": [
# "images/MAIN_IMAGE",
# ]
}
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2015 Ildar Nasyrov <https://it-projects.info/>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<openerp>
<data>
<!-- Cron job for automatically move -->
<record forcecreate="True" id="ir_cron_autostaging"
<record id="ir_cron_autostaging" forcecreate="True"
model="ir.cron">
<field name="name">Autostaging</field>
<field eval="True" name="active" />
@@ -11,9 +13,9 @@
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field eval="'autostaging.card'" name="model" />
<field eval="'_cron_move_cards'" name="function" />
<field eval="'()'" name="args" />
<field name="model_id" ref="model_autostaging_card"/>
<field name="state">code</field>
<field name="code">model._cron_move_cards()</field>
</record>
</data>
</openerp>
@@ -0,0 +1,7 @@
Changelog
=========

`1.0.0`
-------

- Init version
@@ -0,0 +1,8 @@
==================
Autostaging base
==================

Installation
============

* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
@@ -1,9 +1,13 @@

from openerp import models, fields, api
# Copyright 2015 Ildar Nasyrov <https://it-projects.info/>
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2017-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from odoo import models, fields, api
import datetime
import time
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.exceptions import ValidationError
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
from odoo.exceptions import ValidationError
from odoo.tools.translate import _


@@ -67,7 +71,6 @@ def _compute_enabled_one(self):
@api.multi
def _get_autostaging_date(self):
self.ensure_one()

delta = datetime.timedelta(days=getattr(self, self._field_stage_id).autostaging_idle_timeout)
return (datetime.datetime.strptime(
self.write_date, DEFAULT_SERVER_DATETIME_FORMAT) + delta).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
@@ -112,7 +115,7 @@ def _compute_autostaging_days_left_one(self):

def _get_model_list(self):
res = []
for r in self.env['ir.model.fields'].search([('name', '=', 'next_stage_related')]):
for r in self.env['ir.model.fields'].search([('name', '=', 'autostaging_card_next_stage')]):
res.append(r.model_id.model)
return res

@@ -128,9 +131,9 @@ def _move_cards(self):
(self._field_folder_id, '=', False),
'&', '&',
((self._field_stage_id + '.autostaging_enabled'), '=', True),
((self._field_stage_id + '.next_stage'), '!=', False),
((self._field_stage_id + '.autostaging_next_stage'), '!=', False),
('autostaging_date', '<=', time.strftime('%Y-%m-%d'))]
cards = self.search(domain)
for card in cards:
card.with_context(autostaging=True).write(
{self._field_stage_id: getattr(card, self._field_stage_id).next_stage.id})
{self._field_stage_id: getattr(card, self._field_stage_id).autostaging_next_stage.id})
Binary file not shown.

0 comments on commit 6502ef9

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.