← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/rpa-dev-addons2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons2

 

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

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  #423124 PO does wrongly take into account supplier information in product when using purchase UOM
  https://bugs.launchpad.net/bugs/423124
  #511193 unit factor is limited to 5 zeros
  https://bugs.launchpad.net/bugs/511193
  #641110 Cannot record outgoing stock move with prodlot for consumable products
  https://bugs.launchpad.net/bugs/641110
  #663662 [6.0rc1] bug in 'request a quotation' from PR
  https://bugs.launchpad.net/bugs/663662
  #664344 Unclear help texts in product_expiry
  https://bugs.launchpad.net/bugs/664344
  #666781 useless list comprehension and browse in split_moves
  https://bugs.launchpad.net/bugs/666781
  #667327 [v6 RC1] Consume products in Production order not working in GTK client
  https://bugs.launchpad.net/bugs/667327
  #667558 product_visible_discount uses discount in changing UoM in sale order of OpenERP v6.0 rc1
  https://bugs.launchpad.net/bugs/667558
  #683718 [v6 RC1] stock addon: _product_value badly implemented
  https://bugs.launchpad.net/bugs/683718

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/rpa-dev-addons2/+merge/43191
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/rpa-dev-addons2.
=== modified file 'mrp/stock.py'
--- mrp/stock.py	2010-10-18 12:27:07 +0000
+++ mrp/stock.py	2010-12-09 11:59:13 +0000
@@ -113,6 +113,9 @@
                     production_obj.force_production(cr, uid, [prod.id])
                 wf_service.trg_validate(uid, 'mrp.production', prod.id, 'button_produce', cr)
             for new_move in new_moves:
+                if new_move == move.id:
+                    #This move is already there in move lines of production order
+                    continue
                 production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
                 res.append(new_move)
         return res

=== modified file 'product/product.py'
--- product/product.py	2010-12-07 17:52:19 +0000
+++ product/product.py	2010-12-09 11:59:13 +0000
@@ -760,7 +760,7 @@
         'name': fields.char('Description', size=64),
         'suppinfo_id': fields.many2one('product.supplierinfo', 'Partner Information', required=True, ondelete='cascade'),
         'min_quantity': fields.float('Quantity', required=True),
-        'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Purchase Price')),
+        'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Purchase Price'), help="This price will be considered as a price for default Unit of Measure of the product"),
     }
     _order = 'min_quantity asc'
 pricelist_partnerinfo()

=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2010-12-09 11:56:59 +0000
+++ purchase/purchase.py	2010-12-09 11:59:13 +0000
@@ -649,7 +649,7 @@
                 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}}
         prod= self.pool.get('product.product').browse(cr, uid, product)
 
-
+        product_uom_pool = self.pool.get('product.uom')
         lang=False
         if partner_id:
             lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang']
@@ -670,15 +670,18 @@
         for s in prod.seller_ids:
             if s.name.id == partner_id:
                 seller_delay = s.delay
-                temp_qty = s.qty # supplier _qty assigned to temp
+                temp_qty = s.min_qty # supplier _qty assigned to temp
+                if s.product_uom:
+                    qty = product_uom_pool._compute_qty(cr, uid, s.product_uom.id, s.min_qty, to_uom_id=prod_uom_po)
+                    uom = prod_uom_po
                 if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal.
                     qty = temp_qty
         if price_unit:
             price = price_unit
         else:
             price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist],
-                    product, qty or 1.0, partner_id, {
-                        'uom': uom,
+                    product, 1.0, partner_id, {
+                        'uom': prod_uom_po,
                         'date': date_order,
                         })[pricelist]
         dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S')

=== modified file 'purchase/purchase_demo.xml'
--- purchase/purchase_demo.xml	2010-11-19 10:25:25 +0000
+++ purchase/purchase_demo.xml	2010-12-09 11:59:13 +0000
@@ -56,6 +56,10 @@
 
         <workflow action="purchase_confirm" model="purchase.order" ref="order_purchase2"/>
 
+        <record id="stock.res_company_tinyshop0" model="res.company">
+            <field eval="1.0" name="po_lead"/>
+            <field eval="80.0" name="schedule_range"/>
+        </record>
     </data>
 </openerp>
 

=== modified file 'purchase_requisition/__openerp__.py'
--- purchase_requisition/__openerp__.py	2010-09-17 06:44:03 +0000
+++ purchase_requisition/__openerp__.py	2010-12-09 11:59:13 +0000
@@ -31,7 +31,8 @@
     "depends" : ["purchase","mrp"],
     "init_xml" : [],
     "demo_xml" : ['purchase_requisition_demo.xml'],
