Пример #1
0
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', ),
        ),
    ]
Пример #2
0
class Migration(migrations.Migration):
    # Memo: last migration is '0025_v2_1__move_description_to_entity_3'

    initial = True
    dependencies = [
        ('contenttypes', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('creme_core', '0001_initial'),
        migrations.swappable_dependency(settings.DOCUMENTS_DOCUMENT_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Civility',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('title', models.CharField(max_length=100, verbose_name='Title')),
                ('shortcut', models.CharField(max_length=100, verbose_name='Shortcut')),
            ],
            options={
                'ordering': ('title',),
                'verbose_name': 'Civility',
                'verbose_name_plural': 'Civilities',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='LegalForm',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('title', models.CharField(max_length=100, verbose_name='Title')),
            ],
            options={
                'ordering': ('title',),
                'verbose_name': 'Legal form',
                'verbose_name_plural': 'Legal forms',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Position',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('title', models.CharField(max_length=100, verbose_name='Title')),
            ],
            options={
                'ordering': ('title',),
                'verbose_name': 'People position',
                'verbose_name_plural': 'People positions',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Sector',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('title', models.CharField(max_length=100, verbose_name='Title')),
            ],
            options={
                'ordering': ('title',),
                'verbose_name': 'Line of business',
                'verbose_name_plural': 'Lines of business',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='StaffSize',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('size', models.CharField(max_length=100, verbose_name='Size')),
                ('order', creme_fields.BasicAutoField(verbose_name='Order', editable=False, blank=True)),
            ],
            options={
                'ordering': ('order',),
                'verbose_name': 'Organisation staff size',
                'verbose_name_plural': 'Organisation staff sizes',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Address',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100, verbose_name='Name', blank=True)),
                ('address', models.TextField(verbose_name='Address', blank=True)),
                ('po_box', models.CharField(max_length=50, verbose_name='PO box', blank=True)),
                ('zipcode', models.CharField(max_length=100, verbose_name='Zip code', blank=True)),
                ('city', models.CharField(max_length=100, verbose_name='City', blank=True)),
                ('department', models.CharField(max_length=100, verbose_name='Department', blank=True)),
                ('state', models.CharField(max_length=100, verbose_name='State', blank=True)),
                ('country', models.CharField(max_length=40, verbose_name='Country', blank=True)),
                ('object', models.ForeignKey(editable=False, on_delete=CASCADE, to='creme_core.CremeEntity', related_name='persons_addresses')),
                ('content_type', creme_fields.EntityCTypeForeignKey(editable=False, on_delete=CASCADE, related_name='+', to='contenttypes.ContentType')),
            ],
            options={
                'ordering': ('id',),
                'swappable': 'PERSONS_ADDRESS_MODEL',
                'verbose_name': 'Address',
                'verbose_name_plural': 'Addresses',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('cremeentity_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False,
                                                         to='creme_core.CremeEntity', on_delete=CASCADE,
                                                        )
                ),
                ('civility', models.ForeignKey(on_delete=CREME_REPLACE_NULL, verbose_name='Civility', blank=True, to='persons.Civility', null=True)),
                ('last_name', models.CharField(max_length=100, verbose_name='Last name')),
                ('first_name', models.CharField(max_length=100, verbose_name='First name', blank=True)),
                ('phone', creme_fields.PhoneField(max_length=100, verbose_name='Phone number', blank=True)),
                ('mobile', creme_fields.PhoneField(max_length=100, verbose_name='Mobile', blank=True)),
                ('skype', models.CharField(max_length=100, verbose_name='Skype', blank=True)),
                ('fax', models.CharField(max_length=100, verbose_name='Fax', blank=True)),
                ('email', models.EmailField(max_length=254, verbose_name='Email address', blank=True)),
                ('url_site', models.URLField(max_length=500, verbose_name='Web Site', blank=True)),
                ('birthday', models.DateField(null=True, verbose_name='Birthday', blank=True)),
                ('billing_address',  models.ForeignKey(related_name='+', on_delete=SET_NULL, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Billing address')),
                ('shipping_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Shipping address')),
                ('image', ImageEntityForeignKey(on_delete=SET_NULL, verbose_name='Photograph', blank=True, null=True,
                                                to=settings.DOCUMENTS_DOCUMENT_MODEL,  # TODO: remove in deconstruct ?
                                                # limit_choices_to=models.Q(mime_type__name__startswith='image/'),
                                               ),
                ),
                ('is_user', models.ForeignKey(related_name='related_contact', on_delete=SET_NULL, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Related user')),
                ('position', models.ForeignKey(on_delete=CREME_REPLACE_NULL, verbose_name='Position', blank=True, to='persons.Position', null=True)),
                ('full_position', models.CharField(max_length=500, verbose_name='Detailed position', blank=True)),
                ('sector', models.ForeignKey(on_delete=CREME_REPLACE_NULL, verbose_name='Line of business', blank=True, to='persons.Sector', null=True)),
                ('language', models.ManyToManyField(verbose_name='Spoken language(s)', editable=False, to='creme_core.Language', blank=True)),
            ],
            options={
                'swappable': 'PERSONS_CONTACT_MODEL',
                'ordering': ('last_name', 'first_name'),
                'verbose_name': 'Contact',
                'verbose_name_plural': 'Contacts',
                'index_together': {('last_name', 'first_name', 'cremeentity_ptr')},
            },
            bases=('creme_core.cremeentity',),
        ),
        migrations.CreateModel(
            name='Organisation',
            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=200, verbose_name='Name')),
                ('is_managed', models.BooleanField(default=False, verbose_name='Managed by Creme', editable=False)),
                ('phone', creme_fields.PhoneField(max_length=100, verbose_name='Phone number', blank=True)),
                ('fax', models.CharField(max_length=100, verbose_name='Fax', blank=True)),
                ('email', models.EmailField(max_length=254, verbose_name='Email address', blank=True)),
                ('url_site', models.URLField(max_length=500, verbose_name='Web Site', blank=True)),
                ('capital', models.PositiveIntegerField(null=True, verbose_name='Capital', blank=True)),
                ('siren', models.CharField(max_length=100, verbose_name='SIREN', blank=True)),
                ('naf', models.CharField(max_length=100, verbose_name='NAF code', blank=True)),
                ('siret', models.CharField(max_length=100, verbose_name='SIRET', blank=True)),
                ('rcs', models.CharField(max_length=100, verbose_name='RCS/RM', blank=True)),
                ('tvaintra', models.CharField(max_length=100, verbose_name='VAT number', blank=True)),
                ('subject_to_vat', models.BooleanField(default=True, verbose_name='Subject to VAT')),
                ('annual_revenue', models.CharField(max_length=100, verbose_name='Annual revenue', blank=True)),
                ('creation_date', models.DateField(null=True, verbose_name='Date of creation of the organisation', blank=True)),
                ('billing_address',  models.ForeignKey(related_name='+', on_delete=SET_NULL, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Billing address')),
                ('shipping_address', models.ForeignKey(related_name='+', on_delete=SET_NULL, editable=False, to=settings.PERSONS_ADDRESS_MODEL, null=True, verbose_name='Shipping address')),
                ('image', ImageEntityForeignKey(on_delete=SET_NULL, verbose_name='Logo', blank=True, null=True,
                                                to=settings.DOCUMENTS_DOCUMENT_MODEL,
                                                # limit_choices_to=models.Q(mime_type__name__startswith='image/'),
                                               )
                ),
                ('legal_form', models.ForeignKey(on_delete=CREME_REPLACE_NULL, verbose_name='Legal form', blank=True, to='persons.LegalForm', null=True)),
                ('sector', models.ForeignKey(on_delete=CREME_REPLACE_NULL, verbose_name='Sector', blank=True, to='persons.Sector', null=True)),
                ('staff_size', models.ForeignKey(on_delete=CREME_REPLACE_NULL, verbose_name='Staff size', blank=True, to='persons.StaffSize', null=True)),
            ],
            options={
                'swappable': 'PERSONS_ORGANISATION_MODEL',
                'ordering': ('name',),
                'verbose_name': 'Organisation',
                'verbose_name_plural': 'Organisations',
                'index_together': {('name', 'cremeentity_ptr')},
            },
            bases=('creme_core.cremeentity',),
        ),
    ]
Пример #3
0
class Migration(migrations.Migration):
    # replaces = [
    #     ('tickets', '0001_initial'),
    #     ('tickets', '0008_v2_2__status_is_closed01'),
    #     ('tickets', '0009_v2_2__status_is_closed02'),
    # ]

    initial = True
    dependencies = [
        ('creme_core', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Criticity',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name',
                 models.CharField(unique=True,
                                  max_length=100,
                                  verbose_name='Name')),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Ticket criticality',
                'verbose_name_plural': 'Ticket criticalities',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='Priority',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name',
                 models.CharField(unique=True,
                                  max_length=100,
                                  verbose_name='Name')),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Ticket priority',
                'verbose_name_plural': 'Ticket priorities',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='Status',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name',
                 models.CharField(unique=True,
                                  max_length=100,
                                  verbose_name='Name')),
                ('is_custom', models.BooleanField(default=True)),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
                ('is_closed',
                 models.BooleanField(
                     default=False,
                     verbose_name='Is a "closed" status?',
                     help_text=
                     ('If you set as closed, existing tickets which use this status will '
                      'not be updated automatically (ie: closing dates will not be set).'
                      ),
                 )),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Ticket status',
                'verbose_name_plural': 'Ticket statuses',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='TicketNumber',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
            ],
        ),
        migrations.CreateModel(
            name='Ticket',
            fields=[
                ('cremeentity_ptr',
                 models.OneToOneField(
                     parent_link=True,
                     auto_created=True,
                     primary_key=True,
                     serialize=False,
                     to='creme_core.CremeEntity',
                     on_delete=CASCADE,
                 )),
                ('number',
                 models.PositiveIntegerField(verbose_name='Number',
                                             unique=True,
                                             editable=False)),
                ('title',
                 models.CharField(max_length=100,
                                  verbose_name='Title',
                                  blank=True)),
                ('solution',
                 models.TextField(verbose_name='Solution', blank=True)),
                ('closing_date',
                 models.DateTimeField(verbose_name='Closing date',
                                      null=True,
                                      editable=False,
                                      blank=True)),
                ('criticity',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Criticity',
                                   to='tickets.Criticity')),
                ('priority',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Priority',
                                   to='tickets.Priority')),
                ('status',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Status',
                                   to='tickets.Status')),
            ],
            options={
                'swappable': 'TICKETS_TICKET_MODEL',
                'ordering': ('title', ),
                'verbose_name': 'Ticket',
                'verbose_name_plural': 'Tickets',
            },
            bases=('creme_core.cremeentity', ),
        ),
        migrations.CreateModel(
            name='TicketTemplate',
            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(max_length=100,
                                  verbose_name='Title',
                                  blank=True)),
                ('solution',
                 models.TextField(verbose_name='Solution', blank=True)),
                ('criticity',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Criticity',
                                   to='tickets.Criticity')),
                ('priority',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Priority',
                                   to='tickets.Priority')),
                ('status',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Status',
                                   to='tickets.Status')),
            ],
            options={
                'swappable': 'TICKETS_TEMPLATE_MODEL',
                'ordering': ('title', ),
                'verbose_name': 'Ticket template',
                'verbose_name_plural': 'Ticket templates',
            },
            bases=('creme_core.cremeentity', ),
        ),
    ]
