コード例 #1
0
 def test_rql_condition_entity(self):
     with self.admin_access.web_request() as req:
         selector = rql_condition('X identity U')
         rset = req.user.as_rset()
         self.assertEqual(selector(None, req, rset=rset), 1)
         self.assertEqual(selector(None, req, entity=req.user), 1)
         self.assertEqual(selector(None, req), 0)
コード例 #2
0
ファイル: compte.py プロジェクト: gurneyalex/myosotis
class CompteCommandesTab(EntityView):
    __select__ = is_instance('Compte') & rql_condition('T compte X, T is Commande')
    __regid__ = _('commandes_tab')
    title = _('Commandes')
    def cell_call(self, row, col):
        entity = self.cw_rset.complete_entity(row, col)
        rset = self._cw.execute('Any T ORDERBY P where T is Commande, T numero P,  T compte C, C eid %(eid)s', {'eid': entity.eid})
        self.wview('myosotis.commande.attributestableview', rset)
コード例 #3
0
ファイル: compte.py プロジェクト: gurneyalex/myosotis
class CompteOccasionTab(EntityView):
    __select__ = is_instance('Compte') & rql_condition('T compte X, T occasion O')
    __regid__ = _('occasions_tab')
    title = _('Occasion')
    def cell_call(self, row, col):
        entity = self.cw_rset.complete_entity(row, col)
        rset = self._cw.execute('Any O where O is Occasion, EXISTS (T occasion O, T compte C, C eid %(eid)s)', {'eid': entity.eid})
        self.wview('myosotis.occasion.attributestableview', rset)
コード例 #4
0
ファイル: compte.py プロジェクト: gurneyalex/myosotis
class CompteChangeTab(EntityView):
    __select__ = is_instance('Compte') & rql_condition('C is Change, X change C')
    __regid__ = _('changes_tab')
    title = _('Changes')
    def cell_call(self, row, col):
        entity = self.cw_rset.complete_entity(row, col)
        rset = self._cw.execute('Any T where T is Change, C change T, C eid %(eid)s', {'eid': entity.eid})
        self.wview('myosotis.change.attributestableview', rset)
コード例 #5
0
ファイル: compte.py プロジェクト: gurneyalex/myosotis
class CompteTransactionTab2(EntityView):
    __select__ = is_instance('Compte') & rql_condition('T compte X, T is Transaction')
    __regid__ = _('transactions_tab')
    title = _('Transactions')
    def cell_call(self, row, col):
        entity = self.cw_rset.complete_entity(row, col)
        rql = entity.cw_related_rql('compte', 'object', ('Transaction',),)
        rset = self._cw.execute(rql, {'x': entity.eid})
        self.wview('myosotis.transaction.attributestableview', rset)
コード例 #6
0
class ExpenseLineFilesComponent(component.EntityCtxComponent):
    """display the list of files attached to the expenselines"""
    __regid__ = 'expenseline.attachments'
    __select__ = (component.EntityCtxComponent.__select__
                  & authenticated_user() & is_instance('Expense')
                  & rql_condition('EXISTS(X has_lines Y, Y has_attachment F) '
                                  'OR EXISTS(X has_attachment F)'))
    title = _('has_attachment')

    def render_body(self, w):
        rset = self._cw.execute(
            '(Any F WHERE X has_attachment F, X eid %(x)s)'
            ' UNION '
            '(Any F WHERE X has_lines Y, Y has_attachment F, X eid %(x)s)',
            dict(x=self.entity.eid))
        self._cw.view('incontext', rset, 'null', w=w)
コード例 #7
0
 def test_rql_condition_user(self):
     with self.admin_access.web_request() as req:
         selector = rql_condition('U login "admin"', user_condition=True)
         self.assertEqual(selector(None, req), 1)
         selector = rql_condition('U login "toto"', user_condition=True)
         self.assertEqual(selector(None, req), 0)
コード例 #8
0
class CWETypeRQLAction(Action):
    __regid__ = 'testaction'
    __select__ = is_instance('CWEType') & rql_condition('X name "CWEType"')
    title = 'bla'