From b2f74f995ac7483d4d29541cecc2b5844e32f5b0 Mon Sep 17 00:00:00 2001 From: "Amit (OpenERP)" Date: Tue, 20 Sep 2011 16:42:57 +0530 Subject: [PATCH] [IMP]:product:improved kanban view for product and also set default product images. bzr revid: apa@tinyerp.com-20110920111257-4pmqzdoqc601neu9 --- addons/product/product.py | 12 ++++- addons/product/product_view.xml | 88 ++++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 3 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index b81fdc0bad1..5eaa9035733 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -21,7 +21,7 @@ from osv import osv, fields import decimal_precision as dp - +import addons import math from _common import rounding import re @@ -457,10 +457,16 @@ class product_product(osv.osv): (data['name'] or '') + (data['variants'] and (' - '+data['variants']) or '') return res + def _get_photo(self, cr, uid, context=None): + photo_path = addons.get_module_resource('product','images','product.png') + return open(photo_path, 'rb').read().encode('base64') + _defaults = { 'active': lambda *a: 1, 'price_extra': lambda *a: 0.0, 'price_margin': lambda *a: 1.0, + 'color': 0, + 'product_image':_get_photo, } _name = "product.product" @@ -487,8 +493,10 @@ class product_product(osv.osv): 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Sale Price')), 'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'), 'name_template': fields.related('product_tmpl_id', 'name', string="Name", type='char', size=128, store=True), + 'color': fields.integer('Color Index'), + 'product_image': fields.binary('Image'), } - + def unlink(self, cr, uid, ids, context=None): unlink_ids = [] unlink_product_tmpl_ids = [] diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 1d30bc2bb43..b58453be5c4 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -69,7 +69,7 @@
- + @@ -85,6 +85,9 @@ + + + @@ -191,6 +194,74 @@
+ + + + Product Kanban + product.product + kanban + + + + + + + + + + + + + + + + +
+
+ + + + + +
+ [] + + + +
+
+ + + + + +
+ + +
+ No Stock + +
On Hand , Available
+
Public Price : , Cost :
+
+
+
+
+ +
+
+
+
+
+
+
+ Products ir.actions.act_window @@ -204,12 +275,27 @@ Products ir.actions.act_window product.product + tree,form,kanban form {"search_default_filter_to_sell":1} You must define a Product for everything you buy or sell. Products can be raw materials, stockable products, consumables or services. The Product form contains detailed information about your products related to procurement logistics, sales price, product category, suppliers and so on. + + + + tree + + + + + + + form + + +