Пример #4
0
class Migration(migrations.Migration):
    # replaces = [
    #     ('projects', '0001_initial'),
    #     ('projects', '0016_v2_1__move_description_to_entity_1'),
    #     ('projects', '0017_v2_1__move_description_to_entity_2'),
    #     ('projects', '0018_v2_1__move_description_to_entity_3'),
    # ]

    initial = True
    dependencies = [
        ('creme_core', '0001_initial'),
        migrations.swappable_dependency(settings.ACTIVITIES_ACTIVITY_MODEL),
        migrations.swappable_dependency(settings.PERSONS_CONTACT_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ProjectStatus',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name', models.CharField(max_length=100,
                                          verbose_name='Name')),
                ('color_code',
                 creme_fields.ColorField(max_length=6,
                                         verbose_name='Color',
                                         blank=True)),
                ('description', models.TextField(verbose_name='Description')),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Status of project',
                'verbose_name_plural': 'Status of project',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='Project',
            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 project')),
                # ('description', models.TextField(verbose_name='Description', blank=True)),
                ('start_date',
                 models.DateTimeField(null=True,
                                      verbose_name='Estimated start',
                                      blank=True)),
                ('end_date',
                 models.DateTimeField(null=True,
                                      verbose_name='Estimated end',
                                      blank=True)),
                ('effective_end_date',
                 models.DateTimeField(null=True,
                                      verbose_name='Effective end date',
                                      blank=True,
                                      editable=False)),
                ('status',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Status',
                                   to='projects.ProjectStatus')),
                ('currency',
                 models.ForeignKey(
                     related_name='+',
                     on_delete=PROTECT,
                     default=1,
                     verbose_name='Currency',
                     to='creme_core.Currency',
                 )),
            ],
            options={
                'swappable': 'PROJECTS_PROJECT_MODEL',
                'ordering': ('name', ),
                'verbose_name': 'Project',
                'verbose_name_plural': 'Projects',
            },
            bases=('creme_core.cremeentity', ),
        ),
        migrations.CreateModel(
            name='TaskStatus',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name', models.CharField(max_length=100,
                                          verbose_name='Name')),
                ('color_code',
                 creme_fields.ColorField(max_length=6,
                                         verbose_name='Color',
                                         blank=True)),
                ('description', models.TextField(verbose_name='Description')),
                ('is_custom', models.BooleanField(default=True)),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Status of task',
                'verbose_name_plural': 'Status of task',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='ProjectTask',
            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(max_length=100,
                                           verbose_name='Title')),
                ('linked_project',
                 models.ForeignKey(
                     related_name='tasks_set',
                     editable=False,
                     to=settings.PROJECTS_PROJECT_MODEL,
                     verbose_name='Project',
                     on_delete=CASCADE,
                 )),
                ('order',
                 models.PositiveIntegerField(verbose_name='Order',
                                             null=True,
                                             editable=False,
                                             blank=True)),
                ('parent_tasks',
                 models.ManyToManyField(related_name='children_set',
                                        editable=False,
                                        to=settings.PROJECTS_TASK_MODEL)),
                ('start',
                 models.DateTimeField(null=True,
                                      verbose_name='Start',
                                      blank=True)),
                ('end',
                 models.DateTimeField(null=True,
                                      verbose_name='End',
                                      blank=True)),
                ('duration',
                 models.PositiveIntegerField(
                     null=True, verbose_name='Duration (in hours)',
                     blank=True)),
                # ('description', models.TextField(verbose_name='Description', blank=True)),
                ('tstatus',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Task situation',
                                   to='projects.TaskStatus')),
            ],
            options={
                'swappable': 'PROJECTS_TASK_MODEL',
                'ordering': ('-start', ),
                'verbose_name': 'Task of project',
                'verbose_name_plural': 'Tasks of project',
            },
            bases=('creme_core.CremeEntity', ),
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('cremeentity_ptr',
                 models.OneToOneField(
                     parent_link=True,
                     auto_created=True,
                     primary_key=True,
                     serialize=False,
                     to='creme_core.CremeEntity',
                     on_delete=CASCADE,
                 )),
                ('hourly_cost',
                 models.PositiveIntegerField(default=0,
                                             verbose_name='Hourly cost')),
                ('linked_contact',
                 models.ForeignKey(editable=False,
                                   to=settings.PERSONS_CONTACT_MODEL,
                                   verbose_name='Contact',
                                   on_delete=CASCADE)),
                ('task',
                 models.ForeignKey(related_name='resources_set',
                                   editable=False,
                                   to='projects.ProjectTask',
                                   verbose_name='Task',
                                   on_delete=CASCADE)),
            ],
            options={
                'verbose_name': 'Resource of project',
                'verbose_name_plural': 'Resources of project',
            },
            # bases=('creme_core.cremeentity',),
            bases=(models.Model, ),
        ),
    ]
