Exemplo n.º 1
0
class ContactCardHatBrick(Brick):
    id_ = SimpleBrick._generate_hat_id('persons', 'contact_card')
    verbose_name = _('Card header block')
    dependencies = [
        Contact, Organisation, Relation, *Activities4Card.dependencies,
        *Opportunities4Card.dependencies, *CommercialActs4Card.dependencies
    ]
    relation_type_deps = [
        constants.REL_SUB_EMPLOYED_BY,
        constants.REL_SUB_MANAGES,
        *Activities4Card.relation_type_deps,
        *Opportunities4Card.relation_type_deps,
        *CommercialActs4Card.relation_type_deps,
    ]
    template_name = 'persons/bricks/contact-hat-card.html'

    def detailview_display(self, context):
        contact = context['object']
        is_hidden = context['fields_configs'].get_4_model(
            Contact).is_fieldname_hidden

        return self._render(
            self.get_template_context(
                context,
                hidden_fields={
                    fname
                    for fname in ('phone', 'mobile', 'email', 'position')
                    if is_hidden(fname)
                },
                activities=Activities4Card.get(context, contact),
                neglected_indicator=NeglectedContactIndicator(
                    context, contact),
                opportunities=Opportunities4Card.get(context, contact),
                acts=CommercialActs4Card.get(context, contact),
            ))
Exemplo n.º 2
0
class OppTotalBrick(SimpleBrick):
    id_ = SimpleBrick.generate_id('opportunities', 'total')
    dependencies = (Opportunity, Relation)
    relation_type_deps = (constants.REL_OBJ_LINKED_QUOTE, )
    verbose_name = _('Total')
    template_name = 'opportunities/bricks/total.html'
    target_ctypes = (Opportunity, )
Exemplo n.º 3
0
class ProjectExtraInfoBrick(SimpleBrick):
    id_ = SimpleBrick.generate_id('projects', 'project_extra_info')
    dependencies = (ProjectTask, )
    verbose_name = _('Extra project information')
    description = _('Displays cost & total overtime for a project.')
    template_name = 'projects/bricks/project-extra-info.html'
    target_ctypes = (Project, )
Exemplo n.º 4
0
class TaskExtraInfoBrick(SimpleBrick):
    id_ = SimpleBrick.generate_id('projects', 'task_extra_info')
    dependencies = (Activity, )
    verbose_name = _('Extra project task information')
    description = _(
        'Displays effective duration & additional/remaining hours for a task.')
    template_name = 'projects/bricks/task-extra-info.html'
    target_ctypes = (ProjectTask, )
Exemplo n.º 5
0
class OrganisationCardHatBrick(Brick):
    id_ = SimpleBrick._generate_hat_id('persons', 'organisation_card')
    verbose_name = _('Card header block')
    dependencies = [
        Organisation,
        Contact,
        Address,
        Relation,
        *Activities4Card.dependencies,
        *Opportunities4Card.dependencies,
        *CommercialActs4Card.dependencies,
    ]
    relation_type_deps = [
        constants.REL_OBJ_CUSTOMER_SUPPLIER,
        constants.REL_SUB_CUSTOMER_SUPPLIER,
        constants.REL_OBJ_MANAGES,
        constants.REL_OBJ_EMPLOYED_BY,
        *Activities4Card.relation_type_deps,
        *Opportunities4Card.relation_type_deps,
        *CommercialActs4Card.relation_type_deps,
    ]
    template_name = 'persons/bricks/organisation-hat-card.html'

    def detailview_display(self, context):
        organisation = context['object']
        user = context['user']
        managed_orgas = Organisation.objects.filter_managed_by_creme()

        get_fconfigs = context['fields_configs'].get_4_model
        is_hidden = get_fconfigs(Organisation).is_fieldname_hidden

        return self._render(
            self.get_template_context(
                context,
                hidden_fields={
                    fname
                    for fname in ('phone', 'billing_address', 'legal_form')
                    if is_hidden(fname)
                },
                position_is_hidden=get_fconfigs(Contact).is_fieldname_hidden(
                    'position'),
                is_customer=managed_orgas.filter(
                    relations__type=constants.REL_OBJ_CUSTOMER_SUPPLIER,
                    relations__object_entity=organisation.id,
                ).exists(),
                is_supplier=managed_orgas.filter(
                    relations__type=constants.REL_SUB_CUSTOMER_SUPPLIER,
                    relations__object_entity=organisation.id,
                ).exists(),
                managers=EntityCredentials.filter(
                    user, organisation.get_managers())[:16],
                employees=EntityCredentials.filter(
                    user, organisation.get_employees())[:16],
                activities=Activities4Card.get(context, organisation),
                opportunities=Opportunities4Card.get(context, organisation),
                acts=CommercialActs4Card.get(context, organisation)))
