← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3

 

pso (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #438717 Error in account_anglo_saxon when using foreign currency
  https://bugs.launchpad.net/bugs/438717
  #539539 product - VAT definition - multicompany
  https://bugs.launchpad.net/bugs/539539
  #589256 Wrong tax calculation in point of sale (POS)
  https://bugs.launchpad.net/bugs/589256
  #617974 trunk - hr payment - rounding issue payment slip
  https://bugs.launchpad.net/bugs/617974
  #646350 [trunk] sale analysis - wrong average price
  https://bugs.launchpad.net/bugs/646350
  #663585 [6.0rc1] suggested improvements to PO and SO form view
  https://bugs.launchpad.net/bugs/663585
  #663967 [RC1] SO -History - can delete related invoice
  https://bugs.launchpad.net/bugs/663967
  #666592 save and close crash adding product in point of sale
  https://bugs.launchpad.net/bugs/666592
  #669360 hr_timeeshet_sheet : installation fails on 1st (and probably last) date of the month.
  https://bugs.launchpad.net/bugs/669360
  #669533 [hr_timesheet] Employee timesheet reports confuse employee id and user id
  https://bugs.launchpad.net/bugs/669533
  #672684 Manual Global Tax
  https://bugs.launchpad.net/bugs/672684
  #673835 Sales, Purchase and Invoice Analysis Problem
  https://bugs.launchpad.net/bugs/673835
  #689924 [sale_margin] purchase price is wrong
  https://bugs.launchpad.net/bugs/689924
  #691810 Cannot cancel invoice BUG
  https://bugs.launchpad.net/bugs/691810
  #692456 Sale Order Reference not unique
  https://bugs.launchpad.net/bugs/692456
  #692735 [6.0] sales - canceled SO should not be black (normal)
  https://bugs.launchpad.net/bugs/692735
  #692964 in hr_recruitment, add a column "Subject" in applicants list view
  https://bugs.launchpad.net/bugs/692964
  #692976 expenses list shouldn't be editable
  https://bugs.launchpad.net/bugs/692976
  #693788 payroll compute sheet error
  https://bugs.launchpad.net/bugs/693788

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44723

Hello,

Put company as selection in entries analysis report.
Improved partner and general ledger reports.

Thanks,
pso (Open ERP)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44723
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'account/report/account_entries_report_view.xml'
--- account/report/account_entries_report_view.xml	2010-11-12 11:54:13 +0000
+++ account/report/account_entries_report_view.xml	2010-12-27 10:37:06 +0000
@@ -94,7 +94,7 @@
                     <field name="product_id"/>
                     <field name="partner_id"/>
                     <separator orientation="vertical" groups="base.group_multi_company"/>
-                    <field name="company_id" groups="base.group_multi_company"/>
+                    <field name="company_id" widget="selection" groups="base.group_multi_company"/>
                     <newline/>
                     <field name="date_created"/>
                     <field name="date"/>

=== modified file 'account/report/account_general_ledger.py'
--- account/report/account_general_ledger.py	2010-12-09 07:01:26 +0000
+++ account/report/account_general_ledger.py	2010-12-27 10:37:06 +0000
@@ -159,13 +159,19 @@
         else:
             sql_sort='l.date, l.move_id'
         sql = """
-            SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id,
+            SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id,
             m.name AS move_name, m.id AS mmove_id,per.code as period_code,
+            case when a.currency_id is not null then
+                l.amount_currency
+                else
+                0.0
+                end as amount_currency,
             c.symbol AS currency_code,
             i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number,
             p.name AS partner_name
             FROM account_move_line l
             JOIN account_move m on (l.move_id=m.id)
+            LEFT JOIN account_account a ON (l.account_id=a.id)
             LEFT JOIN res_currency c on (l.currency_id=c.id)
             LEFT JOIN res_partner p on (l.partner_id=p.id)
             LEFT JOIN account_invoice i on (m.id =i.move_id)
@@ -179,19 +185,26 @@
         if res_lines and self.init_balance:
             #FIXME: replace the label of lname with a string translatable
             sql = """
-                SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
+                SELECT 0 AS lid, '' AS ldate, '' AS lcode, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
                 '' AS move_name, '' AS mmove_id, '' AS period_code,
-                '' AS currency_code,
-                NULL AS currency_id,
+                sum(case when a.currency_id is not null then
+                         l.amount_currency
+                        else
+                         0.0
+                        end) as amount_currency,
+                c.symbol AS currency_code,
+                l.currency_id AS currency_id,
                 '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,
                 '' AS partner_name
                 FROM account_move_line l
                 LEFT JOIN account_move m on (l.move_id=m.id)
+                LEFT JOIN account_account a ON (l.account_id=a.id)
                 LEFT JOIN res_currency c on (l.currency_id=c.id)
                 LEFT JOIN res_partner p on (l.partner_id=p.id)
                 LEFT JOIN account_invoice i on (m.id =i.move_id)
                 JOIN account_journal j on (l.journal_id=j.id)
                 WHERE %s AND m.state IN %s AND l.account_id = %%s
+                group by c.symbol, l.currency_id
             """ %(self.init_query, tuple(move_state))
             self.cr.execute(sql, (account.id,))
             res_init = self.cr.dictfetchall()
@@ -209,6 +222,8 @@
                     l['amount_currency'] = abs(l['amount_currency']) * -1
             if l['amount_currency'] != None:
                 self.tot_currency = self.tot_currency + l['amount_currency']
+            self.cr.execute("select distinct currency_id from account_invoice")
+            l['cur_id']=self.cr.fetchall()
         return res
 
     def _sum_debit_account(self, account):

=== modified file 'account/report/account_general_ledger.rml'
--- account/report/account_general_ledger.rml	2010-12-17 12:52:57 +0000
+++ account/report/account_general_ledger.rml	2010-12-27 10:37:06 +0000
@@ -518,7 +518,7 @@
               <para style="terp_default_Right_8">[[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
             </td>
             <td>
-              <para style="terp_default_Right_8"><font>[[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]</font></para>
+              <para style="terp_default_Right_8"><font>[[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[  line['currency_code'] or '']]</font></para>
             </td>
           </tr>
         </blockTable>

=== modified file 'account/report/account_general_ledger_landscape.rml'
--- account/report/account_general_ledger_landscape.rml	2010-12-06 10:31:44 +0000
+++ account/report/account_general_ledger_landscape.rml	2010-12-27 10:37:06 +0000
@@ -508,7 +508,7 @@
             <para style="terp_default_Bold_8_Right">[[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
           </td>
           <td>
-            <para style="terp_default_Bold_8_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]]</para>
+            <para style="terp_default_Bold_8_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]]</para>
           </td>
         </tr>
       </blockTable>
@@ -550,7 +550,7 @@
               <para style="terp_default_Right_7">[[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
             </td>
             <td>
-              <para style="terp_default_Right_7">[[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]</para>
+              <para style="terp_default_Right_7"><font>[[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[  line['currency_code'] or '']]</font></para>
             </td>
           </tr>
         </blockTable>

=== modified file 'account/report/account_partner_ledger.py'
--- account/report/account_partner_ledger.py	2010-12-09 07:01:26 +0000
+++ account/report/account_partner_ledger.py	2010-12-27 10:37:06 +0000
@@ -37,6 +37,7 @@
 #            'sum_debit': self._sum_debit,
 #            'sum_credit': self._sum_credit,
             'get_currency': self._get_currency,
+            'sum_currency_amount_account': self._sum_currency_amount_account,
             'comma_me': self.comma_me,
             'get_start_period': self.get_start_period,
             'get_end_period': self.get_end_period,
@@ -160,6 +161,10 @@
             r['progress'] = sum
             full_account.append(r)
         return full_account
+    
+    def _get_currency(self):
+        self.cr.execute("select distinct currency_id from account_invoice")
+        return self.cr.fetchall()
 
     def _get_intial_balance(self, partner):
         move_state = ['draft','posted']
@@ -390,16 +395,10 @@
             return 'Receivable and Payable Accounts'
         return ''
 
-    def _sum_currency_amount_account(self, account, form):
-        self._set_get_account_currency_code(account.id)
-        self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,))
+    def _sum_currency_amount_account(self, account):
+        self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s" %(account.id))
         total = self.cr.fetchone()
-        if self.account_currency:
-            return_field = str(total[0]) + self.account_currency
-            return return_field
-        else:
-            currency_total = self.tot_currency = 0.0
-            return currency_total
+        return total[0] or 0.0
 
     def _display_initial_balance(self, data):
          if self.initial_balance:

=== modified file 'account/report/account_partner_ledger_other.rml'
--- account/report/account_partner_ledger_other.rml	2010-12-09 07:01:26 +0000
+++ account/report/account_partner_ledger_other.rml	2010-12-27 10:37:06 +0000
@@ -470,7 +470,7 @@
         <font face="Helvetica" color="white">[[ display_currency(data) == False or removeParentNode('section') ]]</font>
       </para>
 
-      <blockTable rowHeights="0.55cm" colWidths="332.0,64.0,64.0,79.0" style="Table3">
+      <blockTable rowHeights="0.55cm" colWidths="262.0,64.0,64.0,79.0,70.0" style="Table3">
         <tr>
           <td>
             <para style="terp_default_Bold_9">[[ p.ref ]] - [[ p.name ]]</para>
@@ -484,13 +484,16 @@
           <td>
             <para style="terp_default_Bold_9_Right">[[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]]</para>
           </td>
+          <td>
+            <para style="terp_default_Bold_9_Right">[[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]]</para>
+          </td>
         </tr>
       </blockTable>
       <section>
         <para style="terp_default_2">
           <font face="Helvetica" color="white">[[data['form']['initial_balance']==True or removeParentNode('section') ]]</font>
         </para>
-        <blockTable rowHeights="0.55cm" colWidths="332.0,64.0,64.0,79.0" style="Table5">
+        <blockTable rowHeights="0.55cm" colWidths="262.0,64.0,64.0,79.0,70.0" style="Table5">
           <tr>
             <td>
               <para style="terp_default_9">Initial Balance</para>
@@ -504,6 +507,9 @@
             <td>
               <para style="terp_default_Right_9">[[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]]</para>
             </td>
+            <td>
+              <para style="terp_default_Right_9">[[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]]</para>
+            </td>
           </tr>
         </blockTable>
       </section>
@@ -653,7 +659,7 @@
             </td>
             <td>
               <para style="terp_default_Right_8">
-                <font face="Helvetica" size="8.0">[[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]]</font>
+                <font face="Helvetica" size="8.0">[[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[  line['currency_code'] or '']] </font>
               </para>
             </td>
           </tr>


Follow ups