← 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:
  #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
  #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,

Fixed errors coming in installation of sale and point_of_sale.
Fixed bug:589256 (https://bugs.launchpad.net/openobject-addons/+bug/589256)

Thanks,
pso (Open ERP)

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44012
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 'point_of_sale/point_of_sale.py'
--- point_of_sale/point_of_sale.py	2010-12-13 07:40:49 +0000
+++ point_of_sale/point_of_sale.py	2010-12-17 06:08:55 +0000
@@ -159,12 +159,13 @@
                 'amount_return':0.0,
                 'amount_tax':0.0,
             }
-            val = 0.0
+            val = val1 = 0.0
             cur = order.pricelist_id.currency_id
             for payment in order.statement_ids:
                 res[order.id]['amount_paid'] +=  payment.amount
                 res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0)
             for line in order.lines:
+                val1 += line.price_subtotal_incl
                 if order.price_type != 'tax_excluded':
                     res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2),
                         tax_obj.compute_inv(cr, uid, line.product_id.taxes_id,
@@ -174,7 +175,8 @@
                 elif line.qty != 0.0:
                     for c in tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.qty,  line.product_id, line.order_id.partner_id)['taxes']:
                         val += c.get('amount', 0.0)
-                    res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
+            res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
+            res[order.id]['amount_total'] = res[order.id]['amount_tax'] + cur_obj.round(cr, uid, cur, val1)
         return res
 
     def _sale_journal_get(self, cr, uid, context=None):
@@ -248,7 +250,7 @@
         'user_salesman_id': fields.many2one('res.users', 'Cashier', required=True, help="User who is logged into the system."),
         'sale_manager': fields.many2one('res.users', 'Salesman Manager'),
         'amount_tax': fields.function(_amount_all, method=True, string='Taxes', digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
-        'amount_total': fields.function(_amount_total, method=True, string='Total'),
+        'amount_total': fields.function(_amount_all, method=True, string='Total', multi='all'),
         'amount_paid': fields.function(_amount_all, string='Paid', states={'draft': [('readonly', False)]}, readonly=True, method=True, digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
         'amount_return': fields.function(_amount_all, 'Returned', method=True, digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
         'lines': fields.one2many('pos.order.line', 'order_id', 'Order Lines', states={'draft': [('readonly', False)]}, readonly=True),
@@ -991,14 +993,10 @@
                     if line.qty == 0.0:
                         res[line.id][f] = 0.0
                         continue
-                    computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, line.price_unit, line.qty)['taxes']
-                    for tax in computed_taxes:
-                        tax_amount += tax['amount']
-                    if line.discount!=0.0:
-                        res[line.id][f] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0)
-                    else:
-                        res[line.id][f] = line.price_unit * line.qty
-                    res[line.id][f] += tax_amount
+                    price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
+                    computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, price, line.qty)
+                    cur = line.order_id.pricelist_id.currency_id
+                    res[line.id][f] = self.pool.get('res.currency').round(cr, uid, cur, computed_taxes['total'])
         return res
 
     def price_by_product_multi(self, cr, uid, ids, context=None):

=== modified file 'point_of_sale/wizard/pos_box_out.xml'
--- point_of_sale/wizard/pos_box_out.xml	2010-12-13 08:54:31 +0000
+++ point_of_sale/wizard/pos_box_out.xml	2010-12-17 06:08:55 +0000
@@ -8,7 +8,7 @@
             <field name="model">pos.box.out</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
-                <form string="Output Operation>
+                <form string="Output Operation">
 				    	<separator string="Please fill these fields for entries to the box:" colspan="4"/>
 				    	<field name="name"/>
 				    	<field name="journal_id"/>

=== modified file 'sale/sale.py'
--- sale/sale.py	2010-12-17 04:37:32 +0000
+++ sale/sale.py	2010-12-17 06:08:55 +0000
@@ -265,7 +265,7 @@
     _defaults = {
         'picking_policy': 'direct',
         'date_order': lambda *a: time.strftime('%Y-%m-%d'),
-
+        'order_policy': 'manual',
         'state': 'draft',
         'user_id': lambda obj, cr, uid, context: uid,
         'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'sale.order'),


Follow ups