-    "update_xml" : ["wizard/purchase_requisition_partner_view.xml",
+    "update_xml" : ["security/purchase_tender.xml",
+                    "wizard/purchase_requisition_partner_view.xml",
                     "purchase_requisition_data.xml",
                     "purchase_requisition_view.xml",
                     "purchase_requisition_report.xml",

=== modified file 'purchase_requisition/purchase_requisition_demo.xml'
--- purchase_requisition/purchase_requisition_demo.xml	2010-11-19 10:25:25 +0000
+++ purchase_requisition/purchase_requisition_demo.xml	2010-12-09 11:59:13 +0000
@@ -9,7 +9,6 @@
     <!--Resource: purchase.requisition-->
 
 		<record id="order_purchase_requisition1" model="purchase.requisition">
-            <field name="name">TE0001</field>
             <field name="user_id" model="res.users"/>
             <field name="exclusive">multiple</field>
             <field name="date_start">2010/09/16 15:56:14</field>

=== modified file 'purchase_requisition/wizard/purchase_requisition_partner.py'
--- purchase_requisition/wizard/purchase_requisition_partner.py	2010-10-27 13:35:24 +0000
+++ purchase_requisition/wizard/purchase_requisition_partner.py	2010-12-09 11:59:13 +0000
@@ -85,28 +85,28 @@
                     partner_list = sorted([(partner.sequence, partner) for partner in  line.product_id.seller_ids if partner])
                     partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False
                     uom_id = line.product_id.uom_po_id and line.product_id.uom_po_id.id or False
-                    newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
-                    newdate = newdate - relativedelta(days=company.po_lead)
+
+                    if tender.date_start:
+                        newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') - relativedelta(days=company.po_lead)
+                    else:
+                        newdate = datetime.today() - relativedelta(days=company.po_lead)
                     delay = partner_rec and partner_rec.delay or 0.0
-                    newdate = newdate -(delay and relativedelta(days=delay) or datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )
+                    if delay:
+                        newdate -= relativedelta(days=delay)
+
                     partner = partner_rec and partner_rec.name or supplier_data
                     pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False
                     price = pricelist_obj.price_get(cr, uid, [pricelist_id], line.product_id.id, line.product_qty, False, {'uom': uom_id})[pricelist_id]
                     product = prod_obj.browse(cr, uid, line.product_id.id, context=context)
                     location_id = self.pool.get('stock.warehouse').read(cr, uid, [tender.warehouse_id.id], ['lot_input_id'])[0]['lot_input_id'][0]
 
-                    if not newdate:
-                        date_planned = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
-                    else:
-                        date_planned = newdate.strftime('%Y-%m-%d %H:%M:%S')
-
                     purchase_order_line= {
                             'name': product.partner_ref,
                             'product_qty': line.product_qty,
                             'product_id': line.product_id.id,
                             'product_uom': uom_id,
                             'price_unit': price,
-                            'date_planned': date_planned,
+                            'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
                             'notes': product.description_purchase,
                     }
                     taxes_ids = line.product_id.product_tmpl_id.supplier_taxes_id

=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml	2010-11-25 05:32:05 +0000
+++ sale/sale_view.xml	2010-12-09 11:59:13 +0000
@@ -138,7 +138,7 @@
                                                 <field groups="product.group_uos" name="product_uos_qty"/>
                                                 <field groups="product.group_uos" name="product_uos"/>
                                             <field name="product_uom"
-                                                on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)" domain="[('category_id','=', product_id.uom_id.category_id.id)]"/>
+                                                on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"/>
                                             <field
                                                 name="product_packaging"
                                                 context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"

=== modified file 'stock/stock.py'
--- stock/stock.py	2010-12-08 07:17:22 +0000
+++ stock/stock.py	2010-12-09 11:59:13 +0000
@@ -114,8 +114,11 @@
 
         product_product_obj = self.pool.get('product.product')
 
-        cr.execute('select distinct product_id, location_id from stock_move where location_id in %s or location_dest_id in %s', (tuple(ids), tuple(ids)))
-        res_products_by_location = sorted(cr.dictfetchall(), key=itemgetter('location_id'))
+        cr.execute('select distinct product_id, location_id from stock_move where location_id in %s', (tuple(ids), ))
+        dict1 = cr.dictfetchall()
+        cr.execute('select distinct product_id, location_dest_id as location_id from stock_move where location_dest_id in %s', (tuple(ids), ))
+        dict2 = cr.dictfetchall()
+        res_products_by_location = sorted(dict1+dict2, key=itemgetter('location_id'))
         products_by_location = dict((k, [v['product_id'] for v in itr]) for k, itr in groupby(res_products_by_location, itemgetter('location_id')))
 
         result = dict([(i, {}.fromkeys(field_names, 0.0)) for i in ids])

=== modified file 'stock/stock_demo.xml'
--- stock/stock_demo.xml	2010-11-24 10:48:50 +0000
+++ stock/stock_demo.xml	2010-12-09 11:59:13 +0000
@@ -212,10 +212,8 @@
         </record>
         <record id="res_company_tinyshop0" model="res.company">
             <field name="currency_id" ref="base.EUR"/>
-            <field eval="1.0" name="po_lead"/>
             <field name="partner_id" ref="res_partner_tinyshop1"/>
             <field name="parent_id" ref="base.main_company"/>
-            <field eval="80.0" name="schedule_range"/>
             <field eval="&quot;&quot;&quot;Shop 2&quot;&quot;&quot;" name="name"/>
         </record>
         <record id="stock_location_shop0" model="stock.location">


Follow ups