<commit_before>from openerp import api,models,fields

from openerp.osv import fields as old_fields
from openerp.osv import osv
from openerp.tools.translate import _

def _get_active_id(self):
    return self._context.get('active_id')

def _get_active_ids(self):
    return self._context.get('active_ids')

from ..models import account_analytic_account as aaa

SIGNAL_SELECTION = [
    ('new', 'new'),
    ('qualified', 'qualified'),
    ('proposal_created', 'proposal_created'),
    ('proposal_sent', 'proposal_sent'),
    ('proposal_confirmed', 'proposal_confirmed'),
]

def fix_sale_case_workflow(sale_case, new_signal):
    print 'fix_sale_case_workflow', sale_case, new_signal
    sale_case.delete_workflow()
    sale_case.create_workflow()
    for signal,label in SIGNAL_SELECTION:
        sale_case.signal_workflow(signal)
        if signal == new_signal:
            break

class sale_case_administration(models.TransientModel):
    _name = 'sale_mediation_custom.sale_case_administration'


    sale_case_id = fields.Many2one('account.analytic.account', default=_get_active_id)

    state = fields.Selection(related='sale_case_id.state')
    lead_id = fields.Many2one('crm.lead', related='sale_case_id.lead_id')
    sale_order_id = fields.Many2one('sale.order', related='sale_case_id.sale_order_id')<commit_msg>[IMP] fake_lead_signal to create workflow<commit_after>from openerp import api,models,fields

from openerp.osv import fields as old_fields
from openerp.osv import osv
from openerp.tools.translate import _

def _get_active_id(self):
    return self._context.get('active_id')

def _get_active_ids(self):
    return self._context.get('active_ids')

from ..models import account_analytic_account as aaa

SIGNAL_SELECTION = [
    ('fake_lead_signal', 'lead'),
    ('new', 'new'),
    ('qualified', 'qualified'),
    ('proposal_created', 'proposal_created'),
    ('proposal_sent', 'proposal_sent'),
    ('proposal_confirmed', 'proposal_confirmed'),
]

def fix_sale_case_workflow(sale_case, new_signal):
    print 'fix_sale_case_workflow', sale_case, new_signal
    sale_case.delete_workflow()
    sale_case.create_workflow()
    for signal,label in SIGNAL_SELECTION:
        sale_case.signal_workflow(signal)
        if signal == new_signal:
            break

class sale_case_administration(models.TransientModel):
    _name = 'sale_mediation_custom.sale_case_administration'


    sale_case_id = fields.Many2one('account.analytic.account', default=_get_active_id)

    state = fields.Selection(related='sale_case_id.state')
    lead_id = fields.Many2one('crm.lead', related='sale_case_id.lead_id')
    sale_order_id = fields.Many2one('sale.order', related='sale_case_id.sale_order_id')
{'fraction_non_alphanumeric': 0.11037037037037037, 'fraction_numerical': 0.0022222222222222222, 'mean_word_length': 5.2091954022988505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3618592', 'n_tokens_mistral': 941, 'n_tokens_neox': 877, 'n_words': 155}