← Back to team overview

clearcorp team mailing list archive

lp:~dr.clearcorp/openerp-ccorp-addons/6.1-partner_ledgar_report into lp:openerp-ccorp-addons/6.1

 

Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-ccorp-addons/6.1-partner_ledgar_report into lp:openerp-ccorp-addons/6.1.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-partner_ledgar_report/+merge/164253

[ADD] Add the account_general_ledger module that create account general ledger.
[FIX] Fix the method move_lines. Improve the method with the "order_by" instructions
-- 
https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-partner_ledgar_report/+merge/164253
Your team CLEARCORP development team is subscribed to branch lp:openerp-ccorp-addons/6.1.
=== modified file 'account_general_ledger_report/report/account_general_ledger_report.mako'
--- account_general_ledger_report/report/account_general_ledger_report.mako	2013-05-15 15:49:58 +0000
+++ account_general_ledger_report/report/account_general_ledger_report.mako	2013-05-16 19:42:27 +0000
@@ -59,103 +59,97 @@
             </div>            
         </div>
         <%
-            account_lines, account_balance, account_conciliation = get_data(cr, uid, data) 
+            account_list_obj, account_lines, account_conciliation, account_balance, move_names = get_data(cr, uid, data) 
         %> 
-        %for account, move_lines in account_lines.items():
+        %for account in account_list_obj:
            <%
-                count = 1
-                cumul_balance_ant = 0
-                cumul_balance_ac = 0
+                cumul_balance = account_balance[account.id]['balance']
                 amount_total_debit = amount_total_credit = amount_total_acum = 0.0
+                print_column = False
+                move_lines = []
            %>
-           <br/><br/>
-           <div class="table header">
-                <div class="table-row">
-                   <div class="table-cell text">
-                        <p class="subtitle">${account.code +' - ' +account.name}</p>
-                        <p class="subtitle">${_('Initial balance:')}&nbsp;&nbsp;${formatLang(account_balance[account.id]['balance'])}</p>
-                   </div>
-                </div>
-           </div>
-           <div class="table list">
-                <div class="table-header">
-                    <div class="table-row labels no-wrap">                       
-                        <div class="table-cell first-column" style="width: 70px">${_('Date')}</div>
-                        <div class="table-cell" style="width: 70px">${_('Period')}</div>
-                        <div class="table-cell" style="width: 70px">${_('Entry')}</div>
-                        <div class="table-cell" style="width: 70px">${_('Journal')}</div>
-                        <div class="table-cell" style="width: 100px">${_('Partner')}</div>                    
-                        <div class="table-cell" style="width: 100px">${_('Label')}</div>
-                        %if len(account_conciliation) > 0:
-                            <div class="table-cell" style="width: 70px">${_('Reconcile')}</div>
-                        %endif
-                        <div class="table-cell" style="width: 80px">${_('Debit')}</div>
-                        <div class="table-cell" style="width: 80px">${_('Credit')}</div>
-                        <div class="table-cell amount last-column" style="width: 80px">${_('Cumul. Bal.')}</div>                        
-                    </div>
-                </div>
-                <div class="table-body"> 
-                    %for line in move_lines:
-                        <% 
-                            move_names = extract_name_move(cr, uid, move_lines)
-                            
-                            amount_total_debit += line.debit
-                            amount_total_credit += line.credit
-                        %>
-                        <div class="table-row ${row_even and 'even' or 'odd'}">
-                            <div class="table-cell first-column" style="width: 70px">${formatLang(line.date, date=True)}</div>
-                            <div class="table-cell" style="width: 70px">${line.period_id.name or ''}</div>
-                            <div class="table-cell" style="width: 70px">${move_names[line.id]}</div>
-                            <div class="table-cell" style="width: 70px">${line.journal_id.name}</div>    
-                            <div class="table-cell" style="width: 100px">${line.partner_id.name or ''}</div>
-                            <div class="table-cell" style="width: 100px">${line.name or ''}</div> 
-                            %if len(account_conciliation) > 0:
-                                <div class="table-cell" style="width: 70px">
-                                    %if account.id in account_conciliation.keys() and line.id in account_conciliation.keys():
-                                        conciliation = account_conciliation[account.id][line.id]
-                                    %endif
-                                 ${conciliation or ''}   
-                                 </div>
-                            %endif 
-                            <div class="table-cell amount" style="width: 80px">${formatLang(line.debit)}</div>
-                            <div class="table-cell amount" style="width: 80px">${formatLang(line.credit)}</div>  
-                            %if count == 1:
-                                <%                                  
-                                    cumul_balance_ant = account_balance[account.id]['balance']
-                                %>
-                                <div class="table-cell amount last-column" style="width: 80px">${formatLang(cumul_balance_ant)}</div>  
-                                <% count +=1 %>           
-                            %else:
-                                <%                                     
-                                   cumul_balance_ac = cumul_balance_ant + line.debit - line.credit
-                                   cumul_balance_ant = cumul_balance_ac
-                                %>
-                                 <div class="table-cell amount last-column" style="width: 80px">${formatLang(cumul_balance_ac)}</div>  
-                                <% count +=1 %>
-                            %endif
-                            
+           %if account.type != 'view':
+               <br/><br/>
+               <div class="table header">
+                    <div class="table-row">
+                       <div class="table-cell text">
+                            <p class="subtitle">${account.code +' - ' +account.name}</p>
+                            <p class="subtitle">${_('Initial balance:')}&nbsp;&nbsp;${formatLang(cumul_balance)}
+                                &nbsp;&nbsp;&nbsp;
+                                ${account.id not in account_lines.keys() and _('No move lines for this account') or ''}
+                            </p>                           
                        </div>