Пример #5
0
class Migration(migrations.Migration):
    # replaces = [
    #     ('opportunities', '0001_initial'),
    #     ('opportunities', '0002_v1_7__reference_not_null_1'),
    #     ('opportunities', '0003_v1_7__reference_not_null_2'),
    #     ('opportunities', '0004_v1_7__description_not_null_1'),
    #     ('opportunities', '0005_v1_7__description_not_null_2'),
    #     ('opportunities', '0006_v1_7__salesphase_lost_1'),
    #     ('opportunities', '0007_v1_7__salesphase_lost_2'),
    # ]

    initial = True
    dependencies = [
        ('creme_core', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Origin',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name', models.CharField(max_length=100,
                                          verbose_name='Origin')),
            ],
            options={
                'ordering': ('name', ),
                'verbose_name': 'Origin of opportunity',
                'verbose_name_plural': 'Origins of opportunity',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='SalesPhase',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name', models.CharField(max_length=100,
                                          verbose_name='Name')),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
                ('won', models.BooleanField(default=False,
                                            verbose_name='Won')),
                ('lost', models.BooleanField(default=False,
                                             verbose_name='Lost')),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Sale phase',
                'verbose_name_plural': 'Sale phases',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='Opportunity',
            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 opportunity')),
                ('reference',
                 models.CharField(max_length=100,
                                  verbose_name='Reference',
                                  blank=True)),
                ('estimated_sales',
                 models.PositiveIntegerField(null=True,
                                             verbose_name='Estimated sales',
                                             blank=True)),
                ('made_sales',
                 models.PositiveIntegerField(null=True,
                                             verbose_name='Made sales',
                                             blank=True)),
                ('chance_to_win',
                 models.PositiveIntegerField(null=True,
                                             verbose_name='% of chance to win',
                                             blank=True)),
                ('expected_closing_date',
                 models.DateField(null=True,
                                  verbose_name='Expected closing date',
                                  blank=True)),
                ('closing_date',
                 models.DateField(null=True,
                                  verbose_name='Actual closing date',
                                  blank=True)),
                ('description',
                 models.TextField(verbose_name='Description', blank=True)),
                ('first_action_date',
                 models.DateField(null=True,
                                  verbose_name='Date of the first action',
                                  blank=True)),
                ('currency',
                 models.ForeignKey(on_delete=PROTECT,
                                   default=1,
                                   verbose_name='Currency',
                                   to='creme_core.Currency')),
                # ('origin', models.ForeignKey(on_delete=SET_NULL, verbose_name='Origin', blank=True, to='opportunities.Origin', null=True)),
                ('origin',
                 models.ForeignKey(on_delete=CREME_REPLACE_NULL,
                                   verbose_name='Origin',
                                   blank=True,
                                   to='opportunities.Origin',
                                   null=True)),
                ('sales_phase',
                 models.ForeignKey(on_delete=PROTECT,
                                   verbose_name='Sales phase',
                                   to='opportunities.SalesPhase')),
            ],
            options={
                'swappable': 'OPPORTUNITIES_OPPORTUNITY_MODEL',
                'ordering': ('name', ),
                'verbose_name': 'Opportunity',
                'verbose_name_plural': 'Opportunities',
            },
            bases=('creme_core.cremeentity', ),
        ),
    ]
