Hardik Ansodariya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-usability-unit_of_measure-han into 
lp:~openerp-dev/openobject-addons/trunk-usability.

Requested reviews:
  Amit (Open ERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-usability-unit_of_measure-han/+merge/74338
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-usability-unit_of_measure-han/+merge/74338
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-usability.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2011-08-26 14:28:36 +0000
+++ purchase/purchase.py	2011-09-07 05:09:24 +0000
@@ -612,6 +612,11 @@
             res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
         return res
 
+    def _get_uom_id(self, cr, uid, *args):
+        cr.execute('select id from product_uom order by id limit 1')
+        res = cr.fetchone()
+        return res and res[0] or False
+    
     _columns = {
         'name': fields.char('Description', size=256, required=True),
         'product_qty': fields.float('Quantity', required=True, digits=(16,2)),
@@ -639,6 +644,7 @@
 
     }
     _defaults = {
+        'product_uom' : _get_uom_id,
         'product_qty': lambda *a: 1.0,
         'state': lambda *args: 'draft',
         'invoiced': lambda *a: 0,

=== modified file 'sale/sale.py'
--- sale/sale.py	2011-08-27 23:31:30 +0000
+++ sale/sale.py	2011-09-07 05:09:24 +0000
@@ -838,6 +838,11 @@
                 res[line.id] = 1
         return res
 
+    def _get_uom_id(self, cr, uid, *args):
+        cr.execute('select id from product_uom order by id limit 1')
+        res = cr.fetchone()
+        return res and res[0] or False
+    
     _name = 'sale.order.line'
     _description = 'Sales Order Line'
     _columns = {
@@ -877,6 +882,7 @@
     }
     _order = 'sequence, id'
     _defaults = {
+        'product_uom' : _get_uom_id,
         'discount': 0.0,
         'delay': 0.0,
         'product_uom_qty': 1,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to