-                   %endfor                   
-                   <div class="table-row spacer">
-                        <div class="table-cell">&nbsp;</div>
-                   </div>
-                    <div class="table-row subtotal">
-                        <div class="table-cell first-column">&nbsp;</div>
-                        <div class="table-cell">&nbsp;</div>
-                        <div class="table-cell">&nbsp;</div>
-                        <div class="table-cell">&nbsp;</div>
-                        <div class="table-cell">&nbsp;</div>
-                        <div class="table-cell">&nbsp;</div>
-                        <div class="table-cell">${_('TOTAL')}</div>
-                        <div class="table-cell amount" >${formatLang(amount_total_debit)}</div>
-                        <div class="table-cell amount" >${formatLang(amount_total_credit)}</div>
-                        <div class="table-cell amount last-column" >${formatLang(cumul_balance_ac)}</div>
                     </div>
-                    <% 
-                       amount_total_debit = amount_total_credit = 0.0
-                    %>
-                </div>
-            </div>     
+               </div>
+               %if account.id in account_lines.keys():
+                   <% move_lines = account_lines[account.id] %>                     
+                       
+                    <div class="table list">
+                        <div class="table-header">
+                            <div class="table-row labels no-wrap">                       
+                                <div class="table-cell first-column" style="width: 70px">${_('Date')}</div>
+                                <div class="table-cell" style="width: 70px">${_('Period')}</div>
+                                <div class="table-cell" style="width: 70px">${_('Entry')}</div>
+                                <div class="table-cell" style="width: 70px">${_('Journal')}</div>
+                                <div class="table-cell" style="width: 100px">${_('Partner')}</div>                    
+                                <div class="table-cell" style="width: 100px">${_('Label')}</div>
+                                %if account.reconcile or (account.id in account_conciliation.keys() and account_conciliation[account.id]):
+                                    <% print_column = True %>
+                                    <div class="table-cell" style="width: 70px">${_('Reconcile')}</div>
+                                %endif
+                                <div class="table-cell" style="width: 80px">${_('Debit')}</div>
+                                <div class="table-cell" style="width: 80px">${_('Credit')}</div>
+                                <div class="table-cell amount last-column" style="width: 80px">${_('Cumul. Bal.')}</div>                        
+                            </div>
+                        </div>                        
+                        <div class="table-body"> 
+                            %for line in move_lines:
+                                <% 
+                                    amount_total_debit += line.debit
+                                    amount_total_credit += line.credit
+                                    cumul_balance = cumul_balance + line.debit - line.credit                               
+                                %>
+                                <div class="table-row ${row_even and 'even' or 'odd'}">
+                                    <div class="table-cell first-column">${formatLang(line.date, date=True)}</div>
+                                    <div class="table-cell">${line.period_id.name or ''}</div>
+                                    <div class="table-cell">${move_names[line.id] or ''}</div>                                    
+                                    <div class="table-cell">${line.journal_id.name}</div>    
+                                    <div class="table-cell">${line.partner_id.name or ''}</div>
+                                    <div class="table-cell">${line.name or ''}</div> 
+                                    %if print_column:
+                                        <div class="table-cell">
+                                            ${line.id in account_conciliation[account.id].keys() and account_conciliation[account.id][line.id] or ''}
+                                        </div>
+                                    %endif 
+                                    <div class="table-cell amount">${formatLang(line.debit)}</div>
+                                    <div class="table-cell amount">${formatLang(line.credit)}</div>                                  
+                                    <div class="table-cell amount last-column">${formatLang(cumul_balance)}</div>  
+                               </div>
+                           %endfor                   
+                           <div class="table-row spacer">
+                                <div class="table-cell">&nbsp;</div>
+                           </div>
+                            <div class="table-row subtotal">
+                                <div class="table-cell first-column">&nbsp;</div>
+                                <div class="table-cell">&nbsp;</div>
+                                <div class="table-cell">&nbsp;</div>
+                                <div class="table-cell">&nbsp;</div>
+                                <div class="table-cell">&nbsp;</div>
+                                %if print_column:
+                                    <div class="table-cell">&nbsp;</div>
+                                %endif
+                                <div class="table-cell">${_('TOTAL')}</div>
+                                <div class="table-cell amount" >${formatLang(amount_total_debit)}</div>
+                                <div class="table-cell amount" >${formatLang(amount_total_credit)}</div>
+                                <div class="table-cell amount last-column" >${formatLang(cumul_balance)}</div>
+                            </div>
+                            <% 
+                               amount_total_debit = amount_total_credit = 0.0
+                            %>
+                        </div>                    
+                    </div>    
+                %endif                             
+            %endif
         %endfor 
     </body>
 </html>

