<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from datetime import datetime
from osv import fields, osv, orm
from tools.translate import _
from datetime import datetime
from datetime import timedelta
import pooler 
import re
import time
import tools

class base_action_rule(osv.osv):
    """ Base Action Rules """

    _name = 'base.action.rule'
    _description = 'Action Rules'
    
    def _state_get(self, cr, uid, context={}):
        """ Get State
            @param self: The object pointer
            @param cr: the current row, from the database cursor,
            @param uid: the current user’s ID for security checks,
            @param context: A standard dictionary for contextual values """
        return self.state_get(cr, uid, context=context)

    def state_get(self, cr, uid, context={}):
        """ Get State
            @param self: The object pointer
            @param cr: the current row, from the database cursor,
            @param uid: the current user’s ID for security checks,
            @param context: A standard dictionary for contextual values """
        return [('', '')]
  
    def priority_get(self, cr, uid, context={}):
        """ Get Priority
            @param self: The object pointer
            @param cr: the current row, from the database cursor,
            @param uid: the current user’s ID for security checks,
            @param context: A standard dictionary for contextual values """
        return [('', '')]

    _columns = {
        'name': fields.many2one('ir.model', 'Object', required=True), 
        'create_date': fields.datetime('Create Date', readonly=1), 
        'active': fields.boolean('Active', help="If the active field is set to False,\
 it will allow you to hide the rule without removing it."), 
        'sequence': fields.integer('Sequence', help="Gives the sequence order \
when displaying a list of rules."), 
        'trg_date_type':  fields.selection([
            ('none', 'None'), 
            ('create', 'Creation Date'), 
            ('action_last', 'Last Action Date'), 
            ('date', 'Date'), 
            ('deadline', 'Deadline'), 
            ], 'Trigger Date', size=16), 
        'trg_date_range': fields.integer('Delay after trigger date', \
                                         help="Delay After Trigger Date,\
specifies you can put a negative number. If you need a delay before the \
trigger date, like sending a reminder 15 minutes before a meeting."), 
        'trg_date_range_type': fields.selection([('minutes', 'Minutes'), ('hour', 'Hours'), \
                                ('day', 'Days'), ('month', 'Months')], 'Delay type'), 
        'trg_user_id':  fields.many2one('res.users', 'Responsible'), 
        'trg_partner_id': fields.many2one('res.partner', 'Partner'), 
        'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'), 
        'trg_state_from': fields.selection(_state_get, 'State', size=16), 
        'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16), 

        'act_method': fields.char('Call Object Method', size=64), 
        'act_user_id': fields.many2one('res.users', 'Set Responsible to'), 
        'act_state': fields.selection(_state_get, 'Set State to', size=16), 
        'act_email_cc': fields.char('Add Watchers (Cc)', size=250, help="\
These people will receive a copy of the future communication between partner \
and users by email"), 
        'act_remind_partner': fields.boolean('Remind Partner', help="Check \
this if you want the rule to send a reminder by email to the partner."), 
        'act_remind_user': fields.boolean('Remind Responsible', help="Check \
this if you want the rule to send a reminder by email to the user."), 
        'act_reply_to': fields.char('Reply-To', size=64), 
        'act_remind_attach': fields.boolean('Remind with Attachment', help="Check this if you want that all documents attached to the object be attached to the reminder email sent."), 
        'act_mail_to_user': fields.boolean('Mail to Responsible', help="Check\
 this if you want the rule to send an email to the responsible person."), 
        'act_mail_to_watchers': fields.boolean('Mail to Watchers (CC)', 
                                                help="Check this if you want \
the rule to mark CC(mail to any other person defined in actions)."), 
        'act_mail_to_email': fields.char('Mail to these Emails', size=128, \
        help="Email-id of the persons whom mail is to be sent"), 
        'act_mail_body': fields.text('Mail body', help="Content of mail"), 
        'regex_name': fields.char('Regex on Resource Name', size=128, help="Regular expression for mathching name of the resource\
\ne.g.: urgent.* will search for records having name starting with urgent\
\nNote: This is case sensitive search."), 
        'server_action_id': fields.many2one('ir.actions.server', 'Server Action', help="Describes the action name.\neg:on which object which action to be taken on basis of which condition"), 
        'filter_id':fields.many2one('ir.filters', 'Filter', required=False), 
    }

    _defaults = {
        'active': lambda *a: True, 
        'trg_date_type': lambda *a: 'none', 
        'trg_date_range_type': lambda *a: 'day', 
        'act_mail_to_user': lambda *a: 0, 
        'act_remind_partner': lambda *a: 0, 
        'act_remind_user': lambda *a: 0, 
        'act_mail_to_watchers': lambda *a: 0, 
    }
    
    _order = 'sequence'<commit_msg>[IMP] base_action_rule: correct typo on help tooltip<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from datetime import datetime
from osv import fields, osv, orm
from tools.translate import _
from datetime import datetime
from datetime import timedelta
import pooler 
import re
import time
import tools

