06-06-2014, 11:55
Au départ je cherchais à faire quelque chose de ce genre.
Mais je n'avais pas compris à quoi pouvait servir les propriétés de Creme. Ça à l'air d'être une fonctionnalité très utile ! Je pense que ça pourrait s'utiliser pour remplir le besoin de tags mais après je n'ai pas trouvé de moyens d'effectuer une recherche par filtre comme il semble indiqué ici avec des filtres (?).
Pour l'erreur, je vais essayer de retrouver ça. J'éditerais ce message.
EDIT : Voilà :
La classe modèle :
Mais je n'avais pas compris à quoi pouvait servir les propriétés de Creme. Ça à l'air d'être une fonctionnalité très utile ! Je pense que ça pourrait s'utiliser pour remplir le besoin de tags mais après je n'ai pas trouvé de moyens d'effectuer une recherche par filtre comme il semble indiqué ici avec des filtres (?).
Pour l'erreur, je vais essayer de retrouver ça. J'éditerais ce message.
EDIT : Voilà :
Code :
$ python2.7 manage.py creme_populate
/usr/lib/python2.7/pkgutil.py:186: ImportWarning: Not importing directory '/usr/local/lib/python2.7/dist-packages/virtualenvwrapper': missing __init__.py
file, filename, etc = imp.find_module(subname, path)
disable populate for "creme.vcfs": No module named populate
disable populate for "creme.tags": No module named populate
populate "creme.creme_core" ...
populate "creme.creme_core" done.
populate "creme.creme_config" ...
populate "creme.creme_config" done.
populate "creme.media_managers" ...
populate "creme.media_managers" done.
populate "creme.documents" ...
populate "creme.documents" failed ('Folder' object has no attribute 'tags')
Traceback (most recent call last):
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/management/commands/creme_populate.py", line 188, in _do_populate_action
getattr(populator, name)()
File "/home/makina/Documents/kseroux/tmp/creme/documents/populate.py", line 54, in populate
description=_(u"Folder containing all the documents related to entities")
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 137, in create
return self.get_query_set().create(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 377, in create
obj.save(force_insert=True, using=self.db)
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/models/entity.py", line 350, in save
super(CremeEntity, self).save(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 506, in save_base
self.save_base(cls=parent, origin=org, using=using)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1592, in insert_query
query.insert_values(fields, objs, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/subqueries.py", line 170, in insert_values
value = getattr(obj, field.attname)
AttributeError: 'Folder' object has no attribute 'tags'
populate "creme.documents" done.
populate "creme.assistants" ...
populate "creme.assistants" done.
populate "creme.activities" ...
populate "creme.activities" done.
populate "creme.persons" ...
populate "creme.persons" failed ('Contact' object has no attribute 'tags')
Traceback (most recent call last):
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/management/commands/creme_populate.py", line 188, in _do_populate_action
getattr(populator, name)()
File "/home/makina/Documents/kseroux/tmp/creme/persons/populate.py", line 166, in populate
user=admin, is_user=admin
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 137, in create
return self.get_query_set().create(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 377, in create
obj.save(force_insert=True, using=self.db)
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/models/entity.py", line 350, in save
super(CremeEntity, self).save(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 506, in save_base
self.save_base(cls=parent, origin=org, using=using)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1592, in insert_query
query.insert_values(fields, objs, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/subqueries.py", line 170, in insert_values
value = getattr(obj, field.attname)
AttributeError: 'Contact' object has no attribute 'tags'
populate "creme.persons" done.
populate "creme.graphs" ...
populate "creme.graphs" done.
populate "creme.reports" ...
populate "creme.reports" done.
populate "creme.products" ...
populate "creme.products" done.
populate "creme.recurrents" ...
populate "creme.recurrents" done.
populate "creme.billing" ...
populate "creme.billing" failed ('Report' object has no attribute 'tags')
Traceback (most recent call last):
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/management/commands/creme_populate.py", line 188, in _do_populate_action
getattr(populator, name)()
File "/home/makina/Documents/kseroux/tmp/creme/billing/populate.py", line 231, in populate
self.create_reports(rt_sub_bill_received, resulted, resulted_collection)
File "/home/makina/Documents/kseroux/tmp/creme/billing/populate.py", line 273, in create_reports
invoices_report = Report.objects.create(name=report_name, ct=invoice_ct, filter=current_year_invoice_filter, user=admin)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 137, in create
return self.get_query_set().create(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 377, in create
obj.save(force_insert=True, using=self.db)
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/models/entity.py", line 350, in save
super(CremeEntity, self).save(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 506, in save_base
self.save_base(cls=parent, origin=org, using=using)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1592, in insert_query
query.insert_values(fields, objs, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/subqueries.py", line 170, in insert_values
value = getattr(obj, field.attname)
AttributeError: 'Report' object has no attribute 'tags'
populate "creme.billing" done.
populate "creme.opportunities" ...
populate "creme.opportunities" failed ('Report' object has no attribute 'tags')
Traceback (most recent call last):
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/management/commands/creme_populate.py", line 188, in _do_populate_action
getattr(populator, name)()
File "/home/makina/Documents/kseroux/tmp/creme/opportunities/populate.py", line 199, in populate
self.create_reports(rt_obj_emit_orga)
File "/home/makina/Documents/kseroux/tmp/creme/opportunities/populate.py", line 237, in create_reports
opp_report = Report.objects.create(name=report_name, ct=opp_ct, filter=opp_filter, user=admin)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 137, in create
return self.get_query_set().create(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 377, in create
obj.save(force_insert=True, using=self.db)
File "/home/makina/Documents/kseroux/tmp/creme/creme_core/models/entity.py", line 350, in save
super(CremeEntity, self).save(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 506, in save_base
self.save_base(cls=parent, origin=org, using=using)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1592, in insert_query
query.insert_values(fields, objs, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/subqueries.py", line 170, in insert_values
value = getattr(obj, field.attname)
AttributeError: 'Report' object has no attribute 'tags'
populate "creme.opportunities" done.
populate "creme.commercial" ...
populate "creme.commercial" done.
populate "creme.events" ...
populate "creme.events" done.
populate "creme.crudity" ...
populate "creme.crudity" done.
populate "creme.emails" ...
populate "creme.emails" done.
populate "creme.projects" ...
populate "creme.projects" done.
populate "creme.tickets" ...
populate "creme.tickets" done.
populate "creme.activesync" ...
populate "creme.activesync" done.
update sequences for models : ['StaffSize', 'FolderCategory', 'AdditionalInformation', 'MediaCategory', 'Position', 'Periodicity', 'PaymentTerms', 'SalesOrderStatus', 'InvoiceStatus', 'SettlementTerms', 'LegalForm', 'Priority', 'Currency', 'QuoteStatus', 'ProjectStatus', 'ActType', 'Status', 'EventType', 'TaskStatus', 'Status', 'UserMessagePriority', 'Sector', 'Criticity', 'Language', 'Civility', 'CreditNoteStatus']
update sequences done.
Code :
# -*- coding: utf-8 -*-
# Inspired from
# https://www.cremecrm.com/forum/showthread.php?tid=18&pid=80#pid80
from django.db.models import Model, CharField
from django.utils.translation import ugettext_lazy as _
from creme.creme_core.utils.contribute_to_model import contribute_to_model
from creme.creme_core.models.entity import CremeEntity
class TaggedCremeEntity(Model):
tags = CharField(_("Tags"), max_length=200, blank=True)
class Meta:
abstract = True
contribute_to_model(TaggedCremeEntity, CremeEntity)