=== modified file 'account_general_ledger_report/report/account_general_ledger_report.py'
--- account_general_ledger_report/report/account_general_ledger_report.py	2013-05-13 22:20:43 +0000
+++ account_general_ledger_report/report/account_general_ledger_report.py	2013-05-16 19:42:27 +0000
@@ -44,19 +44,17 @@
             'get_stop_date':self._get_date_to,
             'accounts': self._get_accounts_br,
             'display_target_move': self._get_display_target_move,
-            'extract_name_move': self.extract_name_move,
         })
 
     def get_data(self, cr, uid, data):
         filter_data = []
-        account_list = []
+        account_list = []        
         account_selected = []
-        conciliation_lines = [] 
         
         account_lines = {}
         account_balance = {}
         account_conciliation = {}
-        account_move_line_con = {}
+        move_names = {}
                 
         library_obj = self.pool.get('account.webkit.report.library')
         
@@ -86,215 +84,92 @@
         
         #From the wizard can select specific account, extract this accounts
         account_selected = data['form']['account_ids']
-
-        #Prepare the account_id list. 
+        
         if account_selected == []:
-            account_list_ids = library_obj.get_account_child_ids(cr, uid, chart_account.id) #get all the accounts in the chart_account_id
-            account_list_obj = self.pool.get('account.account').browse(cr, uid, account_list_ids)
-            for account in account_list_obj:
-                conciliation_lines = []
-                if  account.type != 'view':
-                    #Get the move_lines for each account.
-                    move_lines = library_obj.get_move_lines(cr, uid,
-                                                            [account.id], 
-                                                            filter_type=filter_type, 
-                                                            filter_data=filter_data, 
-                                                            fiscalyear=fiscalyear, 
-                                                            target_move=target_move,
-                                                            order_by='asc')
-                    if account.id not in account_lines.keys():
-                       account_lines[account] = move_lines
-                    
-                    #Reconcile -> show reconcile in the mako.
-                    '''
-                    First, if the account permit reconcile (reconcile == True), add to the dictionary.
-                    If the account don't allow the reconcile, search if the lines have reconcile_id or partial_reconcile_id
-                    If the account allow the reconcile or the lines have reconcile_id or partial_reconcile_id, add in the dictionary
-                    and show in the mako the column "Reconcile"
-                    
-                    the final result is:
-                       {account_id: {line.id: [conciliation_name]}}
-                    '''
-                    #1. If the account have reconcile, add to the dictionary
-                    if account.reconcile and account.id not in account_conciliation:
-                        account_conciliation[account.id] = []
-                    
-                    #Search if the move_lines have partial or reconcile id
-                    for line in move_lines:
-                        if line.reconcile_id and line.reconcile_id.name != '':
-                            conciliation_lines.append(line.reconcile_id.name)
-                         
-                        elif line.reconcile_partial_id and line.reconcile_partial_id.name != '':
-                            str_name = 'P' + line.reconcile_id.name
-                            conciliation_lines.append(str_name)
-                        
-                        #Add the line.id and the name of the conciliation.
-                        if len(conciliation_lines) > 0: 
-                             account_move_line_con[line.id] = conciliation_lines
-                        
-                        #Clean the name of the conciliation
-                        conciliation_lines = []
-                    
-                    #After the search in each lines, add the dictionary (key: line.id, value: conciliation_name)
-                    #with account.id (key of the principal dictionary) and match the account_id with the conciliation name.                    
-                    if account.id in account_conciliation.keys():
-                        account_conciliation[account.id] = account_move_line_con
-                    
-                    elif account.id not in account_conciliation.keys() and len(account_move_line_con) > 0: 
-                        account_conciliation[account.id] = account_move_line_con
-                        
-            #Get the initial_balance for the account
-            for account in account_list_obj:
-                if  account.type != 'view':
-                    account_list.append(account.id)
-
-            if filter_type == 'filter_date':
-                account_balance = library_obj.get_account_balance(cr, uid, 
-                                                                  account_list,
-                                                                  ['balance'],
-                                                                  initial_balance=True,
-                                                                  company_id=chart_account.company_id.id,
-                                                                  fiscal_year_id = fiscalyear.id,
-                                                                  state = target_move,
-                                                                  start_date = start_date,
-                                                                  stop_date = stop_date,
-                                                                  chart_account_id = chart_account.id,
-                                                                  filter_type=filter_type)
-            elif filter_type == 'filter_period':
-                account_balance = library_obj.get_account_balance(cr, uid, 
-                                                                  account_list,
-                                                                  ['balance'],
-                                                                  initial_balance=True,
-                                                                  company_id=chart_account.company_id.id,
-                                                                  fiscal_year_id = fiscalyear.id,
-                                                                  state = target_move,
-                                                                  start_period_id = start_period.id,
-                                                                  end_period_id = stop_period.id,
-                                                                  chart_account_id = chart_account.id,
-                                                                  filter_type=filter_type)
-            else:
-                account_balance = library_obj.get_account_balance(cr, uid, 
-                                                                  account_list,
-                                                                  ['balance'],
-                                                                  initial_balance=True,
-                                                                  company_id=chart_account.company_id.id,
-                                                                  fiscal_year_id = fiscalyear.id,
-                                                                  state = target_move,
-                                                                  chart_account_id = chart_account.id,
-                                                                  filter_type=filter_type)
-        else:
-            account_list_ids = library_obj.get_account_child_ids(cr, uid, account_selected) #get all the accounts in the chart_account_id
-            account_list_obj = self.pool.get('account.account').browse(cr, uid, account_list_ids)
-            for account in account_list_obj:
-                if  account.type != 'view':
-                     move_lines = library_obj.get_move_lines(cr, uid,
-                                                             [account.id], 
-                                                            filter_type=filter_type, 
-                                                            filter_data=filter_data, 
-                                                            fiscalyear=fiscalyear, 
-                                                            target_move=target_move,
-                                                            order_by='asc')
-                
-                     if account.id not in account_lines.keys():
-                         account_lines[account] = move_lines
-                    
-                     #Reconcile -> show reconcile in the mako.
-                     '''
-                     First, if the account permit reconcile (reconcile == True), add to the dictionary.
-                     If the account don't allow the reconcile, search if the lines have reconcile_id or partial_reconcile_id
-                     If the account allow the reconcile or the lines have reconcile_id or partial_reconcile_id, add in the dictionary
-                     and show in the mako the column "Reconcile"
-                    
-                     the final result is:
-                        {account_id: {line.id: [conciliation_name]}}
-                     '''
-                     #1. If the account have reconcile, add to the dictionary
-                     if account.reconcile and account.id not in account_conciliation:
-                         account_conciliation[account.id] = []
-                    
-                     #Search if the move_lines have partial or reconcile id
-                     for line in move_lines:
-                         if line.reconcile_id and line.reconcile_id.name != '':
-                             conciliation_lines.append(line.reconcile_id.name)
-                         
-                         elif line.reconcile_partial_id and line.reconcile_partial_id.name != '':
-                             str_name = 'P' + line.reconcile_id.name
-                             conciliation_lines.append(str_name)
-                        
-                         #Add the line.id and the name of the conciliation.
-                         if len(conciliation_lines) > 0: 
-                             account_move_line_con[line.id] = conciliation_lines
-                        
-                         #Clean the name of the conciliation
-                         conciliation_lines = []
-                    
-                     #After the search in each lines, add the dictionary (key: line.id, value: conciliation_name)
-                     #with account.id (key of the principal dictionary) and match the account_id with the conciliation name.                    
-                     if account.id in account_conciliation.keys():
-                         account_conciliation[account.id] = account_move_line_con
-                    
-                     elif account.id not in account_conciliation.keys() and len(account_move_line_con) > 0: 
-                         account_conciliation[account.id] = account_move_line_con
-            
-            #Get the initial_balance for the account
-            for account in account_list_obj:
-                if  account.type != 'view':
-                    account_list.append(account.id)
-
-            if filter_type == 'filter_date':
-                account_balance = library_obj.get_account_balance(cr, uid, 
-                                                                  account_list,
-                                                                  ['balance'],
-                                                                  initial_balance=True,
-                                                                  company_id=chart_account.company_id.id,
-                                                                  fiscal_year_id = fiscalyear.id,
-                                                                  state = target_move,
-                                                                  start_date = start_date,
-                                                                  stop_date = stop_date,
-                                                                  chart_account_id = chart_account.id,
-                                                                  filter_type=filter_type)
-            elif filter_type == 'filter_period':
-                account_balance = library_obj.get_account_balance(cr, uid, 
-                                                                  account_list,
-                                                                  ['balance'],
-                                                                  initial_balance=True,
-                                                                  company_id=chart_account.company_id.id,
-                                                                  fiscal_year_id = fiscalyear.id,
-                                                                  state = target_move,
-                                                                  start_period_id = start_period.id,
-                                                                  end_period_id = stop_period.id,
-                                                                  chart_account_id = chart_account.id,
-                                                                  filter_type=filter_type)
-            else:
-                account_balance = library_obj.get_account_balance(cr, uid, 
-                                                                  account_list,
-                                                                  ['balance'],
-                                                                  initial_balance=True,
-                                                                  company_id=chart_account.company_id.id,
-                                                                  fiscal_year_id = fiscalyear.id,
-                                                                  state = target_move,
-                                                                  chart_account_id = chart_account.id,
-                                                                  filter_type=filter_type)
-        
-        return account_lines, account_balance, account_conciliation
-    
-    ''''
-    This method is created to solve the error when extracting the name move_id (line.move_id.name) fails because of read permissions
-    parameter move_lines are the move_lines that match with the journal and period. Pass from mako. 
-    ''' 
-    def extract_name_move(self, cr, uid, move_lines):
-        move_temp = self.pool.get('account.move')
-        dict_name = {} #dict_name keys is the line id. 
-        
+            account_selected = [chart_account.id]
+        
+        account_list_ids = library_obj.get_account_child_ids(cr, uid, account_selected) #get all the accounts in the chart_account_id
+        account_list_obj = self.pool.get('account.account').browse(cr, uid, account_list_ids)
+          
+        #Get the move_lines for each account.
+        move_lines = library_obj.get_move_lines(cr, 1,
+                                                account_list_ids, 
+                                                filter_type=filter_type, 
+                                                filter_data=filter_data, 
+                                                fiscalyear=fiscalyear, 
+                                                target_move=target_move,
+                                                order_by='account_id asc, date asc, ref asc')
+        
+       
+        #Reconcile -> show reconcile in the mako.
+        '''
+        First, if the account permit reconcile (reconcile == True), add to the dictionary.
+        If the account don't allow the reconcile, search if the lines have reconcile_id or partial_reconcile_id
+        If the account allow the reconcile or the lines have reconcile_id or partial_reconcile_id, add in the dictionary
+        and show in the mako the column "Reconcile"
+        
+        the final result is:
+           {account_id: {line.id: [conciliation_name]}}
+        '''        
+        #Search if the move_lines have partial or reconcile id
         for line in move_lines:
