From 0ff09fd6a94bc20ed74c274a5dbaa2afafc2e0fe Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 25 Aug 2008 01:23:45 +0200 Subject: [PATCH] View Improvement bzr revid: fp@tinyerp.com-20080824232345-v3f5phajqy2mo9kr --- addons/account/product_view.xml | 71 +++++++-------------- addons/product/product.py | 21 +++--- addons/product/product_view.xml | 110 +++++++++++++++++++++----------- addons/sale/sale.py | 45 +++++++++++++ addons/sale/sale_view.xml | 4 +- addons/stock/product_view.xml | 49 +++++++++++--- 6 files changed, 195 insertions(+), 105 deletions(-) diff --git a/addons/account/product_view.xml b/addons/account/product_view.xml index 210788ae7ee..1512b202f2f 100644 --- a/addons/account/product_view.xml +++ b/addons/account/product_view.xml @@ -7,12 +7,19 @@ form - - - - - - + + + + + + + + + + + + + @@ -22,13 +29,17 @@ form - - - - - - - + + + + + + + + + + + @@ -46,39 +57,5 @@ - - - - product.template.property.form.inherit - product.template - form - - - - - - - - - - - - - - product.normal.property.form.inherit - product.product - form - - - - - - - - - - - - diff --git a/addons/product/product.py b/addons/product/product.py index a2cf5cd338c..529936bec0b 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -246,12 +246,12 @@ class product_template(osv.osv): 'description_sale': fields.text('Sale Description'), 'type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True), 'supply_method': fields.selection([('produce','Produce'),('buy','Buy')], 'Supply method', required=True), - 'sale_delay': fields.float('Customer lead time', help="This is the average time between the confirmation of the customer order and the delivery of the finnished products. It's the time you promise to your customers."), - 'produce_delay': fields.float('Manufacturing lead time', help="Average time to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different delays will be summed for all levels and purchase orders."), + 'sale_delay': fields.float('Customer Lead Time', help="This is the average time between the confirmation of the customer order and the delivery of the finnished products. It's the time you promise to your customers."), + 'produce_delay': fields.float('Manufacturing Lead Time', help="Average time to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different delays will be summed for all levels and purchase orders."), 'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procure Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until refurnishing. 'Make to Order': When needed, purchase or produce for the procurement request."), 'rental': fields.boolean('Rentable product'), 'categ_id': fields.many2one('product.category','Category', required=True, change_default=True), - 'list_price': fields.float('Public Price', digits=(16, int(config['price_accuracy']))), + 'list_price': fields.float('Sale Price', digits=(16, int(config['price_accuracy']))), 'standard_price': fields.float('Cost Price', required=True, digits=(16, int(config['price_accuracy']))), 'volume': fields.float('Volume'), 'weight': fields.float('Gross weight'), @@ -268,10 +268,13 @@ class product_template(osv.osv): 'uos_coeff': fields.float('UOM -> UOS Coeff', digits=(16,4), help='Coefficient to convert UOM to UOS\n' ' uom = uos * coeff'), - 'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure type', required=True), - 'tracking': fields.boolean('Track lots'), - 'seller_delay': fields.function(_calc_seller_delay, method=True, type='integer', string='Supplier lead time', help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."), + 'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type', required=True), + 'tracking': fields.boolean('Track Lots', help="Force to use a Production Lot number during stock operations for traceability."), + 'seller_delay': fields.function(_calc_seller_delay, method=True, type='integer', string='Supplier Lead Time', help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."), 'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Partners'), + 'loc_rack': fields.char('Rack', size=16), + 'loc_row': fields.char('Row', size=16), + 'loc_case': fields.char('Case', size=16), } def _get_uom_id(self, cr, uid, *args): @@ -410,8 +413,8 @@ class product_product(osv.osv): 'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True), 'ean13': fields.char('EAN13', size=13), 'packaging' : fields.one2many('product.packaging', 'product_id', 'Palettization', help="Gives the different ways to package the same product. This has no impact on the packing order and is mainly used if you use the EDI module."), - 'price_extra': fields.float('Price Extra', digits=(16, int(config['price_accuracy']))), - 'price_margin': fields.float('Price Margin', digits=(16, int(config['price_accuracy']))), + 'price_extra': fields.float('Variant Price Extra', digits=(16, int(config['price_accuracy']))), + 'price_margin': fields.float('Variant Price Margin', digits=(16, int(config['price_accuracy']))), } def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id): @@ -580,7 +583,7 @@ class product_supplierinfo(osv.osv): 'qty' : fields.float('Minimal quantity', required=True), 'product_id' : fields.many2one('product.template', 'Product', required=True, ondelete='cascade', select=True), 'delay' : fields.integer('Delivery delay', required=True), - 'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Pricelist'), + 'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist'), } _defaults = { 'qty': lambda *a: 0.0, diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 7c13df2ac63..61e00f64916 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -31,44 +31,84 @@
+ + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - + @@ -79,8 +119,6 @@ - - @@ -101,8 +139,6 @@ - -
@@ -438,8 +474,6 @@ - - diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 98629c30481..ada1ef51a94 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -102,6 +102,49 @@ class sale_order(osv.osv): res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0)) return res + def _picked_rate(self, cr, uid, ids, name, arg, context=None): + if not ids: return {} + res = {} + for id in ids: + res[id] = [0.0,0.0] + cr.execute('''SELECT + p.sale_id,sum(m.product_qty), m.state + FROM + stock_move m + LEFT JOIN + stock_picking p on (p.id=m.picking_id) + WHERE + p.sale_id in ('''+','.join(map(str,ids))+''') + GROUP BY m.state, p.sale_id''') + for oid,nbr,state in cr.fetchall(): + if state=='cancel': + continue + if state=='done': + res[oid][0] += nbr or 0.0 + res[oid][1] += nbr or 0.0 + else: + res[oid][1] += nbr or 0.0 + print res + for r in res: + if not res[r][1]: + res[r] = 0.0 + else: + res[r] = 100.0 * res[r][0] / res[r][1] + return res + + def _invoiced_rate(self, cursor, user, ids, name, arg, context=None): + res = {} + for sale in self.browse(cursor, user, ids, context=context): + tot = 0.0 + for invoice in sale.invoice_ids: + if invoice.state not in ('draft','cancel'): + tot += invoice.amount_untaxed + if tot: + res[sale.id] = tot * 100.0 / sale.amount_untaxed + else: + res[sale.id] = 0.0 + return res + def _invoiced(self, cursor, user, ids, name, arg, context=None): res = {} for sale in self.browse(cursor, user, ids, context=context): @@ -187,6 +230,8 @@ class sale_order(osv.osv): 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), 'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Packing List', readonly=True, help="This is the list of picking list that have been generated for this invoice"), 'shipped':fields.boolean('Picked', readonly=True), + 'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'), + 'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'), 'invoiced': fields.function(_invoiced, method=True, string='Paid', fnct_search=_invoiced_search, type='boolean'), 'note': fields.text('Notes'), diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 0025378df81..2b4156366d0 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -54,8 +54,8 @@ - - + + diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 19f32285538..a48d2c5483d 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -38,21 +38,52 @@ + + product.normal.stock.acc.property.form.inherit + product.product + form + + + + + + + + + + + + product.normal.stock.form.inherit + product.product + form + + + + + + + + + + + + + + product.normal.stock.property.form.inherit product.product form - - - - - - - - - + + + + + + + +