← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~openerp-community/purchase-wkfl/add_product_supplier_info into lp:~lin-yu/purchase-wkfl/add_product_supplier_info

 

Pedro Manuel Baeza has proposed merging lp:~openerp-community/purchase-wkfl/add_product_supplier_info into lp:~lin-yu/purchase-wkfl/add_product_supplier_info.

Requested reviews:
  LIN Yu (lin-yu)

For more details, see:
https://code.launchpad.net/~openerp-community/purchase-wkfl/add_product_supplier_info/+merge/186403

Various fixes.
-- 
https://code.launchpad.net/~openerp-community/purchase-wkfl/add_product_supplier_info/+merge/186403
Your team OpenERP Community is subscribed to branch lp:~openerp-community/purchase-wkfl/add_product_supplier_info.
=== modified file 'product_supplier_info/__openerp__.py'
--- product_supplier_info/__openerp__.py	2013-09-16 03:59:16 +0000
+++ product_supplier_info/__openerp__.py	2013-09-18 17:53:40 +0000
@@ -35,7 +35,9 @@
     """,
     'author': 'Elico Corp',
     'website': 'http://www.elico-corp.com',
-    'images': [],
+    'images': [
+               'static/images/product_supplier_info.png'
+               ],
     'depends': ['product', 'stock'],
     'data': [
         'product_view.xml',

=== modified file 'product_supplier_info/product.py'
--- product_supplier_info/product.py	2013-09-16 03:59:16 +0000
+++ product_supplier_info/product.py	2013-09-18 17:53:40 +0000
@@ -19,7 +19,6 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
-
 from openerp.osv import orm, fields
 import openerp.addons.decimal_precision as dp
 
@@ -29,33 +28,29 @@
 
     def _product_available(
             self, cr, uid, ids, field_names=None, arg=False, context=None):
-        if not field_names:
-            field_names = []
-        if context is None:
-            context = {}
+        context = context or {}
         res = {}
+        product_obj = self.pool.get('product.product')
         for record in self.browse(cr, uid, ids, context=context):
-            res[record.id] = {}.fromkeys(field_names, 0.0)
-            for f in field_names:
-                if f == 'qty_available':
-                    res[record.id][f] = record.product_id.qty_available
-                if f == 'virtual_available':
-                    res[record.id][f] = record.product_id.virtual_available
+            res[record.id] = {}
+            product = product_obj.browse(cr, uid, record.product_id.id)
+            res[record.id]['qty_available'] = product.qty_available
+            res[record.id]['virtual_available'] = product.virtual_available
         return res
 
     _columns = {
-        'product_id': fields.many2one(
-            'product.product',
-            'Product', select=1,
-            ondelete='cascade', required=True),
+        # It cannot be done with related fields because product_id points to
+        # product.template, not product.product
         'qty_available': fields.function(
             _product_available, multi='qty_available', type='float',
-            digits_compute=dp.get_precision('Product Unit of Measure'),
             string="Quantity On Hand"),
         'virtual_available': fields.function(
-            _product_available, multi='qty_available', type='float',
-            digits_compute=dp.get_precision('Product Unit of Measure'),
+            _product_available, multi='virtual_available', type='float',
             string="Forecasted Quantity"),
+        'delay' : fields.integer('Delivery Lead Time', required=True,
+                                 group_operator="avg",
+                                 help="Lead time in days between the confirmation of the purchase order and the reception of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning."
+                                 ),
     }
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'product_supplier_info/product_view.xml'
--- product_supplier_info/product_view.xml	2013-09-17 02:02:06 +0000
+++ product_supplier_info/product_view.xml	2013-09-18 17:53:40 +0000
@@ -6,11 +6,11 @@
             <field name="model">product.supplierinfo</field>
             <field name="arch" type="xml">
                 <search string="Product Supplier Info">
-                	<field name="name" string="Supplier"/>
-                	<field name="product_code" string="Supplier Product Code"/>
+                    <field name="name" string="Supplier"/>
+                    <field name="product_code" string="Supplier Product Code"/>
                     <field name="product_name" string="Supplier Product Code"/>
                     <field name="product_id" />
-                    <group  expand='1' string='Group by...' groups="base.group_extended">
+                    <group expand='1' string='Group by...' groups="base.group_extended">
                        <filter string='Product Code' name='supplier_code' icon="terp-stock_symbol-selection" 
                             domain="[]" context="{'group_by' : 'product_code'}" />
                        <filter string='Product' name='product' icon="terp-stock_symbol-selection" domain="[]" 
@@ -21,13 +21,13 @@
                 </search>
             </field>
         </record>
-        
+
         <record id="view_product_supplierinfo_tree1" model="ir.ui.view">
             <field name="name">product.supplierinfo.tree1</field>
             <field name="model">product.supplierinfo</field>
             <field name="priority">90</field>
             <field name="arch" type="xml">
-            	<tree string="Supplier Information" editable="top">
+                <tree string="Supplier Information" editable="top">
                     <field name="sequence" widget="handle"/>
                     <field name="product_code" string="Supplier Product Code"/>
                     <field name="product_name" string="Supplier Product Name"/>
@@ -41,17 +41,18 @@
                 </tree>
             </field>
         </record>
-        <record id="view_product_supplierinfo_from1" model="ir.ui.view">
-            <field name="name">product.supplierinfo.from1</field>
+
+        <record id="view_product_supplierinfo_form1" model="ir.ui.view">
+            <field name="name">product.supplierinfo.form1</field>
             <field name="model">product.supplierinfo</field>
             <field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
+            <field name="priority">99</field>
             <field name="arch" type="xml">
                 <xpath expr="//field[@name='sequence']" position="before">
                     <field name="product_id"/>
                 </xpath>
             </field>
         </record>
-        
 
         <record id="action_product_supplier_info" model="ir.actions.act_window">
             <field name="name">Product Supplier Info</field>

=== modified file 'product_supplier_info/static/description/index.html'
--- product_supplier_info/static/description/index.html	2013-09-12 04:35:18 +0000
+++ product_supplier_info/static/description/index.html	2013-09-18 17:53:40 +0000
@@ -2,16 +2,11 @@
     <div class="oe_row">
     <h2 class="oe_slogan">product_supplier_info Module</h2> 
     <h3 class="oe_slogan">Categorise supplier product by Supplier name</h3>
-    <h4 class="oe_slogan"><a href="http://www.openerp.com.cn";>By Elico Corp</a></h4>
        <p>This module categorizes each product item by supplier.It allows for users to be able to view a compiled list of products supplied by the supplier.  </p>
                
                 <p>Users can also directly add new products to the supplier's list.</p>
         <div class="oe_row_img oe_centered oe_mt32">
-            <img class="oe_picture oe_screenshot" src="product_supplier_info.png">
+            <img class="oe_picture oe_screenshot" src="../images/product_supplier_info.png">
         </div>
     </div>
-     <div class="oe_row oe_centeralign oe_more_space">
-            <a href="http://www.elico-corp.com"; class="oe_button oe_big">Start your <span class="oe_emph">free</span> trial</a>
-        </div>
-        <h4 class="oe_slogan">or</h4>
-</section>
\ No newline at end of file
+</section>

=== removed file 'product_supplier_info/static/description/product_supplier_info.png'
Binary files product_supplier_info/static/description/product_supplier_info.png	2013-09-12 04:35:18 +0000 and product_supplier_info/static/description/product_supplier_info.png	1970-01-01 00:00:00 +0000 differ
=== added directory 'product_supplier_info/static/images'
=== added file 'product_supplier_info/static/images/product_supplier_info.png'
Binary files product_supplier_info/static/images/product_supplier_info.png	1970-01-01 00:00:00 +0000 and product_supplier_info/static/images/product_supplier_info.png	2013-09-18 17:53:40 +0000 differ

Follow ups