class WaitingAction(CremeModel): # Action (i.e: create, update...) # TODO: int instead ?? action = CharField(_('Action'), max_length=100) # TODO: split into 2 CharFields 'fetcher' & 'input' ? # NB: - If default backend (subject="*"): fetcher_name. # - If not 'fetcher_name - input_name' (eg: email - raw, email - infopath, sms - raw...). source = CharField(_('Source'), max_length=100) raw_data = BinaryField(blank=True, null=True) # Pickled data # Redundant, but faster bd recovery ct = creme_fields.CTypeForeignKey(verbose_name=_('Type of resource')) subject = CharField(_('Subject'), max_length=100) # If sandbox per user user = creme_fields.CremeUserForeignKey( verbose_name=_('Owner'), blank=True, null=True, default=None, ) class Meta: app_label = 'crudity' verbose_name = _('Waiting action') verbose_name_plural = _('Waiting actions') @property def data(self) -> dict: return loads(self.raw_data) @data.setter def data(self, data: dict): self.raw_data = dumps(data) def can_validate_or_delete(self, user) -> Tuple[bool, str]: """self.user not None means that sandbox is by user""" if self.user is not None and self.user != user and not user.is_superuser: return ( False, gettext( 'You are not allowed to validate/delete the waiting action <{}>' ).format(self.id)) return True, gettext('OK')
class Migration(migrations.Migration): # replaces = [ # ('billing', '0001_initial'), # ('billing', '0016_v2_1__convert_buttons'), # ('billing', '0017_v2_1__invoice_buyers_order_number'), # ] initial = True dependencies = [ ('contenttypes', '0001_initial'), ('creme_core', '0001_initial'), migrations.swappable_dependency(settings.PERSONS_ORGANISATION_MODEL), migrations.swappable_dependency(settings.PERSONS_ADDRESS_MODEL), ] operations = [ migrations.CreateModel( name='AdditionalInformation', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('description', models.TextField(verbose_name='Description', blank=True)), ('is_custom', models.BooleanField(default=True)), ], options={ 'ordering': ('name', ), 'verbose_name': 'Additional information', 'verbose_name_plural': 'Additional information', }, bases=(models.Model, ), ), migrations.CreateModel( name='PaymentInformation', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=200, verbose_name='Name')), ('bank_code', models.CharField(max_length=12, verbose_name='Bank code', blank=True)), ('counter_code', models.CharField(max_length=12, verbose_name='Counter code', blank=True)), ('account_number', models.CharField(max_length=12, verbose_name='Account number', blank=True)), ('rib_key', models.CharField(max_length=12, verbose_name='RIB key', blank=True)), ('banking_domiciliation', models.CharField(max_length=200, verbose_name='Banking domiciliation', blank=True)), ('iban', models.CharField(max_length=100, verbose_name='IBAN', blank=True)), ('bic', models.CharField(max_length=100, verbose_name='BIC', blank=True)), ('is_default', models.BooleanField(default=False, verbose_name='Is default?')), ('organisation', models.ForeignKey( to=settings.PERSONS_ORGANISATION_MODEL, on_delete=CASCADE, related_name='PaymentInformationOrganisation_set', verbose_name='Target organisation', )), ], options={ 'ordering': ('name', ), 'verbose_name': 'Payment information', 'verbose_name_plural': 'Payment information', }, bases=(models.Model, ), ), migrations.CreateModel( name='PaymentTerms', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Payment terms')), ('description', models.TextField(verbose_name='Description', blank=True)), ('is_custom', models.BooleanField(default=True)), ], options={ 'ordering': ('name', ), 'verbose_name': 'Payment terms', 'verbose_name_plural': 'Payment terms', }, bases=(models.Model, ), ), migrations.CreateModel( name='ConfigBillingAlgo', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name_algo', models.CharField(max_length=400, verbose_name='Algo name')), ('ct', creme_fields.CTypeForeignKey(to='contenttypes.ContentType')), ('organisation', models.ForeignKey(verbose_name='Organisation', to=settings.PERSONS_ORGANISATION_MODEL, on_delete=CASCADE)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='CreditNoteStatus', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('is_custom', models.BooleanField(default=True)), ('order', creme_fields.BasicAutoField(verbose_name='Order', editable=False, blank=True)), ], options={ 'ordering': ('order', ), 'abstract': False, 'verbose_name': 'Credit note status', 'verbose_name_plural': 'Credit note statuses', }, bases=(models.Model, ), ), migrations.CreateModel( name='CreditNote', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name')), ('number', models.CharField(max_length=100, verbose_name='Number', blank=True)), ('issuing_date', models.DateField(null=True, verbose_name='Issuing date', blank=True)), ('expiration_date', models.DateField(null=True, verbose_name='Expiration date', blank=True)), ('discount', BillingDiscountField(default=Decimal('0'), verbose_name='Overall discount', max_digits=10, decimal_places=2)), ('comment', models.TextField(verbose_name='Comment', blank=True)), ('total_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total with VAT')), ('total_no_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total without VAT')), ('additional_info', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Additional Information', blank=True, to='billing.AdditionalInformation', null=True)), ('currency', models.ForeignKey(related_name='+', on_delete=PROTECT, default=1, verbose_name='Currency', to='creme_core.Currency')), ('payment_info', models.ForeignKey(on_delete=SET_NULL, blank=True, editable=False, to='billing.PaymentInformation', null=True, verbose_name='Payment information')), ('payment_terms', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Payment Terms', blank=True, to='billing.PaymentTerms', null=True)), ('billing_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Billing address')), ('shipping_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Shipping address')), ('status', models.ForeignKey(on_delete=CREME_REPLACE, verbose_name='Status of credit note', to='billing.CreditNoteStatus')), ], options={ 'swappable': 'BILLING_CREDIT_NOTE_MODEL', 'ordering': ('name', ), 'verbose_name': 'Credit note', 'verbose_name_plural': 'Credit notes', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='SettlementTerms', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Settlement terms')), ], options={ 'ordering': ('name', ), 'verbose_name': 'Settlement terms', 'verbose_name_plural': 'Settlement terms', }, bases=(models.Model, ), ), migrations.CreateModel( name='InvoiceStatus', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('is_custom', models.BooleanField(default=True)), ('order', creme_fields.BasicAutoField(verbose_name='Order', editable=False, blank=True)), ('pending_payment', models.BooleanField(default=False, verbose_name='Pending payment')), ], options={ 'ordering': ('order', ), 'abstract': False, 'verbose_name': 'Invoice status', 'verbose_name_plural': 'Invoice statuses', }, bases=(models.Model, ), ), migrations.CreateModel( name='Invoice', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name')), ('number', models.CharField(max_length=100, verbose_name='Number', blank=True)), ('issuing_date', models.DateField(null=True, verbose_name='Issuing date', blank=True)), ('expiration_date', models.DateField(null=True, verbose_name='Expiration date', blank=True)), ('discount', BillingDiscountField(default=Decimal('0'), verbose_name='Overall discount', max_digits=10, decimal_places=2)), ('comment', models.TextField(verbose_name='Comment', blank=True)), ('total_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total with VAT')), ('total_no_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total without VAT')), ('additional_info', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Additional Information', blank=True, to='billing.AdditionalInformation', null=True)), ('currency', models.ForeignKey(related_name='+', on_delete=PROTECT, default=1, verbose_name='Currency', to='creme_core.Currency')), ('payment_info', models.ForeignKey(on_delete=SET_NULL, blank=True, editable=False, to='billing.PaymentInformation', null=True, verbose_name='Payment information')), ('payment_terms', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Payment Terms', blank=True, to='billing.PaymentTerms', null=True)), ('billing_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Billing address')), ('shipping_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Shipping address')), ('status', models.ForeignKey(on_delete=CREME_REPLACE, verbose_name='Status of invoice', to='billing.InvoiceStatus')), ('payment_type', models.ForeignKey(on_delete=CREME_REPLACE_NULL, verbose_name='Settlement terms', blank=True, to='billing.SettlementTerms', null=True)), ('buyers_order_number', models.CharField( blank=True, help_text="Number of buyer's order (french legislation)", max_length=100, verbose_name="Buyer's order")), ], options={ 'swappable': 'BILLING_INVOICE_MODEL', 'ordering': ('name', ), 'verbose_name': 'Invoice', 'verbose_name_plural': 'Invoices', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='QuoteStatus', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('is_custom', models.BooleanField(default=True)), ('order', creme_fields.BasicAutoField(verbose_name='Order', editable=False, blank=True)), ('won', models.BooleanField(default=False, verbose_name='Won')), ], options={ 'ordering': ('order', ), 'abstract': False, 'verbose_name': 'Quote status', 'verbose_name_plural': 'Quote statuses', }, bases=(models.Model, ), ), migrations.CreateModel( name='Quote', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name')), ('number', models.CharField(max_length=100, verbose_name='Number', blank=True)), ('issuing_date', models.DateField(null=True, verbose_name='Issuing date', blank=True)), ('expiration_date', models.DateField(null=True, verbose_name='Expiration date', blank=True)), ('discount', BillingDiscountField(default=Decimal('0'), verbose_name='Overall discount', max_digits=10, decimal_places=2)), ('comment', models.TextField(verbose_name='Comment', blank=True)), ('total_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total with VAT')), ('total_no_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total without VAT')), ('additional_info', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Additional Information', blank=True, to='billing.AdditionalInformation', null=True)), ('currency', models.ForeignKey(related_name='+', on_delete=PROTECT, default=1, verbose_name='Currency', to='creme_core.Currency')), ('payment_info', models.ForeignKey(on_delete=SET_NULL, blank=True, editable=False, to='billing.PaymentInformation', null=True, verbose_name='Payment information')), ('payment_terms', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Payment Terms', blank=True, to='billing.PaymentTerms', null=True)), ('billing_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Billing address')), ('shipping_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Shipping address')), ('acceptation_date', models.DateField(null=True, verbose_name='Acceptation date', blank=True)), ('status', models.ForeignKey(on_delete=CREME_REPLACE, verbose_name='Status of quote', to='billing.QuoteStatus')), ], options={ 'swappable': 'BILLING_QUOTE_MODEL', 'ordering': ('name', ), 'verbose_name': 'Quote', 'verbose_name_plural': 'Quotes', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='SalesOrderStatus', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('is_custom', models.BooleanField(default=True)), ('order', creme_fields.BasicAutoField(verbose_name='Order', editable=False, blank=True)), ], options={ 'ordering': ('order', ), 'abstract': False, 'verbose_name': 'Sales order status', 'verbose_name_plural': 'Sales order statuses', }, bases=(models.Model, ), ), migrations.CreateModel( name='SalesOrder', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name')), ('number', models.CharField(max_length=100, verbose_name='Number', blank=True)), ('issuing_date', models.DateField(null=True, verbose_name='Issuing date', blank=True)), ('expiration_date', models.DateField(null=True, verbose_name='Expiration date', blank=True)), ('discount', BillingDiscountField(default=Decimal('0'), verbose_name='Overall discount', max_digits=10, decimal_places=2)), ('comment', models.TextField(verbose_name='Comment', blank=True)), ('total_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total with VAT')), ('total_no_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total without VAT')), ('additional_info', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Additional Information', blank=True, to='billing.AdditionalInformation', null=True)), ('currency', models.ForeignKey(related_name='+', on_delete=PROTECT, default=1, verbose_name='Currency', to='creme_core.Currency')), ('payment_info', models.ForeignKey(on_delete=SET_NULL, blank=True, editable=False, to='billing.PaymentInformation', null=True, verbose_name='Payment information')), ('payment_terms', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Payment Terms', blank=True, to='billing.PaymentTerms', null=True)), ('billing_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Billing address')), ('shipping_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Shipping address')), ('status', models.ForeignKey(on_delete=CREME_REPLACE, verbose_name='Status of salesorder', to='billing.SalesOrderStatus')), ], options={ 'swappable': 'BILLING_SALES_ORDER_MODEL', 'ordering': ('name', ), 'verbose_name': 'Salesorder', 'verbose_name_plural': 'Salesorders', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='SimpleBillingAlgo', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('last_number', models.IntegerField()), ('prefix', models.CharField(max_length=400, verbose_name='Invoice prefix')), ('ct', creme_fields.CTypeForeignKey(to='contenttypes.ContentType')), ('organisation', models.ForeignKey(verbose_name='Organisation', to=settings.PERSONS_ORGANISATION_MODEL, on_delete=CASCADE)), ], options={ 'unique_together': {('organisation', 'last_number', 'ct')}, }, bases=(models.Model, ), ), migrations.CreateModel( name='TemplateBase', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name')), ('number', models.CharField(max_length=100, verbose_name='Number', blank=True)), ('issuing_date', models.DateField(null=True, verbose_name='Issuing date', blank=True)), ('expiration_date', models.DateField(null=True, verbose_name='Expiration date', blank=True)), ('discount', BillingDiscountField(default=Decimal('0'), verbose_name='Overall discount', max_digits=10, decimal_places=2)), ('comment', models.TextField(verbose_name='Comment', blank=True)), ('total_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total with VAT')), ('total_no_vat', creme_fields.MoneyField(decimal_places=2, default=0, editable=False, max_digits=14, blank=True, null=True, verbose_name='Total without VAT')), ('additional_info', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Additional Information', blank=True, to='billing.AdditionalInformation', null=True)), ('currency', models.ForeignKey(related_name='+', on_delete=PROTECT, default=1, verbose_name='Currency', to='creme_core.Currency')), ('payment_info', models.ForeignKey(on_delete=SET_NULL, blank=True, editable=False, to='billing.PaymentInformation', null=True, verbose_name='Payment information')), ('payment_terms', models.ForeignKey(related_name='+', on_delete=CREME_REPLACE_NULL, verbose_name='Payment Terms', blank=True, to='billing.PaymentTerms', null=True)), ('billing_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Billing address')), ('shipping_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, blank=True, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Shipping address')), ('status_id', models.PositiveIntegerField(editable=False)), ('ct', creme_fields.CTypeForeignKey(editable=False, to='contenttypes.ContentType')), ], options={ 'swappable': 'BILLING_TEMPLATE_BASE_MODEL', 'ordering': ('name', ), 'verbose_name': 'Template', 'verbose_name_plural': 'Templates', }, bases=('creme_core.cremeentity', )), migrations.CreateModel( name='ProductLine', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('on_the_fly_item', models.CharField(max_length=100, null=True, verbose_name='On-the-fly line')), ('comment', models.TextField(verbose_name='Comment', blank=True)), ('quantity', models.DecimalField(default=Decimal('1.00'), verbose_name='Quantity', max_digits=10, decimal_places=2)), ('unit_price', models.DecimalField(default=Decimal('0'), verbose_name='Unit price', max_digits=10, decimal_places=2)), ('unit', models.CharField(max_length=100, verbose_name='Unit', blank=True)), ('discount', models.DecimalField(default=Decimal('0'), verbose_name='Discount', max_digits=10, decimal_places=2)), ('discount_unit', models.PositiveIntegerField( blank=True, null=True, default=1, editable=False, choices=[(1, 'Percent'), (2, 'Amount')], verbose_name='Discount Unit', )), ('total_discount', models.BooleanField(default=False, verbose_name='Total discount ?', editable=False)), ('vat_value', models.ForeignKey(on_delete=PROTECT, verbose_name='VAT', blank=True, to='creme_core.Vat', null=True)), ], options={ 'swappable': 'BILLING_PRODUCT_LINE_MODEL', 'ordering': ('created', ), 'verbose_name': 'Product line', 'verbose_name_plural': 'Product lines', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='ServiceLine', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('on_the_fly_item', models.CharField(max_length=100, null=True, verbose_name='On-the-fly line')), ('comment', models.TextField(verbose_name='Comment', blank=True)), ('quantity', models.DecimalField(default=Decimal('1.00'), verbose_name='Quantity', max_digits=10, decimal_places=2)), ('unit_price', models.DecimalField(default=Decimal('0'), verbose_name='Unit price', max_digits=10, decimal_places=2)), ('unit', models.CharField(max_length=100, verbose_name='Unit', blank=True)), ('discount', models.DecimalField(default=Decimal('0'), verbose_name='Discount', max_digits=10, decimal_places=2)), ('discount_unit', models.PositiveIntegerField( blank=True, null=True, default=1, editable=False, choices=[(1, 'Percent'), (2, 'Amount')], verbose_name='Discount Unit', )), ('total_discount', models.BooleanField(default=False, verbose_name='Total discount ?', editable=False)), ('vat_value', models.ForeignKey(on_delete=PROTECT, verbose_name='VAT', blank=True, to='creme_core.Vat', null=True)), ], options={ 'swappable': 'BILLING_SERVICE_LINE_MODEL', 'ordering': ('created', ), 'verbose_name': 'Service line', 'verbose_name_plural': 'Service lines', }, bases=('creme_core.cremeentity', ), ), ]
class Migration(migrations.Migration): # replaces = [ # ('commercial', '0001_initial'), # ('commercial', '0009_v2_0__real_entity_fks_1'), # ('commercial', '0010_v2_0__real_entity_fks_2'), # ('commercial', '0011_v2_0__real_entity_fks_3'), # ('commercial', '0012_v2_0__rm_commapp_ok_or_in_futur'), # ] initial = True dependencies = [ ('contenttypes', '0001_initial'), ('creme_core', '0001_initial'), migrations.swappable_dependency(settings.PERSONS_ORGANISATION_MODEL), migrations.swappable_dependency(settings.ACTIVITIES_ACTIVITY_MODEL), ] operations = [ migrations.CreateModel( name='MarketSegment', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('property_type', models.ForeignKey(editable=False, to='creme_core.CremePropertyType', null=True, on_delete=CASCADE)), ], options={ 'verbose_name': 'Market segment', 'verbose_name_plural': 'Market segments', }, bases=(models.Model, ), ), migrations.CreateModel( name='ActType', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('title', models.CharField(max_length=75, verbose_name='Title')), ('is_custom', models.BooleanField(default=True)), ], options={ 'ordering': ('title', ), 'verbose_name': 'Type of commercial action', 'verbose_name_plural': 'Types of commercial actions', }, bases=(models.Model, ), ), migrations.CreateModel( name='Act', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField( max_length=100, verbose_name='Name of the commercial action')), ('expected_sales', models.PositiveIntegerField(verbose_name='Expected sales')), ('cost', models.PositiveIntegerField( null=True, verbose_name='Cost of the commercial action', blank=True)), ('goal', models.TextField(verbose_name='Goal of the action', blank=True)), ('start', models.DateField(verbose_name='Start')), ('due_date', models.DateField(verbose_name='Due date')), ('segment', models.ForeignKey(on_delete=PROTECT, verbose_name='Related segment', to='commercial.MarketSegment')), ('act_type', models.ForeignKey(on_delete=PROTECT, verbose_name='Type', to='commercial.ActType')), ], options={ 'swappable': 'COMMERCIAL_ACT_MODEL', 'ordering': ('name', ), 'verbose_name': 'Commercial action', 'verbose_name_plural': 'Commercial actions', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='ActObjective', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('counter', models.PositiveIntegerField(default=0, verbose_name='Counter', editable=False)), ('counter_goal', models.PositiveIntegerField(default=1, verbose_name='Value to reach')), ('act', models.ForeignKey(related_name='objectives', editable=False, to=settings.COMMERCIAL_ACT_MODEL, on_delete=CASCADE)), ('ctype', creme_fields.CTypeForeignKey( blank=True, editable=False, to='contenttypes.ContentType', null=True, verbose_name='Counted type', )), ('filter', models.ForeignKey( on_delete=PROTECT, blank=True, editable=False, to='creme_core.EntityFilter', null=True, verbose_name='Filter on counted entities', )), ], options={ 'verbose_name': 'Commercial Objective', 'verbose_name_plural': 'Commercial Objectives', }, bases=(models.Model, ), ), migrations.CreateModel( name='ActObjectivePattern', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name')), ('average_sales', models.PositiveIntegerField(verbose_name='Average sales')), ('segment', models.ForeignKey(verbose_name='Related segment', to='commercial.MarketSegment', on_delete=CASCADE)), ], options={ 'swappable': 'COMMERCIAL_PATTERN_MODEL', 'ordering': ('name', ), 'verbose_name': 'Objective pattern', 'verbose_name_plural': 'Objective patterns', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='ActObjectivePatternComponent', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('success_rate', models.PositiveIntegerField(verbose_name='Success rate')), ('ctype', creme_fields.CTypeForeignKey(blank=True, editable=False, to='contenttypes.ContentType', null=True, verbose_name='Counted type')), ('filter', models.ForeignKey( on_delete=PROTECT, blank=True, editable=False, to='creme_core.EntityFilter', null=True, verbose_name='Filter on counted entities', )), ('parent', models.ForeignKey( related_name='children', editable=False, to='commercial.ActObjectivePatternComponent', null=True, on_delete=CASCADE, )), ('pattern', models.ForeignKey(related_name='components', editable=False, to=settings.COMMERCIAL_PATTERN_MODEL, on_delete=CASCADE)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='CommercialApproach', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('title', models.CharField(max_length=200, verbose_name='Title')), # ('ok_or_in_futur', models.BooleanField(default=False, verbose_name='Done?', editable=False)), ('description', models.TextField(verbose_name='Description', blank=True)), ('creation_date', creme_fields.CreationDateTimeField( default=now, verbose_name='Creation date', editable=False, blank=True)), # ('entity_id', models.PositiveIntegerField(editable=False)), ('entity', models.ForeignKey( editable=False, on_delete=CASCADE, to='creme_core.CremeEntity', related_name='commercial_approaches', )), # ('entity_content_type', models.ForeignKey(related_name='comapp_entity_set', editable=False, to='contenttypes.ContentType', on_delete=CASCADE)), ('entity_content_type', creme_fields.EntityCTypeForeignKey( editable=False, on_delete=CASCADE, related_name='+', to='contenttypes.ContentType', )), ('related_activity', models.ForeignKey(editable=False, to=settings.ACTIVITIES_ACTIVITY_MODEL, null=True, on_delete=CASCADE)), ], options={ 'verbose_name': 'Commercial approach', 'verbose_name_plural': 'Commercial approaches', }, bases=(models.Model, ), ), migrations.CreateModel( name='Strategy', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name')), ('evaluated_orgas', models.ManyToManyField( verbose_name='Evaluated organisation(s)', editable=False, to=settings.PERSONS_ORGANISATION_MODEL, )), ], options={ 'swappable': 'COMMERCIAL_STRATEGY_MODEL', 'ordering': ('name', ), 'verbose_name': 'Commercial strategy', 'verbose_name_plural': 'Commercial strategies', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='MarketSegmentDescription', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('product', models.TextField(verbose_name='Product', blank=True)), ('place', models.TextField(verbose_name='Place', blank=True)), ('price', models.TextField(verbose_name='Price', blank=True)), ('promotion', models.TextField(verbose_name='Promotion', blank=True)), ('segment', models.ForeignKey(to='commercial.MarketSegment', on_delete=CASCADE)), ('strategy', models.ForeignKey( related_name='segment_info', editable=False, to=settings.COMMERCIAL_STRATEGY_MODEL, on_delete=CASCADE, )), ], options={ 'verbose_name': 'Market segment description', 'verbose_name_plural': 'Market segment descriptions', }, bases=(models.Model, ), ), migrations.CreateModel( name='CommercialAsset', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('strategy', models.ForeignKey(related_name='assets', editable=False, to=settings.COMMERCIAL_STRATEGY_MODEL, on_delete=CASCADE)), ], options={ 'verbose_name': 'Commercial asset', 'verbose_name_plural': 'Commercial assets', }, bases=(models.Model, ), ), migrations.CreateModel( name='CommercialAssetScore', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('score', models.PositiveSmallIntegerField()), ('asset', models.ForeignKey(to='commercial.CommercialAsset', on_delete=CASCADE)), ('organisation', models.ForeignKey(to=settings.PERSONS_ORGANISATION_MODEL, on_delete=CASCADE)), ('segment_desc', models.ForeignKey(to='commercial.MarketSegmentDescription', on_delete=CASCADE)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='MarketSegmentCategory', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('category', models.PositiveSmallIntegerField()), ('organisation', models.ForeignKey(to=settings.PERSONS_ORGANISATION_MODEL, on_delete=CASCADE)), ('strategy', models.ForeignKey(to=settings.COMMERCIAL_STRATEGY_MODEL, on_delete=CASCADE)), ('segment_desc', models.ForeignKey(to='commercial.MarketSegmentDescription', on_delete=CASCADE)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='MarketSegmentCharm', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=100, verbose_name='Name')), ('strategy', models.ForeignKey(related_name='charms', editable=False, to=settings.COMMERCIAL_STRATEGY_MODEL, on_delete=CASCADE)), ], options={ 'verbose_name': 'Segment charm', 'verbose_name_plural': 'Segment charms', }, bases=(models.Model, ), ), migrations.CreateModel( name='MarketSegmentCharmScore', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('score', models.PositiveSmallIntegerField()), ('charm', models.ForeignKey(to='commercial.MarketSegmentCharm', on_delete=CASCADE)), ('organisation', models.ForeignKey(to=settings.PERSONS_ORGANISATION_MODEL, on_delete=CASCADE)), ('segment_desc', models.ForeignKey(to='commercial.MarketSegmentDescription', on_delete=CASCADE)), ], options={}, bases=(models.Model, ), ), ]
class Migration(migrations.Migration): # replaces = [ # ('crudity', '0001_initial'), # ('crudity', '0003_v1_7__sync_job_user'), # ] initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('contenttypes', '0001_initial'), ('auth', '0001_initial'), ('creme_core', '0001_initial'), ] operations = [ migrations.CreateModel( name='History', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', creme_fields.CreationDateTimeField( default=now, verbose_name='Creation date', editable=False, blank=True)), ('action', models.CharField(max_length=100, verbose_name='Action')), ('source', models.CharField(max_length=100, verbose_name='Source')), ('description', models.TextField(null=True, verbose_name='Description', blank=True)), ('entity', models.ForeignKey(verbose_name='Entity', to='creme_core.CremeEntity', on_delete=CASCADE)), ('user', creme_fields.CremeUserForeignKey(default=None, blank=True, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Owner')), ], options={ 'verbose_name': 'History', 'verbose_name_plural': 'History', }, bases=(models.Model, ), ), migrations.CreateModel( name='WaitingAction', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('action', models.CharField(max_length=100, verbose_name='Action')), ('source', models.CharField(max_length=100, verbose_name='Source')), ('data', models.TextField(null=True, blank=True)), ('subject', models.CharField(max_length=100, verbose_name='Subject')), ('ct', creme_fields.CTypeForeignKey(verbose_name="Ressource's type", to='contenttypes.ContentType')), ('user', creme_fields.CremeUserForeignKey(default=None, blank=True, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Owner')), ], options={ 'verbose_name': 'Waiting action', 'verbose_name_plural': 'Waiting actions', }, bases=(models.Model, ), ), ]
class Migration(migrations.Migration): # Memo: last migration is '0008_v2_1__move_description_to_entity_3' initial = True dependencies = [ ('creme_core', '0001_initial'), ('contenttypes', '0001_initial'), ] operations = [ migrations.CreateModel( name='RecurrentGenerator', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('name', models.CharField(max_length=100, verbose_name='Name of the generator', blank=True)), ('first_generation', models.DateTimeField( verbose_name='Date of the first generation')), ('last_generation', models.DateTimeField( verbose_name='Date of the last generation', null=True, editable=False)), ('periodicity', creme_fields.DatePeriodField( verbose_name='Periodicity of the generation')), ('is_working', models.BooleanField(default=True, verbose_name='Active ?', editable=False)), ('ct', creme_fields.CTypeForeignKey( editable=False, to='contenttypes.ContentType', verbose_name='Type of the recurrent resource')), ('template', models.ForeignKey(to='creme_core.CremeEntity', on_delete=CASCADE, related_name='template_set', editable=False, verbose_name='Related model')), ], options={ 'swappable': 'RECURRENTS_RGENERATOR_MODEL', 'ordering': ('name', ), 'verbose_name': 'Recurrent generator', 'verbose_name_plural': 'Recurrent generators', }, bases=('creme_core.cremeentity', ), ), ] if settings.TESTS_ON: operations.extend([ migrations.CreateModel( name='FakeRecurrentDoc', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('title', models.CharField(unique=True, max_length=50, verbose_name='Title')), ], options={ 'ordering': ('title', ), 'verbose_name': 'Test Recurrent Document', 'verbose_name_plural': 'Test Recurrent Documents', }, bases=('creme_core.cremeentity', ), ), migrations.CreateModel( name='FakeRecurrentTemplate', fields=[ ('cremeentity_ptr', models.OneToOneField( parent_link=True, auto_created=True, primary_key=True, serialize=False, to='creme_core.CremeEntity', on_delete=CASCADE, )), ('title', models.CharField(unique=True, max_length=50, verbose_name='Title')), ], options={ 'ordering': ('title', ), 'verbose_name': 'Test Recurrent Template', 'verbose_name_plural': 'Test Recurrent Templates', }, bases=('creme_core.cremeentity', ), ), ])