1030 lines
46 KiB
Python
Executable File
1030 lines
46 KiB
Python
Executable File
# -*- coding: utf-8 -*
|
|
|
|
import ast
|
|
import datetime
|
|
import json
|
|
import re
|
|
import uuid
|
|
import logging
|
|
import base64
|
|
import subprocess
|
|
import tempfile
|
|
|
|
import easywebdav
|
|
import os
|
|
import os.path
|
|
|
|
|
|
from odoo import api, fields, models, _
|
|
from odoo import tools
|
|
from odoo.exceptions import ValidationError
|
|
from datetime import date
|
|
from datetime import datetime
|
|
from dateutil.relativedelta import relativedelta
|
|
from pyffmpeg import FFmpeg
|
|
from tuya_iot import TuyaOpenAPI, TUYA_LOGGER
|
|
from tuya_connector import TuyaOpenAPI, TUYA_LOGGER
|
|
import sys
|
|
|
|
TUYA_LOGGER.setLevel(logging.DEBUG)
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
def _generate_preview_from_binary(self, videofile_file):
|
|
cmd = ['ffmpeg', '-i','-','-ss','00:00:01','-vframes','1','-f','image2','-']
|
|
p = subprocess.Popen(cmd,stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
out,err = p.communicate(videofile_file)
|
|
if p.returncode != 0:
|
|
pass
|
|
|
|
return base64.b64encode(out)
|
|
|
|
def _generate_preview_from_binary_2(self, videofile_file):
|
|
ff=FFmpeg()
|
|
p = subprocess.Popen(cmd,stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
out,err = p.communicate(videofile_file)
|
|
if p.returncode != 0:
|
|
pass
|
|
|
|
return base64.b64encode(out)
|
|
|
|
class dssimport(models.Model):
|
|
_name = "dss.import"
|
|
_description = "DigitalSignage Import"
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
importfilename = fields.Binary('Import Dateiname')
|
|
importtext = fields.Text('Import Verlauf')
|
|
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
def pyimport(self):
|
|
|
|
return action
|
|
|
|
|
|
|
|
class dsspprojektstatus(models.Model):
|
|
_name = "dss.projectstate"
|
|
_description = "DigitalSignage Projektstatus"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "statusname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
statusname = fields.Char('Statusname', required=True)
|
|
color = fields.Char(string='Color Index')
|
|
typ = fields.Selection([('NEU','In Bearbeitung'),('WORK','fertig/laufend'),('ERROR','Fehlerhaft/Defekt'),('ARCHIV','veraltet/archiviert')],'Systemzuordnung')
|
|
icon = fields.Image()
|
|
order = fields.Integer('Reihenfolge')
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
class dsscontractstatus(models.Model):
|
|
_name = "dss.contractstate"
|
|
_description = "DigitalSignage Vertragsstatus"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "statusname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
statusname = fields.Char('Statusname', required=True)
|
|
color = fields.Char(string='Color Index')
|
|
icon = fields.Image()
|
|
order = fields.Integer('Reihenfolge')
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
class dssadstatus(models.Model):
|
|
_name = "dss.adstate"
|
|
_description = "DigitalSignage Werbeaktions-Status"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "statusname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
statusname = fields.Char('Statusname', required=True)
|
|
color = fields.Char(string='Color Index')
|
|
func = fields.Selection([('STD','Standard'), ('FIN','Endzustand'), ('WOR','Arbeitszustand')])
|
|
icon = fields.Image()
|
|
order = fields.Integer('Reihenfolge')
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
|
|
class dssworkstatus(models.Model):
|
|
_name = "dss.workstate"
|
|
_description = "DigitalSignage Bearbeitungsstatus"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "statusname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
statusname = fields.Char('Statusname', required=True)
|
|
color = fields.Char(string='Color Index')
|
|
icon = fields.Image()
|
|
order = fields.Integer('Reihenfolge')
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
class dsstodostatus(models.Model):
|
|
_name = "dss.todostate"
|
|
_description = "DigitalSignage Bearbeitungsschritte"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "statusname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
statusname = fields.Char('Statusname', required=True)
|
|
statusnr = fields.Integer(default=lambda self: self._default_statusnr(),string='Listenpostion', required=True)
|
|
color = fields.Char(string='Color Index')
|
|
icon = fields.Image()
|
|
order = fields.Integer('Reihenfolge')
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
@api.model
|
|
def _default_statusnr(self):
|
|
return str(1)
|
|
|
|
class dsstexts(models.Model):
|
|
_name = "dss.texts"
|
|
_description = "DigitalSignage Standard texte"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "textname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
text_id = fields.Char('Kennung', required=True)
|
|
textname = fields.Char('Textname', required=True)
|
|
description = fields.Text('Text')
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
class dssmediatypes(models.Model):
|
|
_name = "dss.mediatypes"
|
|
_description = "DigitalSignage Datei-Medientypen"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "medianame"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
medianame = fields.Char('Medien Name', required=True)
|
|
mediatype = fields.Selection([('IMG_J','Bild'),('VID_4','MP4 Video'),('FIL_X','belieb. Datei')])
|
|
description = fields.Text('Medien Beschreibung')
|
|
cloudlink = fields.Char('Cloud Verzeichnis',help='Verzeichnis für diese Datei innerhalb des Vertrags-Ordners')
|
|
filepartname = fields.Char('Part.Dateiname',help='Teil des Dateinamens. Wird ergaenzt durch KampagnenID und MedienID. Beispiel : PNAME_34_544.jpg')
|
|
maxsize_kb = fields.Integer('Maximale Größe KB')
|
|
maxsize_w = fields.Integer('Maximale Pixel W')
|
|
maxsize_h = fields.Integer('Maximale Pixel H')
|
|
standard_image = fields.Image()
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
class dssmediarelations(models.Model):
|
|
|
|
_name = "dss.mediarelations"
|
|
_description = "DigitalSignage Kampagne-Medien-Zuordnung"
|
|
_inherit = []
|
|
_rec_name = "relname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
field = fields.Many2one('dss.advertisefields',string='Feld')
|
|
contract = fields.Many2many(related='field.contract',string='Vertrag')
|
|
ad = fields.Many2one('dss.ads',string='Werbekampagne')
|
|
project = fields.Many2one('dss.projects',string='Werbeprojekt')
|
|
mediatype = fields.Many2one('dss.mediatypes',string='Medientyp')
|
|
mediatype_type = fields.Selection(related='mediatype.mediatype',string='Medientyp')
|
|
mediatype_name = fields.Char(related='mediatype.medianame',string='Medienname')
|
|
relname = fields.Char('Relationsname')
|
|
field_uuid = fields.Char('Feld')
|
|
mediatype_uuid = fields.Char('Medientyp')
|
|
mediafile = fields.Binary('Datei',attachment=True)
|
|
mediafile_attachment = fields.Many2one('ir.attachment',string='Datei')
|
|
mediafile_file = fields.Char('Dateiname')
|
|
secured_ro = fields.Boolean('Gesperrt ro')
|
|
used_ro = fields.Boolean('Benutzt ro')
|
|
isreference = fields.Boolean('Für Referenz')
|
|
|
|
# @api.onchange('field')
|
|
# def _onchange_field(self):
|
|
# for record in self:
|
|
# if record.field='':
|
|
# record.contract=''
|
|
# else:
|
|
# record.contrect=record.field_contract
|
|
|
|
def unlink(self):
|
|
_logger.info('unlinking '+str(self))
|
|
for record in self:
|
|
_logger.info('unlinking '+str(record)+' '+str(record.ad))
|
|
if record.ad != False:
|
|
super(dssmediarelations,record).unlink()
|
|
else:
|
|
_logger.info('not unlinking '+str(record)+' '+str(record.ad))
|
|
|
|
@api.onchange('mediafile')
|
|
def _onchange_mediafile(self):
|
|
restr = 'keine'
|
|
for record in self :
|
|
resstr = record.uuid
|
|
_logger.info(record.mediafile_file)
|
|
if record.mediafile != False :
|
|
_logger.info('Generating File '+resstr)
|
|
if os.path.isfile(record.mediafile_file) :
|
|
os.remove(record.mediafile_file)
|
|
fileobj = open(record.mediafile_file,"xb")
|
|
fileobj.write(base64.decodebytes(record.mediafile))
|
|
fileobj.close()
|
|
_logger.info(resstr+' File generated')
|
|
_logger.info(' Projekt : P_'+str(record.project)+'C_'+str(record.contract)+'A_'+str(record.ad)+' F : '+restr+' created ')
|
|
_logger.info(' Keine Datei ')
|
|
return
|
|
|
|
def dload(self):
|
|
for record in self :
|
|
_logger.info('Download pressed : '+str(record))
|
|
|
|
return {}
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
# @api.depends('mediafile_file')
|
|
# def _compute_media_preview(self):
|
|
# for rec in self:
|
|
# if rec.mediafile != False:
|
|
# _logger.info('compute image for '+rec.uuid)
|
|
# rec.mediafile_preview = self._generate_preview_from_binary(base64.decodebytes(rec.mediafile))
|
|
# rec.mediafile_preview = self._generate_preview_and_save_from_binary(base64.decodebytes(rec.mediafile),rec.mediafile_file+'_prv')
|
|
# if rec.mediafile != False:
|
|
# rec.mediafile_preview = self._generate_preview_from_binary(base64.decodebytes(rec.mediafile))
|
|
# rec.mediafile_preview = None
|
|
# else:
|
|
# _logger.info('alternative compute '+rec.uuid)
|
|
# rec.mediafile_preview = rec.mediafile
|
|
# return
|
|
|
|
class dssadstructures(models.Model):
|
|
_name = "dss.adstructures"
|
|
_description = "DigitalSignage Werbestrukturen"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "structurename"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
structurename = fields.Char('Struktur Name', required=True)
|
|
kampagnen_uuid = fields.Char('Kampagne')
|
|
description = fields.Text('Struktur Beschreibung')
|
|
medias = fields.Many2many('dss.mediatypes',string='Enthaltene Dateien')
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
|
|
class dssscreendesign(models.Model):
|
|
_name = "dss.screendesign"
|
|
_description = "DigitalSignage Screen Designer"
|
|
_inherit = ['mail.thread','mail.activity.mixin']
|
|
_rec_name = "screenname"
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False, string='UUID')
|
|
date_create = fields.Date('Erstellungsdatum',default=lambda self: self._default_create_date())
|
|
date_lastedit = fields.Date('Änderungsdatum')
|
|
user_create = fields.Char('Erstellungsuser',default=lambda self: self._default_create_user())
|
|
user_lastedit = fields.Char('Änderungsuser')
|
|
|
|
screenname = fields.Char('Bildschirmname',track_visibility='onchange',tracking=True)
|
|
fields = fields.One2many('dss.advertisefields','display',string='Werbefelder',tracking=True)
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
def _default_create_date(self):
|
|
return str(date.today())
|
|
|
|
def _default_create_user(self):
|
|
return str(self.env.user.name)
|
|
|
|
@api.model
|
|
def get_data(self):
|
|
outlist = {'uuid' : 2222}
|
|
return outlist
|
|
|
|
class dsscontractads(models.Model):
|
|
|
|
def _default_work_state(self):
|
|
ds = self.env['dss.workstate'].search([('statusname', '=', 'Neu')], limit=1).id
|
|
_logger.debug(ds)
|
|
return ds
|
|
|
|
def _default_work_state_color(self):
|
|
ds = self.env['dss.workstate'].search([('statusname', '=', 'Neu')], limit=1).color
|
|
_logger.info(ds)
|
|
return ds
|
|
|
|
def _default_todo_state(self):
|
|
ds = self.env['dss.todostate'].search([('statusnr', '=', '0')], limit=1).id
|
|
if not ds: ds = 1
|
|
_logger.debug(ds)
|
|
# ds =
|
|
return ds
|
|
|
|
@api.model
|
|
def create(self, vals):
|
|
result = super().create(vals)
|
|
resstr = result.uuid
|
|
_logger.info(resstr)
|
|
for n_record in result:
|
|
resstr = n_record.uuid
|
|
_logger.info(resstr)
|
|
n_record.date_create = date.today()
|
|
n_record.user_create = self.env.user.name
|
|
allads = n_record.contract.ads
|
|
_logger.info(allads)
|
|
if allads != False:
|
|
for ad in allads:
|
|
ad.ad_is_lastpos = False
|
|
n_record.ad_is_lastpos = True
|
|
contract = n_record.contract
|
|
contract.ads_last_ad = n_record
|
|
return result
|
|
|
|
# @api.depends('need_media')
|
|
# def _getmedialist(self):
|
|
# mlist = []
|
|
# mlist = self.env['dss.mediarelations'].search([('ad','=',self.id)])
|
|
# if mlist != False:
|
|
# _logger.info('AD Need_Medias A_'+str(self)+' - Computed Medias '+str(mlist))
|
|
# self.need_media = mlist.ids
|
|
# else:
|
|
# self.need_media = False
|
|
|
|
_name = "dss.ads"
|
|
_description = "DigitalSignage Werbekampagnen Phasen"
|
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
|
# _inherit = ['mail.activity.mixin']
|
|
# 'mail.thread','mail.activity.mixin'
|
|
_rec_name = "adname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False,
|
|
string='UUID')
|
|
aduuid = fields.Char(related='uuid')
|
|
|
|
date_create = fields.Date('Erstellungsdatum', default=lambda self: self._default_create_date())
|
|
date_lastedit = fields.Date('Änderungsdatum')
|
|
user_create = fields.Char('Erstellungsuser', default=lambda self: self._default_create_user())
|
|
user_lastedit = fields.Char('Änderungsuser')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
adname = fields.Char('Kampagnenname', required=True, tracking=True)
|
|
adtype = fields.Selection(
|
|
[('MAIN', 'Ersteinrichtung'), ('KCHN', 'Änderung durch Kunde'), ('LCHN', 'Änderung durch Logumedia'),
|
|
('SONS', 'Sonstige Änderung')], tracking=True)
|
|
adpos = fields.Integer('Reihenfolge', default=lambda self: self._default_adpos(),
|
|
tracking=True)
|
|
ad_is_lastpos = fields.Boolean('Letzte Aktion', tracking=True)
|
|
|
|
start_date = fields.Date('gew. Ausstrahl.Begin', tracking=True)
|
|
end_date = fields.Date('gew. Ausstrahl.Ende', tracking=True)
|
|
|
|
contract = fields.Many2one('dss.contracts', store=True, tracking=True)
|
|
contract_id = fields.Char(related='contract.contract_id')
|
|
contract_name = fields.Char(related='contract.contract_name')
|
|
contract_need_media = fields.Many2many(related='contract.need_media', tracking=True)
|
|
|
|
project = fields.Many2one('dss.projects', string='Project', store=True, tracking=True)
|
|
project_id = fields.Integer(related='project.projectid', string='Project ID')
|
|
|
|
parent_ad = fields.Many2one('dss.ads', string='UrsprungsWerbung', store=True)
|
|
parent_ad_uuid = fields.Char(related='parent_ad.uuid')
|
|
description = fields.Text('Beschreibung')
|
|
amount = fields.Float('Extrakosten', tracking=True)
|
|
order = fields.Integer('Reihenfolge', tracking=True)
|
|
|
|
# need_media = fields.Many2many('dss.mediarelations','ad',string='Medien')
|
|
need_media = fields.One2many('dss.mediarelations', 'ad', string='Medien')
|
|
|
|
work_state = fields.Many2one('dss.workstate', default=_default_work_state, tracking=True)
|
|
work_state_color = fields.Char(related='work_state.color')
|
|
work_state_text = fields.Char(related='work_state.statusname')
|
|
work_state_info = fields.Char('Zusatzinfo')
|
|
|
|
ad_state = fields.Many2one('dss.adstate', tracking=True)
|
|
ad_state_color = fields.Char(related='ad_state.color')
|
|
ad_state_text = fields.Char(related='ad_state.statusname')
|
|
ad_state_func = fields.Selection(related='ad_state.func')
|
|
|
|
todo_state = fields.Many2one('dss.todostate', default=_default_todo_state,
|
|
tracking=True)
|
|
todo_state_color = fields.Char(related='todo_state.color')
|
|
todo_state_text = fields.Char(related='todo_state.statusname')
|
|
todo_state_info = fields.Char('Zusatzinfo', tracking=True)
|
|
todo_state_until = fields.Date('Abarbeiten bis', tracking=True)
|
|
|
|
cloud_add_directory = fields.Char('Cloud KundenKampagnen Ordner', tracking=True)
|
|
|
|
date_zuarbeit = fields.Date(string='Zuarbeit Datum', help='Zuarbeit gesendet am', tracking=True)
|
|
date_korrekturabzug = fields.Date(string='K.Abzug Datum', help='Korrekturabzug gesendet am')
|
|
date_korrekturfreigabe = fields.Date(string='K.Freigabe Datum', help='Korrekturfreigabe erhalten am',
|
|
tracking=True)
|
|
date_korrekturfreigabe_frist = fields.Date(string='K.Freigabe bis Datum', help='Korrekturfreigabe sollte bis .... erfolgen')
|
|
freigabe_durch_ablauf = fields.Boolean(string='Zeitablauf',help='Freigabe wurde durch Zeitablauf erreicht ?', tracking=True)
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
def _default_create_date(self):
|
|
return str(date.today())
|
|
|
|
def _default_create_user(self):
|
|
return str(self.env.user.name)
|
|
|
|
def _default_adpos(self):
|
|
pos = self.env['dss.ads'].search_count([('contract_id', '=', self.contract.id)]) + 1
|
|
return str(pos)
|
|
|
|
@api.onchange('ad_state')
|
|
def _onchange_ad_state(self):
|
|
for record in self:
|
|
if record.ad_is_lastpos == True:
|
|
contract = record.contract
|
|
contract.ads_last_state = record.ad_state
|
|
# mtyp = self.env['dss.adstructures'].search([("uuid","=",str(record.mediastructure.uuid))])
|
|
# buildmediarelations(self)
|
|
self.date_lastedit = str(date.today())
|
|
|
|
# self.mediastructure = mtyp
|
|
|
|
def pyaction_view_ad_details(self):
|
|
action = self.env['ir.actions.act_window'].with_context({'default_adid': self.id})._for_xml_id(
|
|
'DigitalSignage.action_dss_ads_view')
|
|
# action['display_name'] = self.ad_name
|
|
# action['domain'] = '[["projectid","=","4"]]'
|
|
# context = action['context'].replace('', str(self.id))
|
|
# context = ast.literal_eval(context)
|
|
# context.update({
|
|
# 'create': self.active,
|
|
# 'active_test': self.active
|
|
# })
|
|
# action['context'] = context
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'form',
|
|
'view_mode': 'form,tree',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '',
|
|
'res_id': self.id,
|
|
'display_name': ' ' + self.adname,
|
|
'domain': ''
|
|
}
|
|
|
|
return action
|
|
|
|
def pydoviewallads(self):
|
|
action = self.env['ir.actions.act_window'].with_context({'default_adid': self.id})._for_xml_id(
|
|
'DigitalSignage.act_dss_ads_view_full')
|
|
action['display_name'] = self.contract_name
|
|
# action['domain'] = '[["projectid","=","4"]]'
|
|
# context = action['context'].replace('', str(self.id))
|
|
# context = ast.literal_eval(context)
|
|
# context.update({
|
|
# 'create': self.active,
|
|
# 'active_test': self.active
|
|
# })
|
|
# action['context'] = context
|
|
# return {
|
|
# 'type': 'ir.actions.act_window',
|
|
# 'view_type':'form',
|
|
# 'view_mode':'form,tree',
|
|
# 'res_model':'dss.ads',
|
|
# 'target':'current',
|
|
# 'context':'',
|
|
# 'res_id':kampagne.id,
|
|
# 'display_name' : 'Werbekampagne '+kampagne.adname,
|
|
# 'domain':'[("contract","=","context[active_id]")]'
|
|
# }
|
|
# return action
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'kanban',
|
|
'view_mode': 'kanban',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '{"group_by":["parent_ad"]}',
|
|
# 'res_id':self.parent_ad,
|
|
'display_name': 'Übersicht für ' + self.adname,
|
|
'domain': [("contract", "=", self.contract.id)]
|
|
}
|
|
|
|
def pydonewad(self):
|
|
for n_record in self:
|
|
resstr = n_record.uuid
|
|
_logger.info(resstr)
|
|
allads = n_record.contract.ads
|
|
_logger.info(allads)
|
|
abort = False
|
|
if allads != False:
|
|
for ad in allads:
|
|
if ad.ad_state.func != 'FIN':
|
|
abort = True
|
|
if abort == False:
|
|
defadstate = self.env['dss.adstate'].search([('func', '=', 'STD')], limit=1).id
|
|
if not defadstate:
|
|
defadstate = 1
|
|
if self.ad_state.func == 'STD':
|
|
parent_id = self.id
|
|
else:
|
|
parent_id = self.parent_ad.id
|
|
newkampagne = self.env['dss.ads'].create({'contract': self.contract.id, 'project': self.project.id,
|
|
'adname': 'AD_' + self.contract.contract_auto_name + ' ' + str(
|
|
date.today()), 'parent_ad': parent_id, 'adtype': 'KCHN',
|
|
'ad_state': defadstate})
|
|
_logger.info('C_' + str(self.id) + ' Kampagne erzeugt : ' + str(newkampagne))
|
|
_logger.info('Prüfe Medien : C_' + str(self.id) + 'K_' + str(newkampagne.id))
|
|
|
|
mediaids = []
|
|
for feld in self.contract.werbe_feld_selected:
|
|
for media in feld.mediastructure.medias:
|
|
if not media:
|
|
_logger.info('Prüfe Medien : C_' + str(self.contract.id) + 'K_' + str(
|
|
newkampagne.id) + ' Kein Medium in MedienStructur von F_' + str(feld.id) + 'M_' + str(
|
|
media.id))
|
|
else:
|
|
newmedia = self.env['dss.mediarelations'].create(
|
|
{'field': feld.id, 'contract': self.contract.id, 'project': self.project.id,
|
|
'field_uuid': feld.uuid, 'ad': newkampagne.id, 'relname': media.medianame,
|
|
'mediatype': media.id})
|
|
_logger.info('Prüfe Medien : C_' + str(self.contract.id) + 'K_' + str(
|
|
newkampagne.id) + ' setze Vertrag für Medium : ' + str(newmedia.contract) + '/' + str(
|
|
newmedia.ad))
|
|
mediaids.append(newmedia.id)
|
|
newkampagne.write({'need_media': [(6, 0, mediaids)]})
|
|
_logger.info('Click auf Werbekampagne : C_' + str(self.contract.id) + 'A_' + str(
|
|
newkampagne.id) + ' setze Media ')
|
|
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'form',
|
|
'view_mode': 'form,tree',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '',
|
|
'res_id': newkampagne.id,
|
|
'display_name': 'Änderung zur Werbekampagne ' + newkampagne.parent_ad.adname,
|
|
'domain': '[("id","=","context[newkampagne.id]")]'
|
|
}
|
|
else:
|
|
raise ValidationError(
|
|
_("Kann neue Aktualisierung erst anlegen wenn alle vorherigen Schritte beendet wurden !"))
|
|
|
|
def setStandardText(self, tid):
|
|
text = self.env['dss.texts'].search([('text_id', '=', tid)], limit=1)
|
|
if text:
|
|
self.write({'description': text.description})
|
|
|
|
|
|
class dsscontractads(models.Model):
|
|
|
|
def _default_work_state(self):
|
|
ds = self.env['dss.workstate'].search([('statusname', '=', 'Neu')], limit=1).id
|
|
_logger.debug(ds)
|
|
return ds
|
|
|
|
def _default_work_state_color(self):
|
|
ds = self.env['dss.workstate'].search([('statusname', '=', 'Neu')], limit=1).color
|
|
_logger.info(ds)
|
|
return ds
|
|
|
|
def _default_todo_state(self):
|
|
ds = self.env['dss.todostate'].search([('statusnr', '=', '0')], limit=1).id
|
|
if not ds: ds = 1
|
|
_logger.debug(ds)
|
|
# ds =
|
|
return ds
|
|
|
|
@api.model
|
|
def create(self, vals):
|
|
result = super().create(vals)
|
|
resstr = result.uuid
|
|
_logger.info(resstr)
|
|
for n_record in result:
|
|
resstr = n_record.uuid
|
|
_logger.info(resstr)
|
|
n_record.date_create = date.today()
|
|
n_record.user_create = self.env.user.name
|
|
allads = n_record.contract.ads
|
|
_logger.info(allads)
|
|
if allads != False:
|
|
for ad in allads:
|
|
ad.ad_is_lastpos = False
|
|
n_record.ad_is_lastpos = True
|
|
contract = n_record.contract
|
|
contract.ads_last_ad = n_record
|
|
return result
|
|
|
|
# @api.depends('need_media')
|
|
# def _getmedialist(self):
|
|
# mlist = []
|
|
# mlist = self.env['dss.mediarelations'].search([('ad','=',self.id)])
|
|
# if mlist != False:
|
|
# _logger.info('AD Need_Medias A_'+str(self)+' - Computed Medias '+str(mlist))
|
|
# self.need_media = mlist.ids
|
|
# else:
|
|
# self.need_media = False
|
|
|
|
_name = "dss.ads"
|
|
_description = "DigitalSignage Werbekampagnen"
|
|
_inherit = ['mail.thread', 'mail.activity.mixin','dss.triggermodel']
|
|
# _inherit = ['mail.activity.mixin']
|
|
# 'mail.thread','mail.activity.mixin'
|
|
_rec_name = "adname"
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
uuid = fields.Char(default=lambda self: self._default_uuid(), required=True, readonly=True, copy=False,
|
|
string='UUID')
|
|
aduuid = fields.Char(related='uuid')
|
|
|
|
date_create = fields.Date('Erstellungsdatum', default=lambda self: self._default_create_date())
|
|
date_lastedit = fields.Date('Änderungsdatum')
|
|
user_create = fields.Char('Erstellungsuser', default=lambda self: self._default_create_user())
|
|
user_lastedit = fields.Char('Änderungsuser')
|
|
# uuid = fields.Char('UUID', required=True, translate=True)
|
|
adname = fields.Char('Kampagnenname', required=True, tracking=True)
|
|
adtype = fields.Selection(
|
|
[('MAIN', 'Ersteinrichtung'), ('KCHN', 'Änderung durch Kunde'), ('LCHN', 'Änderung durch Logumedia'),
|
|
('SONS', 'Sonstige Änderung'),('PREA', 'Vorausplanung')], tracking=True)
|
|
adpos = fields.Integer('Reihenfolge', default=lambda self: self._default_adpos(),
|
|
tracking=True)
|
|
ad_is_lastpos = fields.Boolean('Letzte Aktion', tracking=True)
|
|
|
|
contract = fields.Many2one('dss.contracts', store=True, tracking=True)
|
|
contract_id = fields.Char(related='contract.contract_id')
|
|
contract_name = fields.Char(related='contract.contract_name')
|
|
contract_need_media = fields.Many2many(related='contract.need_media', tracking=True)
|
|
|
|
project = fields.Many2one('dss.projects', string='Project', store=True, tracking=True)
|
|
project_id = fields.Integer(related='project.projectid', string='Project ID')
|
|
|
|
parent_ad = fields.Many2one('dss.ads', string='UrsprungsWerbung', store=True)
|
|
parent_ad_uuid = fields.Char(related='parent_ad.uuid')
|
|
description = fields.Text('Beschreibung', tracking=True)
|
|
amount = fields.Float('Extrakosten', tracking=True)
|
|
order = fields.Integer('Reihenfolge', tracking=True)
|
|
|
|
# need_media = fields.Many2many('dss.mediarelations','ad',string='Medien')
|
|
need_media = fields.One2many('dss.mediarelations', 'ad', string='Medien', tracking=True)
|
|
|
|
work_state = fields.Many2one('dss.workstate', default=_default_work_state, tracking=True)
|
|
work_state_color = fields.Char(related='work_state.color')
|
|
work_state_text = fields.Char(related='work_state.statusname')
|
|
work_state_info = fields.Char('Zusatzinfo',tracking=True)
|
|
|
|
ad_state = fields.Many2one('dss.adstate', tracking=True)
|
|
ad_state_color = fields.Char(related='ad_state.color')
|
|
ad_state_text = fields.Char(related='ad_state.statusname')
|
|
ad_state_func = fields.Selection(related='ad_state.func')
|
|
|
|
todo_state = fields.Many2one('dss.todostate', default=_default_todo_state,
|
|
tracking=True)
|
|
todo_state_color = fields.Char(related='todo_state.color')
|
|
todo_state_text = fields.Char(related='todo_state.statusname')
|
|
todo_state_info = fields.Char('Zusatzinfo', tracking=True)
|
|
todo_state_until = fields.Date('Abarbeiten bis', tracking=True)
|
|
|
|
cloud_add_directory = fields.Char('Cloud KundenKampagnen Ordner', tracking=True)
|
|
|
|
date_zuarbeit = fields.Date(string='Zuarbeit Datum', help='Zuarbeit gesendet am',
|
|
tracking=True)
|
|
date_korrekturabzug = fields.Date(string='K.Abzug Datum', help='Korrekturabzug gesendet am',
|
|
tracking=True)
|
|
date_korrekturfreigabe = fields.Date(string='K.Freigabe Datum', help='Korrekturfreigabe erhalten am',
|
|
tracking=True)
|
|
date_korrekturfreigabe_ablauf = fields.Date(string='K.Freigabe Ablaufdatum', help='Korrekturfreigabe muss bis xxxx erfolgen.. sonst Autofreigabe',
|
|
tracking=True)
|
|
date_korrekturfreigabe_ablauf_compute = fields.Char(compute='_date_korrekturfreigabe_ablauf_compute')
|
|
date_korrekturfreigabe_ablauf_compute_int = fields.Integer(compute='_date_korrekturfreigabe_ablauf_compute_int')
|
|
korrekturfreigabe_ablauf_erfolgt = fields.Boolean(string='K.Freigabe durch Ablauf', help='Korrekturfreigabe erfolgte durch Zeitablauf ?',
|
|
tracking=True)
|
|
date_start_planed = fields.Date(string='geplantes Startdatum', tracking=True)
|
|
date_start_planed_calendar_event=fields.Integer('gepl. Start - Kal.ID',tracking=True)
|
|
date_start_real = fields.Date(string='wirkliches Startdatum', tracking=True)
|
|
|
|
date_remove_planed = fields.Date(string='geplantes Enddatum', tracking=True)
|
|
date_remove_real = fields.Date(string='wirkliches Enddatum', tracking=True)
|
|
|
|
@api.depends('date_korrekturfreigabe_ablauf')
|
|
def _date_korrekturfreigabe_ablauf_compute(self):
|
|
self.date_korrekturfreigabe_ablauf_compute = ''
|
|
if not self:
|
|
return ''
|
|
pass
|
|
else:
|
|
for record in self:
|
|
if not record:
|
|
return ''
|
|
pass
|
|
else:
|
|
if not record.date_korrekturfreigabe_ablauf:
|
|
return ''
|
|
pass
|
|
else:
|
|
datedif = record.date_korrekturfreigabe_ablauf-date.today()
|
|
record.date_korrekturfreigabe_ablauf_compute='Noch '+str(datedif.days)+' Tage bis Autoablauf'
|
|
|
|
@api.depends('date_korrekturfreigabe_ablauf')
|
|
def _date_korrekturfreigabe_ablauf_compute_int(self):
|
|
for record in self:
|
|
if record:
|
|
if record.date_korrekturfreigabe_ablauf:
|
|
datedif = record.date_korrekturfreigabe_ablauf-date.today()
|
|
record.date_korrekturfreigabe_ablauf_compute_int = datedif.days
|
|
|
|
def _check_date_korrekturfreigabe_ablauf(self):
|
|
for record in self:
|
|
if record:
|
|
if record.date_korrekturfreigabe_ablauf:
|
|
datedif = record.date_korrekturfreigabe_ablauf-date.today()
|
|
_logger.info('Contract Autokorrektur Running C_' + str(record.contract)+' / '+str(datedif))
|
|
if (datedif.days<=0) & ( not record.date_korrekturfreigabe):
|
|
_logger.info('Contract Autokorrektur Running C_' + str(record.contract)+' A_'+str(record)+' Set Values')
|
|
record.date_korrekturfreigabe = date.today()
|
|
record.korrekturfreigabe_ablauf_erfolgt = True
|
|
body = 'Für die Werbekampagne '+str(record.adname)+' im Vertrag '+str(record.contract.contract_auto_name)+' des Projektes '+str(record.project.projektname)+' wurde der Korekturabzug automatisch durch Zeitablauf bestätigt !'
|
|
record.message_post(body=body)
|
|
self.env['mail.message'].create({'message_type': 'comment','subtype_id': self.env.ref('mail.mt_comment').id,
|
|
'model': 'mail.channel','res_id': self.env.ref('mail.channel_all_employees').id,'body': body,})
|
|
|
|
@api.model
|
|
def _default_uuid(self):
|
|
return str(uuid.uuid4())
|
|
|
|
def _default_create_date(self):
|
|
return str(date.today())
|
|
|
|
def _default_create_user(self):
|
|
return str(self.env.user.name)
|
|
|
|
def _default_adpos(self):
|
|
pos = self.env['dss.ads'].search_count([('contract_id', '=', self.contract.id)]) + 1
|
|
return str(pos)
|
|
|
|
@api.onchange('ad_state')
|
|
def _onchange_ad_state(self):
|
|
for record in self:
|
|
if record.ad_is_lastpos == True:
|
|
contract = record.contract
|
|
contract.ads_last_state = record.ad_state
|
|
# mtyp = self.env['dss.adstructures'].search([("uuid","=",str(record.mediastructure.uuid))])
|
|
# buildmediarelations(self)
|
|
self.date_lastedit = str(date.today())
|
|
|
|
# self.mediastructure = mtyp
|
|
|
|
@api.onchange('date_korrekturabzug')
|
|
def _date_korrekturabzug_change(self):
|
|
for record in self:
|
|
autodays=0
|
|
if record.date_korrekturabzug:
|
|
autodays=self.env['dss.settings'].search([],limit=1).freigabe_auto_time
|
|
record.date_korrekturfreigabe_ablauf = record.date_korrekturabzug + relativedelta(days=autodays)
|
|
|
|
def pyaction_view_ad_details(self):
|
|
action = self.env['ir.actions.act_window'].with_context({'default_adid': self.id})._for_xml_id(
|
|
'DigitalSignage.action_dss_ads_view')
|
|
# action['display_name'] = self.ad_name
|
|
# action['domain'] = '[["projectid","=","4"]]'
|
|
# context = action['context'].replace('', str(self.id))
|
|
# context = ast.literal_eval(context)
|
|
# context.update({
|
|
# 'create': self.active,
|
|
# 'active_test': self.active
|
|
# })
|
|
# action['context'] = context
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'form',
|
|
'view_mode': 'form,tree',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '',
|
|
'res_id': self.id,
|
|
'display_name': ' ' + self.adname,
|
|
'domain': ''
|
|
}
|
|
|
|
return action
|
|
|
|
def pydoviewallads(self):
|
|
action = self.env['ir.actions.act_window'].with_context({'default_adid': self.id})._for_xml_id(
|
|
'DigitalSignage.act_dss_ads_view_full')
|
|
action['display_name'] = self.contract_name
|
|
# action['domain'] = '[["projectid","=","4"]]'
|
|
# context = action['context'].replace('', str(self.id))
|
|
# context = ast.literal_eval(context)
|
|
# context.update({
|
|
# 'create': self.active,
|
|
# 'active_test': self.active
|
|
# })
|
|
# action['context'] = context
|
|
# return {
|
|
# 'type': 'ir.actions.act_window',
|
|
# 'view_type':'form',
|
|
# 'view_mode':'form,tree',
|
|
# 'res_model':'dss.ads',
|
|
# 'target':'current',
|
|
# 'context':'',
|
|
# 'res_id':kampagne.id,
|
|
# 'display_name' : 'Werbekampagne '+kampagne.adname,
|
|
# 'domain':'[("contract","=","context[active_id]")]'
|
|
# }
|
|
# return action
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'kanban',
|
|
'view_mode': 'kanban',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '{"group_by":["parent_ad"]}',
|
|
# 'res_id':self.parent_ad,
|
|
'display_name': 'Übersicht für ' + self.adname,
|
|
'domain': [("contract", "=", self.contract.id)]
|
|
}
|
|
|
|
def pydonewpread(self):
|
|
defadstate = self.env['dss.adstate'].search([('func', '=', 'STD')], limit=1).id
|
|
if not defadstate:
|
|
defadstate = 1
|
|
if self.ad_state.func == 'STD':
|
|
parent_id = self.id
|
|
else:
|
|
parent_id = self.parent_ad.id
|
|
newkampagne = self.env['dss.ads'].create({'contract': self.contract.id, 'project': self.project.id,
|
|
'adname': 'PRE_' + self.contract.contract_auto_name + ' ' + str(
|
|
date.today()), 'parent_ad': parent_id, 'adtype': 'PREA',
|
|
'ad_state': defadstate})
|
|
_logger.info('C_' + str(self.id) + ' Kampagne erzeugt : ' + str(newkampagne))
|
|
_logger.info('Erzeugte PreWerbekampagne - Prüfe Medien : C_' + str(self.id) + 'K_' + str(newkampagne.id))
|
|
|
|
mediaids = []
|
|
for feld in self.contract.werbe_feld_selected:
|
|
for media in feld.mediastructure.medias:
|
|
if not media:
|
|
_logger.info('Erzeugte PreWerbekampagne - Prüfe Medien : C_' + str(self.contract.id) + 'K_' + str(
|
|
newkampagne.id) + ' Kein Medium in MedienStructur von F_' + str(feld.id) + 'M_' + str(
|
|
media.id))
|
|
else:
|
|
newmedia = self.env['dss.mediarelations'].create(
|
|
{'field': feld.id, 'contract': self.contract.id, 'project': self.project.id,
|
|
'field_uuid': feld.uuid, 'ad': newkampagne.id, 'relname': media.medianame,
|
|
'mediatype': media.id})
|
|
_logger.info('Erzeugte PreWerbekampagne - Prüfe Medien : C_' + str(self.contract.id) + 'K_' + str(
|
|
newkampagne.id) + ' setze Vertrag für Medium : ' + str(newmedia.contract) + '/' + str(
|
|
newmedia.ad))
|
|
mediaids.append(newmedia.id)
|
|
newkampagne.write({'need_media': [(6, 0, mediaids)]})
|
|
_logger.info('Erzeugte PreWerbekampagne : C_' + str(self.contract.id) + 'A_' + str(
|
|
newkampagne.id) + ' setze Media ')
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'form',
|
|
'view_mode': 'form,tree',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '',
|
|
'res_id': newkampagne.id,
|
|
'display_name': 'Änderung zur Werbekampagne ' + newkampagne.parent_ad.adname,
|
|
'domain': '[("id","=","context[newkampagne.id]")]'
|
|
}
|
|
|
|
def pydonewad(self):
|
|
for n_record in self:
|
|
resstr = n_record.uuid
|
|
_logger.info(resstr)
|
|
allads = n_record.contract.ads
|
|
_logger.info(allads)
|
|
abort = False
|
|
if allads != False:
|
|
for ad in allads:
|
|
if ad.ad_state.func != 'FIN':
|
|
if ad.adtype !='PREA':
|
|
abort = True
|
|
if abort == False:
|
|
defadstate = self.env['dss.adstate'].search([('func', '=', 'STD')], limit=1).id
|
|
if not defadstate:
|
|
defadstate = 1
|
|
if self.ad_state.func == 'STD':
|
|
parent_id = self.id
|
|
else:
|
|
parent_id = self.parent_ad.id
|
|
newkampagne = self.env['dss.ads'].create({'contract': self.contract.id, 'project': self.project.id,
|
|
'adname': 'AD_' + self.contract.contract_auto_name + ' ' + str(
|
|
date.today()), 'parent_ad': parent_id, 'adtype': 'KCHN',
|
|
'ad_state': defadstate})
|
|
_logger.info('C_' + str(self.id) + ' Kampagne erzeugt : ' + str(newkampagne))
|
|
_logger.info('Prüfe Medien : C_' + str(self.id) + 'K_' + str(newkampagne.id))
|
|
|
|
mediaids = []
|
|
for feld in self.contract.werbe_feld_selected:
|
|
for media in feld.mediastructure.medias:
|
|
if not media:
|
|
_logger.info('Prüfe Medien : C_' + str(self.contract.id) + 'K_' + str(
|
|
newkampagne.id) + ' Kein Medium in MedienStructur von F_' + str(feld.id) + 'M_' + str(
|
|
media.id))
|
|
else:
|
|
newmedia = self.env['dss.mediarelations'].create(
|
|
{'field': feld.id, 'contract': self.contract.id, 'project': self.project.id,
|
|
'field_uuid': feld.uuid, 'ad': newkampagne.id, 'relname': media.medianame,
|
|
'mediatype': media.id})
|
|
_logger.info('Prüfe Medien : C_' + str(self.contract.id) + 'K_' + str(
|
|
newkampagne.id) + ' setze Vertrag für Medium : ' + str(newmedia.contract) + '/' + str(
|
|
newmedia.ad))
|
|
mediaids.append(newmedia.id)
|
|
newkampagne.write({'need_media': [(6, 0, mediaids)]})
|
|
_logger.info('Click auf Werbekampagne : C_' + str(self.contract.id) + 'A_' + str(
|
|
newkampagne.id) + ' setze Media ')
|
|
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'form',
|
|
'view_mode': 'form,tree',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '',
|
|
'res_id': newkampagne.id,
|
|
'display_name': 'Änderung zur Werbekampagne ' + newkampagne.parent_ad.adname,
|
|
'domain': '[("id","=","context[newkampagne.id]")]'
|
|
}
|
|
else:
|
|
raise ValidationError(
|
|
_("Kann neue Aktualisierung erst anlegen wenn alle vorherigen Schritte beendet wurden !"))
|
|
def pydoprecopyad(selfself):
|
|
for n_record in self:
|
|
resstr = n_record.uuid
|
|
_logger.info(resstr)
|
|
allads = n_record.contract.ads
|
|
_logger.info(allads)
|
|
abort = False
|
|
if allads != False:
|
|
for ad in allads:
|
|
if ad.ad_state.func != 'FIN':
|
|
if ad.adtype != 'PREA':
|
|
abort = True
|
|
if abort == False:
|
|
|
|
return {
|
|
'type': 'ir.actions.act_window',
|
|
'view_type': 'form',
|
|
'view_mode': 'form,tree',
|
|
'res_model': 'dss.ads',
|
|
'target': 'current',
|
|
'context': '',
|
|
'res_id': newkampagne.id,
|
|
'display_name': 'Änderung zur Werbekampagne ' + newkampagne.parent_ad.adname,
|
|
'domain': '[("id","=","context[newkampagne.id]")]'
|
|
}
|
|
|
|
else:
|
|
raise ValidationError(
|
|
_("Kann neue Aktualisierung erst anlegen wenn alle vorherigen Schritte beendet wurden !"))
|
|
|
|
def setStandardText(self, tid):
|
|
text = self.env['dss.texts'].search([('text_id', '=', tid)], limit=1)
|
|
if text:
|
|
self.write({'description': text.description})
|
|
|
|
def pyaddstartdate(self):
|
|
self.env['calendar.event'].search([('id','=',self.date_start_planed_calendar_event)]).unlink()
|
|
event = {
|
|
'start': self.date_start_planed.strftime('%Y-%m-%d %H:%M:%S'),
|
|
'stop': self.date_start_planed.strftime('%Y-%m-%d %H:%M:%S'),
|
|
'duration': 24,
|
|
'allday': True,
|
|
'partner_ids': (4,self.env['dss.settings'].search([],limit=1).contact_runtime_user.partner_id.id),
|
|
'name': 'Geplanter Start '+self.contract.contract_auto_name,
|
|
'description': 'Geplanter Start '+self.contract.contract_auto_name+' im Projekt '+self.project.projektname,
|
|
'user_id': self.env['dss.settings'].search([],limit=1).contact_runtime_user.id
|
|
}
|
|
_logger.debug('linking new Startevent ' + str(event) + ' ' + str(self.uuid))
|
|
self.date_start_planed_calendar_event=self.env['calendar.event'].create(event).id
|
|
return ""
|
|
|
|
def pyaddenddate(self):
|
|
return 1
|