@ -32,13 +32,15 @@ class Kalachakra_PortalAccount(CustomerPortal):
user_id = int ( request . env . context . get ( ' uid ' ) )
user = request . env [ ' res.users ' ] . search ( [ ( ' id ' , ' = ' , user_id ) ] )
#KALACHAKRA : on affiche que les factures de l'utilisateur liées à une retraite
booking_registrations = request . env [ ' event.registration ' ] . sudo ( ) . search ( [ ( ' booking_event ' , ' = ' , True ) , ( ' partner_id' , ' = ' , int ( user . partner_id ) ) ] )
booking_registrations = request . env [ ' event.registration ' ] . sudo ( ) . search ( [ ( ' partner_id ' , ' = ' , int ( user . partner_id ) ) ] )
invoice_ids = booking_registrations . invoice_id . ids
down_payment_invoice_ids = booking_registrations . down_payment_invoice_id . ids
AccountInvoice = request . env [ ' account.move ' ] . search ( [ ( ' id ' , ' in ' , invoice_ids ) ] )
AccountInvoice_d = request . env [ ' account.move ' ] . search ( [ ( ' id ' , ' in ' , down_payment_invoice_ids ) ] )
domain = [ ( ' id ' , ' in ' , invoice_ids ) , ( ' move_type ' , ' in ' , ( ' out_invoice ' , ' out_refund ' , ' in_invoice ' , ' in_refund ' , ' out_receipt ' , ' in_receipt ' ) ) ]
domain = [ ' | ' , ( ' id ' , ' in ' , down_payment_invoice_ids ) , ( ' id ' , ' in ' , invoice_ids ) , ( ' move_type ' , ' in ' , ( ' out_invoice ' , ' out_refund ' , ' in_invoice ' , ' in_refund ' , ' out_receipt ' , ' in_receipt ' ) ) ]
searchbar_sortings = {
@ -66,7 +68,7 @@ class Kalachakra_PortalAccount(CustomerPortal):
domain + = [ ( ' create_date ' , ' > ' , date_begin ) , ( ' create_date ' , ' <= ' , date_end ) ]
# count for pager
invoice_count = AccountInvoice . search_count ( domain )
invoice_count = request . env [ ' account.move ' ] . search_count ( domain )
# pager
pager = portal_pager (
@ -77,7 +79,7 @@ class Kalachakra_PortalAccount(CustomerPortal):
step = self . _items_per_page
)
# content according to pager and archive selected
invoices = AccountInvoice . search ( domain , order = order , limit = self . _items_per_page , offset = pager [ ' offset ' ] )
invoices = request . env [ ' account.move ' ] . search ( domain , order = order , limit = self . _items_per_page , offset = pager [ ' offset ' ] )
request . session [ ' my_invoices_history ' ] = invoices . ids [ : 100 ]
@ -102,11 +104,17 @@ class Kalachakra_PortalAccount(CustomerPortal):
user = request . env [ ' res.users ' ] . search ( [ ( ' id ' , ' = ' , user_id ) ] )
booking_registrations = request . env [ ' event.registration ' ] . sudo ( ) . search ( [ ( ' booking_event ' , ' = ' , True ) , ( ' partner_id ' , ' = ' , int ( user . partner_id ) ) ] )
invoice_ids = booking_registrations . invoice_id . ids
down_payment_invoice_ids = booking_registrations . down_payment_invoice_id . ids
invoice_count = request . env [ ' account.move ' ] . search_count ( [ ( ' id ' , ' in ' , invoice_ids ) ,
( ' move_type ' , ' in ' , ( ' out_invoice ' , ' in_invoice ' , ' out_refund ' , ' in_refund ' , ' out_receipt ' , ' in_receipt ' ) ) ,
] ) if request . env [ ' account.move ' ] . check_access_rights ( ' read ' , raise_exception = False ) else 0
values [ ' invoice_count ' ] = invoice_count
invoice_count_d = request . env [ ' account.move ' ] . search_count ( [ ( ' id ' , ' in ' , down_payment_invoice_ids ) ,
( ' move_type ' , ' in ' , ( ' out_invoice ' , ' in_invoice ' , ' out_refund ' , ' in_refund ' , ' out_receipt ' , ' in_receipt ' ) ) ,
] ) if request . env [ ' account.move ' ] . check_access_rights ( ' read ' , raise_exception = False ) else 0
values [ ' invoice_count ' ] = invoice_count + invoice_count_d
return values
class KalaAuthSignupHome ( Home ) :