Пример #6
0
class Migration(migrations.Migration):
    initial = True
    dependencies = [
        ('creme_core', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Criticity',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name',
                 models.CharField(unique=True,
                                  max_length=100,
                                  verbose_name='Name')),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Ticket criticality',
                'verbose_name_plural': 'Ticket criticalities',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='Priority',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name',
                 models.CharField(unique=True,
                                  max_length=100,
                                  verbose_name='Name')),
                ('order',
                 creme_fields.BasicAutoField(verbose_name='Order',
                                             editable=False,
                                             blank=True)),
            ],
            options={
                'ordering': ('order', ),
                'verbose_name': 'Ticket priority',
                'verbose_name_plural': 'Ticket priorities',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='Status',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('name',
                 models.CharField(unique=True,
                                  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', ),
                'verbose_name': 'Ticket status',
                'verbose_name_plural': 'Ticket statuses',
            },
            bases=(models.Model, ),
        ),
        migrations.CreateModel(
            name='TicketNumber',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
            ],
        ),
        migrations.CreateModel(
            name='Ticket',
            fields=[
                ('cremeentity_ptr',
                 models.OneToOneField(
                     parent_link=True,
                     auto_created=True,
                     primary_key=True,
                     serialize=False,
                     to='creme_core.CremeEntity',
                     on_delete=CASCADE,
                 )),
                ('number',
                 models.PositiveIntegerField(verbose_name='Number',
                                             unique=True,
                                             editable=False)),
                ('title',
                 models.CharField(max_length=100,
                                  verbose_name='Title',
                                  blank=True)),
                ('description', models.TextField(verbose_name='Description')),
                ('solution',
                 models.TextField(verbose_name='Solution', blank=True)),
                ('closing_date',
                 models.DateTimeField(verbose_name='Closing date',
                                      null=True,
                                      editable=False,
                                      blank=True)),
                # ('criticity', models.ForeignKey(on_delete=PROTECT, verbose_name='Criticity', to='tickets.Criticity')),
                ('criticity',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Criticity',
                                   to='tickets.Criticity')),
                # ('priority', models.ForeignKey(on_delete=PROTECT, verbose_name='Priority', to='tickets.Priority')),
                ('priority',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Priority',
                                   to='tickets.Priority')),
                # ('status', models.ForeignKey(on_delete=PROTECT, verbose_name='Status', to='tickets.Status')),
                ('status',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Status',
                                   to='tickets.Status')),
            ],
            options={
                'swappable': 'TICKETS_TICKET_MODEL',
                'ordering': ('title', ),
                'verbose_name': 'Ticket',
                'verbose_name_plural': 'Tickets',
            },
            bases=('creme_core.cremeentity', ),
        ),
        migrations.CreateModel(
            name='TicketTemplate',
            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(max_length=100,
                                  verbose_name='Title',
                                  blank=True)),
                ('description', models.TextField(verbose_name='Description')),
                ('solution',
                 models.TextField(verbose_name='Solution', blank=True)),
                # ('criticity', models.ForeignKey(on_delete=PROTECT, verbose_name='Criticity', to='tickets.Criticity')),
                ('criticity',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Criticity',
                                   to='tickets.Criticity')),
                # ('priority', models.ForeignKey(on_delete=PROTECT, verbose_name='Priority', to='tickets.Priority')),
                ('priority',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Priority',
                                   to='tickets.Priority')),
                # ('status', models.ForeignKey(on_delete=PROTECT, verbose_name='Status', to='tickets.Status')),
                ('status',
                 models.ForeignKey(on_delete=CREME_REPLACE,
                                   verbose_name='Status',
                                   to='tickets.Status')),
            ],
            options={
                'swappable': 'TICKETS_TEMPLATE_MODEL',
                'ordering': ('title', ),
                'verbose_name': 'Ticket template',
                'verbose_name_plural': 'Ticket templates',
            },
            bases=('creme_core.cremeentity', ),
        ),
    ]