def query(self): query = DBSESSION().query(Task) query = query.with_polymorphic([Invoice, CancelInvoice]) query = query.outerjoin(Invoice.payments) query = query.outerjoin(Task.customer) query = query.options( contains_eager(Invoice.payments).load_only(Payment.id, Payment.date, Payment.mode)) query = query.options( contains_eager(Task.customer).load_only(Customer.name, Customer.code, Customer.id)) query = query.filter(Task.status == 'valid') return query
def query(self): """ Return the main query for our list view """ logger.debug("Queryiing") query = DBSESSION().query(distinct(User.id), User) return query.outerjoin(User.companies)
def query(self): """ Return the main query for our list view """ logger.debug("Queryiing") query = DBSESSION().query(distinct(User.id), User) return query.outerjoin(User.companies)
def query(self): company = self.request.context # We can't have projects without having customers if not company.customers: redirect_to_customerslist(self.request, company) main_query = DBSESSION().query(distinct(Project.id), Project) main_query = main_query.outerjoin(Project.customers) return main_query.filter(Project.company_id == company.id)
def query(self): company = self.request.context # We can't have projects without having customers if not company.customers: redirect_to_customerslist(self.request, company) main_query = DBSESSION().query(distinct(Project.id), Project) main_query = main_query.outerjoin(Project.customers) return main_query.filter(Project.company_id == company.id)
def _query_mentions(cls, btype_id, doctype): query = DBSESSION().query(TaskMention) query = query.outerjoin(TaskMention.business_type_rel) query = query.filter(TaskMention.active == True) query = query.filter( BusinessTypeTaskMention.business_type_id == btype_id) query = query.filter(BusinessTypeTaskMention.doctype == doctype) return query
def query(self): query = DBSESSION().query(Task) query = query.with_polymorphic([Invoice, CancelInvoice]) query = query.outerjoin(Invoice.payments) query = query.outerjoin(Task.customer) query = query.outerjoin(Task.company) query = query.options( contains_eager(Invoice.payments).load_only(Payment.id, Payment.date, Payment.mode)) query = query.options( contains_eager(Task.customer).load_only( Customer.name, Customer.code, Customer.id, Customer.firstname, Customer.lastname, Customer.civilite, Customer.type_, )) query = query.options( contains_eager(Task.company).load_only( Company.name, Company.id, )) query = query.options( load_only( "_acl", "name", "date", "id", "ht", "tva", "ttc", "company_id", "customer_id", "official_number", "internal_number", "prefix", "status", Invoice.paid_status, )) query = query.filter(Task.status == 'valid') return query
def query(self): query = DBSESSION().query(Task) query = query.with_polymorphic([Invoice, CancelInvoice]) query = query.outerjoin(Invoice.payments) query = query.outerjoin(Task.customer) query = query.outerjoin(Task.company) query = query.options( contains_eager(Invoice.payments).load_only( Payment.id, Payment.date, Payment.mode ) ) query = query.options( contains_eager(Task.customer).load_only( Customer.name, Customer.code, Customer.id, Customer.firstname, Customer.lastname, Customer.civilite, Customer.type_, ) ) query = query.options( contains_eager(Task.company).load_only( Company.name, Company.id, ) ) query = query.options( load_only( "_acl", "name", "date", "id", "ht", "tva", "ttc", "company_id", "customer_id", "official_number", "internal_number", "status", Invoice.paid_status, ) ) return query
def _query_mentions(cls, btype_id, doctype): query = DBSESSION().query(TaskMention) query = query.outerjoin(TaskMention.business_type_rel) query = query.filter(TaskMention.active == True) query = query.filter( BusinessTypeTaskMention.business_type_id == btype_id ) query = query.filter( BusinessTypeTaskMention.doctype == doctype ) return query
def query(self): query = DBSESSION().query(distinct(ExpenseSheet.id), ExpenseSheet) query = query.outerjoin(ExpenseSheet.user) return query
def query(self): query = DBSESSION().query(distinct(ExpenseSheet.id), ExpenseSheet) query = query.outerjoin(ExpenseSheet.user) return query