Example #1
0
class TravailBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'Travail') & has_related_entities('travaux', 'object')

    def parent_entity(self):
        if self.entity.reverse_travaux:
            return self.entity.reverse_travaux[0]
Example #2
0
class CWETypeWorkflowTab(EntityView):
    __regid__ = 'cwetype-workflow'
    __select__ = (is_instance('CWEType')
                  & has_related_entities('workflow_of', 'object'))

    def cell_call(self, row, col):
        entity = self.cw_rset.get_entity(row, col)
        if entity.default_workflow:
            wf = entity.default_workflow[0]
            if len(entity.reverse_workflow_of) > 1:
                self.w(u'<h1>%s (%s)</h1>' %
                       (wf.name, self._cw._('default_workflow')))
            self.display_workflow(wf)
            defaultwfeid = wf.eid
        else:
            self.w(u'<div class="error">%s</div>' %
                   self._cw._('There is no default workflow'))
            defaultwfeid = None
        for altwf in entity.reverse_workflow_of:
            if altwf.eid == defaultwfeid:
                continue
            self.w(u'<h1>%s</h1>' % altwf.name)
            self.display_workflow(altwf)

    def display_workflow(self, wf):
        self.w(wf.view('wfgraph'))
        self.w(
            '<a href="%s">%s</a>' %
            (wf.absolute_url(), self._cw._('more info about this workflow')))
Example #3
0
class OccupationBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'Occupation') & has_related_entities('personne')

    def parent_entity(self):
        if self.entity.personne:
            return self.entity.personne[0]
Example #4
0
class CreatePersonHook(Hook):
    __regid__ = 'drh.createperson'
    __select__ = (Hook.__select__ & is_instance('EmailAddress')
                  & ~has_related_entities('use_email', 'object', 'CWUser'))
    events = ('after_add_entity', )

    def __call__(self):
        CreatePersonOp.get_instance(self._cw).add_data(self.entity.eid)
Example #5
0
class CWSourceImportsTab(EntityView):
    __regid__ = 'cwsource-imports'
    __select__ = (is_instance('CWSource')
                  & has_related_entities('cw_import_of', 'object'))

    def entity_call(self, entity):
        rset = self._cw.execute(
            'Any X, XST, XET, XS ORDERBY XST DESC WHERE '
            'X cw_import_of S, S eid %(s)s, X status XS, '
            'X start_timestamp XST, X end_timestamp XET', {'s': entity.eid})
        self._cw.view('cw.imports-table', rset, w=self.w)
Example #6
0
class FolderIBreadCrumbsAdapter(IBreadCrumbsAdapter):
    __select__ = IBreadCrumbsAdapter.__select__ & has_related_entities(
        'filed_under')

    def parent_entity(self):
        return self.entity.filed_under[0]
Example #7
0
class FabriqueAvecMatBCAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'FabriqueAvecMat') & has_related_entities('avec_mat', 'object')

    def parent_entity(self):
        return self.entity.reverse_avec_mat[0]
Example #8
0
class IntervenantBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'Intervenant') & has_related_entities('intervenants', 'object')

    def parent_entity(self):
        return self.entity.reverse_intervenants[0]
Example #9
0
class DestinataireBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'Destinataire') & has_related_entities('destinataires', 'object')

    def parent_entity(self):
        return self.entity.reverse_destinataires[0]
Example #10
0
class VendeurBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'Vendeur') & has_related_entities('vendeurs', 'object')

    def parent_entity(self):
        return self.entity.reverse_vendeurs[0]
Example #11
0
class TransactionBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'Transaction', 'Commande') & has_related_entities('compte')

    def parent_entity(self):
        return self.entity.compte[0]
Example #12
0
class OccasionBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance(
        'Occasion') & has_related_entities('occasion', 'object')

    def parent_entity(self):
        return self.entity.reverse_occasion[0]
Example #13
0
class AchatBreadCrumbAdapter(IBreadCrumbsAdapter):
    __select__ = one_line_rset() & is_instance('AchatMateriaux', 'AchatPretPorter', 'AchatFabrication') & \
                 has_related_entities('achat', 'object')

    def parent_entity(self):
        return self.entity.reverse_achat[0]