← 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:
  #617974 trunk - hr payment - rounding issue payment slip
  https://bugs.launchpad.net/bugs/617974
  #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


Hello,

I have improved account and voucher views.

Thanks,
pso (Open ERP)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/43164
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/account_invoice_view.xml'
--- account/account_invoice_view.xml	2010-12-06 10:05:55 +0000
+++ account/account_invoice_view.xml	2010-12-09 06:29:11 +0000
@@ -302,7 +302,7 @@
                                 <field name="amount_total"/>
                                 <field name="state"/>
                                 <field name="residual"/>
-                                <group col="7" colspan="4" groups="base.group_user">
+                                <group col="8" colspan="4" groups="base.group_user">
                                     <button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
                                     <button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
 
@@ -310,6 +310,7 @@
                                     <button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
                                     <button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
                                     <button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
+                                    <button name="%(account_invoices)d" string="Invoices" type="action" icon="gtk-print"/>
                                 </group>
                             </group>
                         </page>
@@ -465,7 +466,7 @@
         <menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables"/>
 
         <record id="action_invoice_tree3" model="ir.actions.act_window">
-            <field name="name">Customer Refunds</field>
+            <field name="name">Credit Memo</field>
             <field name="res_model">account.invoice</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form,calendar,graph</field>
@@ -473,7 +474,7 @@
             <field name="domain">[('type','=','out_refund')]</field>
             <field name="context">{'type':'out_refund', 'journal_type': 'sale_refund'}</field>
             <field name="search_view_id" ref="view_account_invoice_filter"/>
-            <field name="help">Customer Refunds helps you manage the credit notes issued/to be issued for your customers. A refund invoice is a document that cancels an invoice or a part of it. You can easily generate refunds and reconcile them from the invoice form.</field>
+            <field name="help">Credit Memo helps you manage the credit notes issued/to be issued for your customers. A refund invoice is a document that cancels an invoice or a part of it. You can easily generate refunds and reconcile them from the invoice form.</field>
         </record>
 
         <record id="action_invoice_tree3_view1" model="ir.actions.act_window.view">

=== modified file 'account/account_report.xml'
--- account/account_report.xml	2010-11-18 11:56:06 +0000
+++ account/account_report.xml	2010-12-09 06:29:11 +0000
@@ -18,7 +18,8 @@
             rml="account/report/account_print_invoice.rml"
             string="Invoices"
             attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/',''))"
-            attachment_use="1"/>
+            attachment_use="1"
+            multi="True"/>
         <report id="account_transfers" model="account.transfer" name="account.transfer" string="Transfers" xml="account/report/transfer.xml" xsl="account/report/transfer.xsl"/>
         <report auto="False" id="account_intracom" menu="False" model="account.move.line" name="account.intracom" string="IntraCom"/>
 

=== modified file 'account/report/account_general_ledger.py'
--- account/report/account_general_ledger.py	2010-11-25 14:41:27 +0000
+++ account/report/account_general_ledger.py	2010-12-09 06:29:11 +0000
@@ -159,13 +159,20 @@
         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,
+            case when a.currency_id is not null then
+                         l.amount_currency
+                        else
+                        0.0
+                        end as 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,
             m.name AS move_name, m.id AS mmove_id,per.code as period_code,
             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,23 +186,31 @@
         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,
-                '' AS move_name, '' AS mmove_id, '' AS period_code,
-                '' AS currency_code,
-                NULL AS currency_id,
+                SELECT 0 AS lid, '' AS ldate, '' AS lcode,
+                sum(case when a.currency_id is not null then
+                         l.amount_currency
+                        else
+                         0.0
+                        end) 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,
+                '' AS move_name, '' AS mmove_id,  
+                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
+                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()
-        res = res_init + res_lines
+        res = res_init + res_lines 
         account_sum = 0.0
         for l in res:
             l['move'] = l['move_name'] != '/' and l['move_name'] or ('*'+str(l['mmove_id']))
@@ -209,6 +224,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-11-24 13:32:59 +0000
+++ account/report/account_general_ledger.rml	2010-12-09 06:29:11 +0000
@@ -622,4 +622,4 @@
     </section>
     </pto>
   </story>
-</document>
\ No newline at end of file
+</document>

=== modified file 'account/report/account_partner_ledger.py'
--- account/report/account_partner_ledger.py	2010-11-22 07:19:21 +0000
+++ account/report/account_partner_ledger.py	2010-12-09 06:29:11 +0000
@@ -51,6 +51,8 @@
             'display_initial_balance':self._display_initial_balance,
             'display_currency':self._display_currency,
             'get_target_move': self._get_target_move,
+            'get_currency': self._get_currency,
+            'sum_currency_amount_account': self._sum_currency_amount_account
         })
 
     def set_context(self, objects, data, ids, report_type=None):
@@ -161,6 +163,10 @@
             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']
         if self.target_move == 'posted':
@@ -390,16 +396,27 @@
             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 _set_get_account_currency_code(self, account_id):
+#        self.cr.execute("SELECT c.symbol AS code "\
+#                        "FROM res_currency c, account_account AS ac "\
+#                        "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id))
+#        result = self.cr.fetchone()
+#        if result:
+#            self.account_currency = result[0]
+#        else:
+#            self.account_currency = False
+
+    def _sum_currency_amount_account(self, account):
+#        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))
         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
+#        if self.amount_currency:
+#            return_field = total[0] + self.amount_currency
+#            return return_field
+#        else:
+#            currency_total = self.tot_currency = 0.0
+#            return currency_total
 
     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-11-24 11:34:26 +0000
+++ account/report/account_partner_ledger_other.rml	2010-12-09 06:29:11 +0000
@@ -662,4 +662,4 @@
     </section>
     </pto>
   </story>
-</document>
\ No newline at end of file
+</document>

=== modified file 'account_voucher/voucher_sales_purchase_view.xml'
--- account_voucher/voucher_sales_purchase_view.xml	2010-12-08 07:19:43 +0000
+++ account_voucher/voucher_sales_purchase_view.xml	2010-12-09 06:29:11 +0000
@@ -133,7 +133,7 @@
                                 </group>
                                 <group col="4" colspan="1">
                                     <separator string="Total" colspan="4"/>
-                                    <field name="tax_id" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('sale','all'))]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" groups="base.group_extended" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
+                                    <field name="tax_id" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('sale','all')), ('parent_id', '=', False)]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" groups="base.group_extended" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
                                     <label string="" colspan="1"/><field name="amount" string="Total"/>
                                 </group>
                             </group>
@@ -240,7 +240,7 @@
                                 </group>
                                 <group col="4" colspan="1">
                                     <separator string="Total" colspan="4"/>
-                                    <field name="tax_id" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('purchase','all'))]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" groups="base.group_extended" attrs="{'invisible': [('state','!=','draft')]}"/>
+                                    <field name="tax_id" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('purchase','all')), ('parent_id', '=', False)]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" groups="base.group_extended" attrs="{'invisible': [('state','!=','draft')]}"/>
                                     <label string="" colspan="1"/><field name="amount" string="Total"/>
                                 </group>
                             </group>


Follow ups