Split FSM into separate modules and switch customer to address book
This commit is contained in:
31
odoo/addons/dsrpt_address_book/models/contact_source.py
Normal file
31
odoo/addons/dsrpt_address_book/models/contact_source.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
class ContactSource(models.Model):
|
||||
_name = 'contact.source'
|
||||
_description = 'Contact Source'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'name'
|
||||
_parent_store = True
|
||||
|
||||
name = fields.Char(string='Name', required=True, translate=True, tracking=True)
|
||||
description = fields.Text(string='Description', tracking=True)
|
||||
active = fields.Boolean(string='Active', default=True, tracking=True)
|
||||
parent_id = fields.Many2one('contact.source', string='Parent Source', ondelete='cascade', index=True, tracking=True)
|
||||
parent_path = fields.Char(index=True, unaccent=False)
|
||||
|
||||
# Стандартные статусы согласно требованиям
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
('active', 'Active')
|
||||
], string='State', default='draft', required=True, tracking=True)
|
||||
color = fields.Integer(string='Color', default=0)
|
||||
|
||||
def action_activate(self):
|
||||
"""Активировать источник"""
|
||||
self.write({'state': 'active'})
|
||||
|
||||
def action_draft(self):
|
||||
"""Вернуть в черновик"""
|
||||
self.write({'state': 'draft'})
|
||||
Reference in New Issue
Block a user