class base_action_rule(osv.osv):
    """ Base Action Rules """

    _name = 'base.action.rule'
    _description = 'Action Rules'
    
    def _state_get(self, cr, uid, context={}):
        """ Get State
            @param self: The object pointer
            @param cr: the current row, from the database cursor,
            @param uid: the current user’s ID for security checks,
            @param context: A standard dictionary for contextual values """
        return self.state_get(cr, uid, context=context)

    def state_get(self, cr, uid, context={}):
        """ Get State
            @param self: The object pointer
            @param cr: the current row, from the database cursor,
            @param uid: the current user’s ID for security checks,
            @param context: A standard dictionary for contextual values """
        return [('', '')]
  
    def priority_get(self, cr, uid, context={}):
        """ Get Priority
            @param self: The object pointer
            @param cr: the current row, from the database cursor,
            @param uid: the current user’s ID for security checks,
            @param context: A standard dictionary for contextual values """
        return [('', '')]

    _columns = {
        'name': fields.many2one('ir.model', 'Object', required=True), 
        'create_date': fields.datetime('Create Date', readonly=1), 
        'active': fields.boolean('Active', help="If the active field is set to False,\
 it will allow you to hide the rule without removing it."), 
        'sequence': fields.integer('Sequence', help="Gives the sequence order \
when displaying a list of rules."), 
        'trg_date_type':  fields.selection([
            ('none', 'None'), 
            ('create', 'Creation Date'), 
            ('action_last', 'Last Action Date'), 
            ('date', 'Date'), 
            ('deadline', 'Deadline'), 
            ], 'Trigger Date', size=16), 
        'trg_date_range': fields.integer('Delay after trigger date', \
                                         help="Delay After Trigger Date,\
specifies you can put a negative number. If you need a delay before the \
trigger date, like sending a reminder 15 minutes before a meeting."), 
        'trg_date_range_type': fields.selection([('minutes', 'Minutes'), ('hour', 'Hours'), \
                                ('day', 'Days'), ('month', 'Months')], 'Delay type'), 
        'trg_user_id':  fields.many2one('res.users', 'Responsible'), 
        'trg_partner_id': fields.many2one('res.partner', 'Partner'), 
        'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'), 
        'trg_state_from': fields.selection(_state_get, 'State', size=16), 
        'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16), 

        'act_method': fields.char('Call Object Method', size=64), 
        'act_user_id': fields.many2one('res.users', 'Set Responsible to'), 
        'act_state': fields.selection(_state_get, 'Set State to', size=16), 
        'act_email_cc': fields.char('Add Watchers (Cc)', size=250, help="\
These people will receive a copy of the future communication between partner \
and users by email"), 
        'act_remind_partner': fields.boolean('Remind Partner', help="Check \
this if you want the rule to send a reminder by email to the partner."), 
        'act_remind_user': fields.boolean('Remind Responsible', help="Check \
this if you want the rule to send a reminder by email to the user."), 
        'act_reply_to': fields.char('Reply-To', size=64), 
        'act_remind_attach': fields.boolean('Remind with Attachment', help="Check this if you want that all documents attached to the object be attached to the reminder email sent."), 
        'act_mail_to_user': fields.boolean('Mail to Responsible', help="Check\
 this if you want the rule to send an email to the responsible person."), 
        'act_mail_to_watchers': fields.boolean('Mail to Watchers (CC)', 
                                                help="Check this if you want \
the rule to mark CC(mail to any other person defined in actions)."), 
        'act_mail_to_email': fields.char('Mail to these Emails', size=128, \
        help="Email-id of the persons whom mail is to be sent"), 
        'act_mail_body': fields.text('Mail body', help="Content of mail"), 
        'regex_name': fields.char('Regex on Resource Name', size=128, help="Regular expression for matching name of the resource\
\ne.g.: 'urgent.*' will search for records having name starting with the string 'urgent'\
\nNote: This is case sensitive search."), 
        'server_action_id': fields.many2one('ir.actions.server', 'Server Action', help="Describes the action name.\neg:on which object which action to be taken on basis of which condition"), 
        'filter_id':fields.many2one('ir.filters', 'Filter', required=False), 
    }

    _defaults = {
        'active': lambda *a: True, 
        'trg_date_type': lambda *a: 'none', 
        'trg_date_range_type': lambda *a: 'day', 
        'act_mail_to_user': lambda *a: 0, 
        'act_remind_partner': lambda *a: 0, 
        'act_remind_user': lambda *a: 0, 
        'act_mail_to_watchers': lambda *a: 0, 
    }
    
    _order = 'sequence'
{'fraction_non_alphanumeric': 0.1368682555702197, 'fraction_numerical': 0.006987035168077012, 'mean_word_length': 2.989470424279963, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5440060', 'n_tokens_mistral': 3624, 'n_tokens_neox': 3410, 'n_words': 1305}