[MOV] base_action_rule: rename and move base_action_rule to base_automation
First step towards cleaning and improving automated actions is to correctly name things. base_action_rule module is therefore renamed to base_automation. Model is also renamed to base.automation.
This commit is contained in:
committed by
Thibault Delavallée
parent
1c79c5ee30
commit
319a939339
+3
-3
@@ -107,9 +107,9 @@ file_filter = addons/barcodes/i18n/<lang>.po
|
||||
source_file = addons/barcodes/i18n/barcodes.pot
|
||||
source_lang = en
|
||||
|
||||
[odoo-master.base_action_rule]
|
||||
file_filter = addons/base_action_rule/i18n/<lang>.po
|
||||
source_file = addons/base_action_rule/i18n/base_action_rule.pot
|
||||
[odoo-master.base_automation]
|
||||
file_filter = addons/base_automation/i18n/<lang>.po
|
||||
source_file = addons/base_automation/i18n/base_automation.pot
|
||||
source_lang = en
|
||||
|
||||
[odoo-master.base_gengo]
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_base_action_rule,base.action.rule,model_base_action_rule,,1,0,0,0
|
||||
access_base_action_rule_config,base.action.rule config,model_base_action_rule,base.group_system,1,1,1,1
|
||||
access_base_action_rule_lead_test,access_base_action_rule_lead_test,model_base_action_rule_lead_test,base.group_system,1,1,1,1
|
||||
access_base_action_rule_line_test,access_base_action_rule_line_test,model_base_action_rule_line_test,base.group_system,1,1,1,1
|
||||
|
@@ -18,10 +18,10 @@ trigger an automatic reminder email.
|
||||
'depends': ['base', 'resource', 'mail'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/base_action_rule_data.xml',
|
||||
'views/base_action_rule_view.xml',
|
||||
'data/base_automation_data.xml',
|
||||
'views/base_automation_view.xml',
|
||||
],
|
||||
'demo': [
|
||||
'data/base_action_rule_demo.xml',
|
||||
'data/base_automation_demo.xml',
|
||||
],
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="ir_cron_data_bar_check" model="ir.cron">
|
||||
<record id="ir_cron_data_base_automation_check" model="ir.cron">
|
||||
<field name="name">Base Action Rule: check and execute</field>
|
||||
<field name="model_id" ref="model_base_action_rule"/>
|
||||
<field name="model_id" ref="model_base_automation"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model._check(True)</field>
|
||||
<field name="interval_number">4</field>
|
||||
+11
-11
@@ -2,51 +2,51 @@
|
||||
<odoo>
|
||||
<record id="test_filter_draft" model="ir.filters">
|
||||
<field name="name">Test lead in state 'draft'</field>
|
||||
<field name="model_id">base.action.rule.lead.test</field>
|
||||
<field name="model_id">base.automation.lead.test</field>
|
||||
<field name="domain">[('state', '=', 'draft')]</field>
|
||||
</record>
|
||||
|
||||
<record id="test_filter_open" model="ir.filters">
|
||||
<field name="name">Test lead in state 'open'</field>
|
||||
<field name="model_id">base.action.rule.lead.test</field>
|
||||
<field name="model_id">base.automation.lead.test</field>
|
||||
<field name="domain">[('state', '=', 'open')]</field>
|
||||
</record>
|
||||
|
||||
<record id="test_filter_done" model="ir.filters">
|
||||
<field name="name">Test lead in state 'done'</field>
|
||||
<field name="model_id">base.action.rule.lead.test</field>
|
||||
<field name="model_id">base.automation.lead.test</field>
|
||||
<field name="domain">[('state', '=', 'done')]</field>
|
||||
</record>
|
||||
|
||||
<record id="test_rule_on_create" model="base.action.rule">
|
||||
<record id="test_rule_on_create" model="base.automation">
|
||||
<field name="name">Test rule on create</field>
|
||||
<field name="kind">on_create</field>
|
||||
<field name="model_id" ref="base_action_rule.model_base_action_rule_lead_test"/>
|
||||
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
|
||||
<field name="act_user_id" ref="base.user_demo"/>
|
||||
<field name="filter_id" ref="test_filter_draft"/>
|
||||
</record>
|
||||
|
||||
<record id="test_rule_on_write" model="base.action.rule">
|
||||
<record id="test_rule_on_write" model="base.automation">
|
||||
<field name="name">Test rule on write</field>
|
||||
<field name="kind">on_write</field>
|
||||
<field name="model_id" ref="base_action_rule.model_base_action_rule_lead_test"/>
|
||||
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
|
||||
<field name="act_user_id" ref="base.user_demo"/>
|
||||
<field name="filter_pre_id" ref="test_filter_open"/>
|
||||
<field name="filter_id" ref="test_filter_done"/>
|
||||
</record>
|
||||
|
||||
<record id="test_rule_on_recompute" model="base.action.rule">
|
||||
<record id="test_rule_on_recompute" model="base.automation">
|
||||
<field name="name">Test rule on recompute</field>
|
||||
<field name="kind">on_write</field>
|
||||
<field name="model_id" ref="base_action_rule.model_base_action_rule_lead_test"/>
|
||||
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
|
||||
<field name="act_user_id" ref="base.user_demo"/>
|
||||
<field name="filter_domain">[('customer', '=', True)]</field>
|
||||
</record>
|
||||
|
||||
<record id="test_rule_on_line" model="base.action.rule">
|
||||
<record id="test_rule_on_line" model="base.automation">
|
||||
<field name="name">Test rule on secondary record</field>
|
||||
<field name="kind">on_create</field>
|
||||
<field name="model_id" ref="base_action_rule.model_base_action_rule_line_test"/>
|
||||
<field name="model_id" ref="base_automation.model_base_automation_line_test"/>
|
||||
<field name="act_user_id" ref="base.user_demo"/>
|
||||
</record>
|
||||
</odoo>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import base_action_rule
|
||||
import base_automation
|
||||
+14
-16
@@ -25,11 +25,9 @@ DATE_RANGE_FUNCTION = {
|
||||
}
|
||||
|
||||
|
||||
class BaseActionRule(models.Model):
|
||||
""" Base Action Rules """
|
||||
|
||||
_name = 'base.action.rule'
|
||||
_description = 'Action Rules'
|
||||
class BaseAutomation(models.Model):
|
||||
_name = 'base.automation'
|
||||
_description = 'Automated Action'
|
||||
_order = 'sequence'
|
||||
|
||||
name = fields.Char(string='Rule Name', required=True)
|
||||
@@ -95,14 +93,14 @@ class BaseActionRule(models.Model):
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
base_action_rule = super(BaseActionRule, self).create(vals)
|
||||
base_automation = super(BaseAutomation, self).create(vals)
|
||||
self._update_cron()
|
||||
self._update_registry()
|
||||
return base_action_rule
|
||||
return base_automation
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
res = super(BaseActionRule, self).write(vals)
|
||||
res = super(BaseAutomation, self).write(vals)
|
||||
if set(vals).intersection(self.CRITICAL_FIELDS):
|
||||
self._update_cron()
|
||||
self._update_registry()
|
||||
@@ -110,7 +108,7 @@ class BaseActionRule(models.Model):
|
||||
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
res = super(BaseActionRule, self).unlink()
|
||||
res = super(BaseAutomation, self).unlink()
|
||||
self._update_cron()
|
||||
self._update_registry()
|
||||
return res
|
||||
@@ -119,7 +117,7 @@ class BaseActionRule(models.Model):
|
||||
""" Activate the cron job depending on whether there exists action rules
|
||||
based on time conditions.
|
||||
"""
|
||||
cron = self.env.ref('base_action_rule.ir_cron_data_bar_check', raise_if_not_found=False)
|
||||
cron = self.env.ref('base_automation.ir_cron_data_base_automation_check', raise_if_not_found=False)
|
||||
return cron and cron.toggle(model=self._name, domain=[('kind', '=', 'on_time')])
|
||||
|
||||
def _update_registry(self):
|
||||
@@ -232,7 +230,7 @@ class BaseActionRule(models.Model):
|
||||
@api.model
|
||||
def create(self, vals, **kw):
|
||||
# retrieve the action rules to possibly execute
|
||||
actions = self.env['base.action.rule']._get_actions(self, ['on_create', 'on_create_or_write'])
|
||||
actions = self.env['base.automation']._get_actions(self, ['on_create', 'on_create_or_write'])
|
||||
# call original method
|
||||
record = create.origin(self.with_env(actions.env), vals, **kw)
|
||||
# check postconditions, and execute actions on the records that satisfy them
|
||||
@@ -251,7 +249,7 @@ class BaseActionRule(models.Model):
|
||||
@api.multi
|
||||
def _write(self, vals, **kw):
|
||||
# retrieve the action rules to possibly execute
|
||||
actions = self.env['base.action.rule']._get_actions(self, ['on_write', 'on_create_or_write'])
|
||||
actions = self.env['base.automation']._get_actions(self, ['on_write', 'on_create_or_write'])
|
||||
records = self.with_env(actions.env)
|
||||
# check preconditions on records
|
||||
pre = {action: action._filter_pre(records) for action in actions}
|
||||
@@ -274,7 +272,7 @@ class BaseActionRule(models.Model):
|
||||
@api.multi
|
||||
def unlink(self, **kwargs):
|
||||
# retrieve the action rules to possibly execute
|
||||
actions = self.env['base.action.rule']._get_actions(self, ['on_unlink'])
|
||||
actions = self.env['base.automation']._get_actions(self, ['on_unlink'])
|
||||
records = self.with_env(actions.env)
|
||||
# check conditions, and execute actions on the records that satisfy them
|
||||
for action in actions:
|
||||
@@ -286,8 +284,8 @@ class BaseActionRule(models.Model):
|
||||
|
||||
def make_onchange(action_rule_id):
|
||||
""" Instanciate an onchange method for the given action rule. """
|
||||
def base_action_rule_onchange(self):
|
||||
action_rule = self.env['base.action.rule'].browse(action_rule_id)
|
||||
def base_automation_onchange(self):
|
||||
action_rule = self.env['base.automation'].browse(action_rule_id)
|
||||
result = {}
|
||||
for server_action in action_rule.server_action_ids.with_context(active_model=self._name, onchange_self=self):
|
||||
res = server_action.run()
|
||||
@@ -301,7 +299,7 @@ class BaseActionRule(models.Model):
|
||||
result['warning'] = res['warning']
|
||||
return result
|
||||
|
||||
return base_action_rule_onchange
|
||||
return base_automation_onchange
|
||||
|
||||
patched_models = defaultdict(set)
|
||||
def patch(model, name, method):
|
||||
@@ -0,0 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_base_automation,base.automation,model_base_automation,,1,0,0,0
|
||||
access_base_automation_config,base.automation config,model_base_automation,base.group_system,1,1,1,1
|
||||
access_base_automation_lead_test,access_base_automation_lead_test,model_base_automation_lead_test,base.group_system,1,1,1,1
|
||||
access_base_automation_line_test,access_base_automation_line_test,model_base_automation_line_test,base.group_system,1,1,1,1
|
||||
|
+1
-1
@@ -2,4 +2,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import test_models
|
||||
import test_base_action_rule
|
||||
import test_base_automation
|
||||
+4
-4
@@ -6,10 +6,10 @@ from odoo.tests import common
|
||||
|
||||
@common.at_install(False)
|
||||
@common.post_install(True)
|
||||
class base_action_rule_test(common.TransactionCase):
|
||||
class base_automation_test(common.TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(base_action_rule_test, self).setUp()
|
||||
super(base_automation_test, self).setUp()
|
||||
self.user_admin = self.env.ref('base.user_root')
|
||||
self.user_demo = self.env.ref('base.user_demo')
|
||||
|
||||
@@ -19,7 +19,7 @@ class base_action_rule_test(common.TransactionCase):
|
||||
'user_id': self.user_admin.id,
|
||||
}
|
||||
vals.update(kwargs)
|
||||
return self.env['base.action.rule.lead.test'].create(vals)
|
||||
return self.env['base.automation.lead.test'].create(vals)
|
||||
|
||||
def test_00_check_to_state_open_pre(self):
|
||||
"""
|
||||
@@ -96,7 +96,7 @@ class base_action_rule_test(common.TransactionCase):
|
||||
"""
|
||||
Check that a rule is executed after creating a line record.
|
||||
"""
|
||||
line = self.env['base.action.rule.line.test'].create({'name': "Line"})
|
||||
line = self.env['base.automation.line.test'].create({'name': "Line"})
|
||||
self.assertEqual(line.user_id, self.user_demo)
|
||||
|
||||
def test_20_indirect_line(self):
|
||||
+4
-4
@@ -5,7 +5,7 @@ from odoo import fields, models
|
||||
|
||||
|
||||
class LeadTest(models.Model):
|
||||
_name = "base.action.rule.lead.test"
|
||||
_name = "base.automation.lead.test"
|
||||
_description = "Action Rule Test"
|
||||
|
||||
name = fields.Char(string='Subject', required=True, index=True)
|
||||
@@ -17,13 +17,13 @@ class LeadTest(models.Model):
|
||||
partner_id = fields.Many2one('res.partner', string='Partner')
|
||||
date_action_last = fields.Datetime(string='Last Action', readonly=True)
|
||||
customer = fields.Boolean(related='partner_id.customer', readonly=True, store=True)
|
||||
line_ids = fields.One2many('base.action.rule.line.test', 'lead_id')
|
||||
line_ids = fields.One2many('base.automation.line.test', 'lead_id')
|
||||
|
||||
|
||||
class LineTest(models.Model):
|
||||
_name = "base.action.rule.line.test"
|
||||
_name = "base.automation.line.test"
|
||||
_description = "Action Rule Line Test"
|
||||
|
||||
name = fields.Char()
|
||||
lead_id = fields.Many2one('base.action.rule.lead.test', ondelete='cascade')
|
||||
lead_id = fields.Many2one('base.automation.lead.test', ondelete='cascade')
|
||||
user_id = fields.Many2one('res.users')
|
||||
+14
-14
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Action Rule Form View -->
|
||||
<record id="view_base_action_rule_form" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.form</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<record id="view_base_automation_form" model="ir.ui.view">
|
||||
<field name="name">base.automation.form</field>
|
||||
<field name="model">base.automation</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Action Rule">
|
||||
<sheet>
|
||||
@@ -87,9 +87,9 @@
|
||||
</record>
|
||||
|
||||
<!-- Action Rule Tree View -->
|
||||
<record id="view_base_action_rule_tree" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.tree</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<record id="view_base_automation_tree" model="ir.ui.view">
|
||||
<field name="name">base.automation.tree</field>
|
||||
<field name="model">base.automation</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Action Rule">
|
||||
<field name="sequence"/>
|
||||
@@ -101,9 +101,9 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_base_action_rule_search" model="ir.ui.view">
|
||||
<field name="name">base.action.rule.search</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<record id="view_base_automation_search" model="ir.ui.view">
|
||||
<field name="name">base.automation.search</field>
|
||||
<field name="model">base.automation</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
@@ -113,12 +113,12 @@
|
||||
</record>
|
||||
|
||||
<!-- Action Rule Action -->
|
||||
<record id="base_action_rule_act" model="ir.actions.act_window">
|
||||
<record id="base_automation_act" model="ir.actions.act_window">
|
||||
<field name="name">Automated Actions</field>
|
||||
<field name="res_model">base.action.rule</field>
|
||||
<field name="res_model">base.automation</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_base_action_rule_tree"/>
|
||||
<field name="view_id" ref="view_base_automation_tree"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to setup a new automated action rule.
|
||||
@@ -132,7 +132,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_base_action_rule_form"
|
||||
parent="base.menu_automation" action="base_action_rule_act" sequence="1"/>
|
||||
<menuitem id="menu_base_automation_form"
|
||||
parent="base.menu_automation" action="base_automation_act" sequence="1"/>
|
||||
|
||||
</odoo>
|
||||
@@ -5,7 +5,7 @@
|
||||
'name': 'Calendar',
|
||||
'version': '1.0',
|
||||
'sequence': 130,
|
||||
'depends': ['base', 'mail', 'base_action_rule', 'web_calendar'],
|
||||
'depends': ['base', 'mail', 'base_automation', 'web_calendar'],
|
||||
'summary': 'Personal & Shared Calendar',
|
||||
'description': """
|
||||
This is a full-featured calendar system.
|
||||
|
||||
@@ -29,7 +29,7 @@ Dashboard for CRM will include:
|
||||
""",
|
||||
'website': 'https://www.odoo.com/page/crm',
|
||||
'depends': [
|
||||
'base_action_rule',
|
||||
'base_automation',
|
||||
'base_setup',
|
||||
'sales_team',
|
||||
'mail',
|
||||
@@ -73,7 +73,7 @@ Dashboard for CRM will include:
|
||||
'data/crm_demo.xml',
|
||||
'data/mail_activity_demo.xml',
|
||||
'data/crm_lead_demo.xml',
|
||||
'data/base_action_rule_demo.xml',
|
||||
'data/base_automation_demo.xml',
|
||||
],
|
||||
'css': ['static/src/css/crm.css'],
|
||||
'installable': True,
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
<field name="state">email</field>
|
||||
<field name="template_id" ref="email_template_opportunity_reminder_mail"/>
|
||||
</record>
|
||||
<record id="rule_set_reminder_lead" model="base.action.rule">
|
||||
<record id="rule_set_reminder_lead" model="base.automation">
|
||||
<field name="name">Set Auto Reminder on leads which are not open since 5 days.</field>
|
||||
<field name="model_id" ref="model_crm_lead"/>
|
||||
<field name="sequence">1</field>
|
||||
@@ -41,7 +41,7 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">record.write({'team_id': env.ref('sales_team.team_sales_department').id})</field>
|
||||
</record>
|
||||
<record id="rule_set_followers_lead" model="base.action.rule">
|
||||
<record id="rule_set_followers_lead" model="base.automation">
|
||||
<field name="name">Set Auto Followers on leads which are urgent and come from USA.</field>
|
||||
<field name="model_id" ref="model_crm_lead"/>
|
||||
<field name="sequence">2</field>
|
||||
@@ -10,7 +10,7 @@ access_res_partner_category_manager,res.partner.category.crm.manager,base.model_
|
||||
access_res_partner,res.partner.crm.user,base.model_res_partner,sales_team.group_sale_salesman,1,1,1,0
|
||||
access_res_partner_category,res.partner.category.crm.user,base.model_res_partner_category,sales_team.group_sale_salesman,1,1,1,0
|
||||
mail_mailgate_thread,mail.thread,mail.model_mail_thread,sales_team.group_sale_salesman,1,1,1,1
|
||||
access_base_action_rule_manager,base.action.rule manager,base_action_rule.model_base_action_rule,sales_team.group_sale_manager,1,1,1,1
|
||||
access_base_automation_manager,base.automation manager,base_automation.model_base_automation,sales_team.group_sale_manager,1,1,1,1
|
||||
access_crm_lead_partner_manager,crm.lead.partner.manager,model_crm_lead,base.group_partner_manager,1,0,0,0
|
||||
access_crm_lead_tag,crm_lead_tag,model_crm_lead_tag,base.group_user,1,0,0,0
|
||||
access_crm_lead_tag_salesman,crm_lead_tag salesman,model_crm_lead_tag,sales_team.group_sale_salesman,1,1,1,0
|
||||
|
||||
|
@@ -17,11 +17,11 @@ Add all information on the employee form to manage contracts.
|
||||
You can assign several contracts per employee.
|
||||
""",
|
||||
'website': 'https://www.odoo.com/page/employees',
|
||||
'depends': ['base_action_rule', 'hr'],
|
||||
'depends': ['base_automation', 'hr'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/hr_contract_data.xml',
|
||||
'views/base_action_rule_views.xml',
|
||||
'views/base_automation_views.xml',
|
||||
'views/hr_contract_views.xml',
|
||||
],
|
||||
'demo': [],
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">record.set_as_pending()</field>
|
||||
</record>
|
||||
<record id="rule_contract_1_set_as_pending" model="base.action.rule">
|
||||
<record id="rule_contract_1_set_as_pending" model="base.automation">
|
||||
<field name="name">HR Contract: check for pending</field>
|
||||
<field name="model_id" ref="model_hr_contract"/>
|
||||
<field name="sequence">50</field>
|
||||
@@ -66,7 +66,7 @@
|
||||
<field name="trg_date_range_type">day</field>
|
||||
<field name="server_action_ids" eval="[(6, 0, [ref('contract_set_as_pending')])]"/>
|
||||
</record>
|
||||
<record id="rule_contract_2_set_as_pending" model="base.action.rule">
|
||||
<record id="rule_contract_2_set_as_pending" model="base.automation">
|
||||
<field name="name">HR Contract: check for pending</field>
|
||||
<field name="model_id" ref="model_hr_contract"/>
|
||||
<field name="sequence">51</field>
|
||||
@@ -85,7 +85,7 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">record.set_as_close()</field>
|
||||
</record>
|
||||
<record id="rule_contract_3_set_as_close" model="base.action.rule">
|
||||
<record id="rule_contract_3_set_as_close" model="base.automation">
|
||||
<field name="name">HR Contract: check for close</field>
|
||||
<field name="model_id" ref="model_hr_contract"/>
|
||||
<field name="sequence">52</field>
|
||||
@@ -95,7 +95,7 @@
|
||||
<field name="trg_date_range_type">day</field>
|
||||
<field name="server_action_ids" eval="[(6, 0, [ref('contract_set_as_close')])]"/>
|
||||
</record>
|
||||
<record id="rule_contract_4_set_as_close" model="base.action.rule">
|
||||
<record id="rule_contract_4_set_as_close" model="base.automation">
|
||||
<field name="name">HR Contract: check for close</field>
|
||||
<field name="model_id" ref="model_hr_contract"/>
|
||||
<field name="sequence">53</field>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import base_action_rule
|
||||
import base_automation
|
||||
import hr_contract
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@ from odoo import api, fields, models
|
||||
from odoo.fields import Datetime
|
||||
|
||||
|
||||
class BaseActionRule(models.Model):
|
||||
class BaseAutomation(models.Model):
|
||||
""" Add resource and calendar for time-based conditions """
|
||||
|
||||
_inherit = 'base.action.rule'
|
||||
_inherit = 'base.automation'
|
||||
|
||||
trg_date_resource_field_id = fields.Many2one('ir.model.fields', string='Use employee work schedule', help='Use the user\'s working schedule.')
|
||||
|
||||
@@ -24,4 +24,4 @@ class BaseActionRule(models.Model):
|
||||
start_dt = Datetime.from_string(record_dt)
|
||||
resource_id = user.employee_ids[0].resource_id.id
|
||||
return calendar.schedule_days_get_date(action.trg_date_range, day_date=start_dt, compute_leaves=True, resource_id=resource_id)
|
||||
return super(BaseActionRule, self)._check_delay(action, record, record_dt)
|
||||
return super(BaseAutomation, self)._check_delay(action, record, record_dt)
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="view_base_action_rule_form_resource">
|
||||
<field name="name">base.action.rule.form</field>
|
||||
<field name="model">base.action.rule</field>
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_form"/>
|
||||
<record model="ir.ui.view" id="view_base_automation_form_resource">
|
||||
<field name="name">base.automation.form</field>
|
||||
<field name="model">base.automation</field>
|
||||
<field name="inherit_id" ref="base_automation.view_base_automation_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='trg_date_calendar_id']" position="before">
|
||||
<field name="trg_date_resource_field_id"
|
||||
@@ -342,7 +342,7 @@ class Task(models.Model):
|
||||
" * Red indicates something is preventing the progress of this task\n"
|
||||
" * Green indicates the task is ready to be pulled to the next stage")
|
||||
create_date = fields.Datetime(index=True)
|
||||
write_date = fields.Datetime(index=True) #not displayed in the view but it might be useful with base_action_rule module (and it needs to be defined first for that)
|
||||
write_date = fields.Datetime(index=True) #not displayed in the view but it might be useful with base_automation module (and it needs to be defined first for that)
|
||||
date_start = fields.Datetime(string='Starting Date',
|
||||
default=fields.Datetime.now,
|
||||
index=True, copy=False)
|
||||
|
||||
@@ -140,7 +140,7 @@ class ir_cron(models.Model):
|
||||
|
||||
@classmethod
|
||||
def _acquire_job(cls, db_name):
|
||||
# TODO remove 'check' argument from addons/base_action_rule/base_action_rule.py
|
||||
# TODO remove 'check' argument from addons/base_automation/base_automation.py
|
||||
""" Try to process one cron job.
|
||||
|
||||
This selects in database all the jobs that should be processed. It then
|
||||
|
||||
Reference in New Issue
Block a user