Exemplo n.º 6
0
class ServiceLinesBrick(_LinesBrick):
    id_ = SimpleBrick.generate_id('billing', 'service_lines')
    verbose_name = _(u'Service lines')
    template_name = 'billing/bricks/service-lines.html'
    line_model = ServiceLine
    related_item_model = ServiceLine.related_item_class()
    related_item_label = related_item_model._meta.verbose_name

    def _get_document_lines(self, document):
        return document.get_lines(ServiceLine)
Exemplo n.º 7
0
class ProductLinesBrick(_LinesBrick):
    id_ = SimpleBrick.generate_id('billing', 'product_lines')
    verbose_name = _(u'Product lines')
    template_name = 'billing/bricks/product-lines.html'
    line_model = ProductLine
    related_item_model = ProductLine.related_item_class()
    related_item_label = related_item_model._meta.verbose_name

    def _get_document_lines(self, document):
        return document.get_lines(ProductLine)
Exemplo n.º 8
0
class TotalBrick(Brick):
    id_ = SimpleBrick.generate_id('billing', 'total')
    dependencies = (ProductLine, ServiceLine, Relation, CreditNote, Quote,
                    Invoice, SalesOrder, TemplateBase)
    relation_type_deps = (constants.REL_OBJ_CREDIT_NOTE_APPLIED, )
    verbose_name = _(u'Total')
    template_name = 'billing/bricks/total.html'
    target_ctypes = (Invoice, CreditNote, Quote, SalesOrder, TemplateBase)

    def detailview_display(self, context):
        return self._render(
            self.get_template_context(
                context,
                cell_class=getattr(settings, 'CSS_NUMBER_LISTVIEW', ''),
            ))
 class TestPortalBrick2(TestPortalBrick):
     id_ = SimpleBrick.generate_id('creme_config',
                                   'test_register_portal_bricks2')
Exemplo n.º 10
0
class ResultsBrick(SimpleBrick):
    id_ = SimpleBrick.generate_id('events', 'results')
    # dependencies  = (Relation,) ??
    verbose_name = _('Results of an event')
    template_name = 'events/bricks/results.html'
    target_ctypes = (get_event_model(), )
Exemplo n.º 11
0
class ServiceLinesBrick(_LinesBrick):
    id_ = SimpleBrick.generate_id('billing', 'service_lines')
    verbose_name = _('Service lines')
    template_name = 'billing/bricks/service-lines.html'
    line_model = ServiceLine
Exemplo n.º 12
0
class ProductLinesBrick(_LinesBrick):
    id_ = SimpleBrick.generate_id('billing', 'product_lines')
    verbose_name = _('Product lines')
    template_name = 'billing/bricks/product-lines.html'
    line_model = ProductLine
Exemplo n.º 13
0
 class TestBrick2(SimpleBrick):
     id_ = SimpleBrick.generate_id('creme_config', 'test_registry_register_bricks2')
Exemplo n.º 14
0
class TaskExtraInfoBrick(SimpleBrick):
    id_           = SimpleBrick.generate_id('projects', 'task_extra_info')
    dependencies  = (Activity,)
    verbose_name  = _('Extra project task information')
    template_name = 'projects/bricks/task-extra-info.html'
    target_ctypes = (ProjectTask,)
Exemplo n.º 15
0
class SendingBrick(SimpleBrick):
    id_           = SimpleBrick.generate_id('emails', 'sending')
    dependencies  = (EmailSending,)
    verbose_name  = 'Info on the sending'
    template_name = 'emails/bricks/sending.html'
    configurable  = False
Exemplo n.º 16
0
 class TestUserBrick2(SimpleBrick):
     id_ = SimpleBrick.generate_id('creme_config',
                                   'test_register_userbricks2')
Exemplo n.º 17
0
 class TestBrick3(TestBrick):
     id_ = SimpleBrick.generate_id('creme_config',
                                   'test_register_app_bricks3')
Exemplo n.º 18
0
 class SectorBrick_V2(GenericModelBrick):
     id_ = SimpleBrick.generate_id('creme_config',
                                   'test_register_model08_V2')
Exemplo n.º 19
0
class TargetBrick(SimpleBrick):
    id_ = SimpleBrick.generate_id('billing', 'target')
    dependencies = (Invoice, CreditNote, SalesOrder, Quote, TemplateBase)
    verbose_name = _(u'Target and source')
    template_name = 'billing/bricks/target.html'
    target_ctypes = (Invoice, CreditNote, Quote, SalesOrder, TemplateBase)
Exemplo n.º 20
0
 class TestBrick(SimpleBrick):
     id_ = SimpleBrick.generate_id('creme_config',
                                   'test_app_registry_is_empty02')