← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~alejandrosantana/ocb-addons/6.1-ocb-addons-fix-bug-1089229 into lp:ocb-addons/6.1

 

Alejandro Santana has proposed merging lp:~alejandrosantana/ocb-addons/6.1-ocb-addons-fix-bug-1089229 into lp:ocb-addons/6.1.

Commit message:
[FIX] Fixes the sales order report to show correctly the unit price if UoS is definied. Also corrects the decimal precision of subtotals, total untaxed, taxes and total taxed.

Requested reviews:
  Serv. Tecnológicos Avanzados - Pedro M. Baeza (serviciosbaeza)
Related bugs:
  Bug #1089229 in OpenERP Community Backports (Addons): "Sales using Secondary UoM show incorrect unit price"
  https://bugs.launchpad.net/ocb-addons/+bug/1089229

For more details, see:
https://code.launchpad.net/~alejandrosantana/ocb-addons/6.1-ocb-addons-fix-bug-1089229/+merge/202036

Fixes bug lp:1089229
[FIX] Fixes the sales order report to show correctly the unit price if UoS is definied. Also corrects the decimal precision of subtotals, total untaxed, taxes and total taxed.
-- 
https://code.launchpad.net/~alejandrosantana/ocb-addons/6.1-ocb-addons-fix-bug-1089229/+merge/202036
Your team OpenERP Community Backports Team is subscribed to branch lp:ocb-addons/6.1.
=== modified file 'sale/report/sale_order.py'
--- sale/report/sale_order.py	2011-01-14 00:11:01 +0000
+++ sale/report/sale_order.py	2014-01-17 03:40:39 +0000
@@ -21,14 +21,17 @@
 
 import time
 
-from report import report_sxw
+from openerp.report import report_sxw
 
 class order(report_sxw.rml_parse):
     def __init__(self, cr, uid, name, context=None):
         super(order, self).__init__(cr, uid, name, context=context)
         self.localcontext.update({
             'time': time,
+            'get_price_objects': self._get_price_objects,
         })
+    def _get_price_objects(self, price,qty):
+        return round((float(price)*qty))
 
 report_sxw.report_sxw('report.sale.order', 'sale.order', 'addons/sale/report/sale_order.rml', parser=order, header="external")
 

=== modified file 'sale/report/sale_order.rml'
--- sale/report/sale_order.rml	2013-11-20 01:17:39 +0000
+++ sale/report/sale_order.rml	2014-01-17 03:40:39 +0000
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <document filename="Sale Order.pdf">
-  <template title="Sale Order" author="OpenERP S.A.(sales@xxxxxxxxxxx)" allowSplitting="20">
+  <template title="Sale Order" author="Martin Simon" allowSplitting="20">
     <pageTemplate id="first">
       <frame id="first" x1="15.0" y1="42.0" width="539" height="758"/>
     </pageTemplate>
@@ -67,7 +67,6 @@
       <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
       <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
       <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
-      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
     </blockTableStyle>
     <blockTableStyle id="Table6">
       <blockAlignment value="LEFT"/>
@@ -126,11 +125,8 @@
     <images/>
   </stylesheet>
   <story>
-  <para style="terp_default_8">[[repeatIn(objects,'o')]]</para>
-  <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
-    <para style="terp_default_9">
-      <font color="white"> </font>
-    </para>
+    <para style="terp_default_8">[[repeatIn(objects,'o')]]</para>
+    <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
     <blockTable colWidths="265.0,51.0,225.0" style="Table1">
       <tr>
         <td>
@@ -208,32 +204,7 @@
     <para style="terp_default_8">
       <font color="white"> </font>
     </para>
-    <pto>
-    <pto_header>
-      <blockTable colWidths="181.0,70.0,80.0,70.0,50.0,85.0" repeatRows="1" style="Table4">
-        <tr>
-          <td>
-            <para style="terp_tblheader_Details">Description</para>
-         </td>
-         <td>
-            <para style="terp_tblheader_Details_Centre">VAT</para>
-         </td>
-         <td>
-           <para style="terp_tblheader_Details_Right">Quantity</para>
-         </td>
-         <td>
-           <para style="terp_tblheader_Details_Right">Unit Price</para>
-         </td>
-         <td>
-           <para style="terp_tblheader_Details_Centre">Disc.(%)</para>
-         </td>
-         <td>
-           <para style="terp_tblheader_Details_Right">Price</para>
-         </td>
-        </tr>
-      </blockTable>
-    </pto_header>
-    <blockTable colWidths="181.0,70.0,80.0,70.0,50.0,85.0" repeatRows="1" style="Table4">
+    <blockTable colWidths="202.0,94.0,68.0,59.0,50.0,63.0" repeatRows="1" style="Table4">
       <tr>
         <td>
           <para style="terp_tblheader_Details">Description</para>
@@ -257,7 +228,7 @@
     </blockTable>
     <section>
       <para style="terp_default_1">[[repeatIn(o.order_line,'line')]]</para>
-      <blockTable colWidths="180.0,70.0,80.0,70.0,50.0,85.0" style="Table5">
+      <blockTable colWidths="203.0,94.0,68.0,61.0,42.0,70.0" style="Table5">
         <tr>
           <td>
             <para style="terp_default_9">[[ line.name ]] </para>
@@ -269,13 +240,13 @@
             <para style="terp_default_Right_9">[[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]]</para>
           </td>
           <td>
-            <para style="terp_default_Right_9">[[ formatLang(line.price_unit ) ]]</para>
+            <para style="terp_default_Right_9">[[ formatLang(line.product_uos and (line.price_unit * line.product_uom_qty / line.product_uos_qty) or line.price_unit , digits=get_digits(dp='Product Price'))]]</para>
           </td>
           <td>
             <para style="terp_default_Centre_9">[[ formatLang(line.discount) ]]</para>
           </td>
           <td>
-            <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'), currency_obj=o.pricelist_id.currency_id) ]]</para>
+            <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) ]]</para>
           </td>
         </tr>
         <tr>
@@ -310,8 +281,7 @@
         </tr>
       </blockTable>
     </section>
-    </pto>
-    <blockTable colWidths="381.0,60.0,93.0" style="Table6">
+    <blockTable colWidths="374.0,69.0,94.0" style="Table6">
       <tr>
         <td>
           <para style="terp_default_9">
@@ -322,7 +292,7 @@
           <para style="terp_default_9">Net Total :</para>
         </td>
         <td>
-          <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para>
+          <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para>
         </td>
       </tr>
       <tr>
@@ -335,7 +305,7 @@
           <para style="terp_default_9">Taxes :</para>
         </td>
         <td>
-          <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para>
+          <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para>
         </td>
       </tr>
       <tr>
@@ -348,13 +318,11 @@
           <para style="terp_default_Bold_9">Total :</para>
         </td>
         <td>
-          <para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para>
+          <para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para>
         </td>
       </tr>
     </blockTable>
-    <para style="terp_default_8">
-      <font color="white"> </font>
-    </para>
+    <para style="terp_default_8"/>
     <para style="terp_default_9">[[ format(o.note or '') ]]</para>
     <blockTable colWidths="533.0" style="Table7">
       <tr>

=== modified file 'sale/report/sale_order.sxw'
Binary files sale/report/sale_order.sxw	2012-12-17 09:49:00 +0000 and sale/report/sale_order.sxw	2014-01-17 03:40:39 +0000 differ

Follow ups