-            move_id = move_temp.search(cr, uid, [('id', '=', line.move_id.id)])
-            move_obj = move_temp.browse(cr, uid, move_id)
-            if move_obj[0].name:
-                dict_name[line.id] = move_obj[0].name
-            else:
-                 dict_name[line.id] = move_obj[0].id
-        
-        return dict_name
+            move_names[line.id] = line.move_id.name
+            
+            #If the account have reconcile, add to the dictionary              
+            if line.account_id.id not in account_conciliation:
+                account_conciliation[line.account_id.id] = {}
+            
+            if line.reconcile_id and line.reconcile_id.name != '':
+                 account_conciliation[line.account_id.id][line.id] = line.reconcile_id.name
+             
+            elif line.reconcile_partial_id and line.reconcile_partial_id.name != '':
+                str_name = 'P: ' + line.reconcile_id.name
+                #conciliation_lines.append(str_name)
+                account_conciliation[line.account_id.id][line.id] = str_name             
+            
+            if line.account_id.id not in account_lines:
+                account_lines[line.account_id.id] = []
+            
+            account_lines[line.account_id.id].append(line)
+                    
+    
+        if filter_type == 'filter_date':
+            account_balance = library_obj.get_account_balance(cr, uid, 
+                                                              account_list_ids,
+                                                              ['balance'],
+                                                              initial_balance=True,
+                                                              company_id=chart_account.company_id.id,
+                                                              fiscal_year_id = fiscalyear.id,
+                                                              state = target_move,
+                                                              start_date = start_date,
+                                                              stop_date = stop_date,
+                                                              chart_account_id = chart_account.id,
+                                                              filter_type=filter_type)
+        elif filter_type == 'filter_period':
+            account_balance = library_obj.get_account_balance(cr, uid, 
+                                                              account_list_ids,
+                                                              ['balance'],
+                                                              initial_balance=True,
+                                                              company_id=chart_account.company_id.id,
+                                                              fiscal_year_id = fiscalyear.id,
+                                                              state = target_move,
+                                                              start_period_id = start_period.id,
+                                                              end_period_id = stop_period.id,
+                                                              chart_account_id = chart_account.id,
+                                                              filter_type=filter_type)
+        else:
+            account_balance = library_obj.get_account_balance(cr, uid, 
+                                                              account_list_ids,
+                                                          ['balance'],
+                                                          initial_balance=True,
+                                                          company_id=chart_account.company_id.id,
+                                                          fiscal_year_id = fiscalyear.id,
+                                                          state = target_move,
+                                                          chart_account_id = chart_account.id,
+                                                          filter_type=filter_type)
+        
+        
+        return account_list_obj, account_lines, account_conciliation, account_balance, move_names
     
 report_sxw.report_sxw('report.account_general_ledger_webkit',
                              'account.account',

=== modified file 'account_webkit_report_library/common_library.py'
--- account_webkit_report_library/common_library.py	2013-05-13 22:20:43 +0000
+++ account_webkit_report_library/common_library.py	2013-05-16 19:42:27 +0000
@@ -186,15 +186,7 @@
         #**********************************************************************************************#
         
         if unreconcile == False:
-            #order by date ASC or DESC the move_lines 
-            if order_by != None and order_by == 'asc':
-                move_line_ids = move_line_obj.search(cr, uid, list_tuples, order='date asc', context=context)
-                
-            elif order_by != None and order_by == 'desc':
-                move_line_ids = move_line_obj.search(cr, uid, list_tuples, order='date DESC', context=context)
-            
-            else:
-                move_line_ids = move_line_obj.search(cr, uid, list_tuples, context=context)
+            move_line_ids = move_line_obj.search(cr, uid, list_tuples,order = order_by,context=context)
                 
         else:
             #list_tuples + [domain_unreconciled] -> Con esta sintaxis no se altera la variable 


Follow ups