From 0d3b06d6a674da8abff6b06dea30a33bbe993a09 Mon Sep 17 00:00:00 2001 From: Rucha Patel Date: Sat, 20 Sep 2008 18:06:51 +0530 Subject: [PATCH 01/72] Added function unlink in sale order for not to delete confirmed SO bzr revid: ruchakpatel@gmail.com-20080920123651-p2yw2mh586w6sl8d --- addons/sale/sale.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 45783dd5978..2d278491fee 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -260,6 +260,17 @@ class sale_order(osv.osv): _order = 'name desc' # Form filling + def unlink(self, cr, uid, ids): + sale_orders = self.read(cr, uid, ids, ['state']) + unlink_ids = [] + for s in sale_orders: + if s['state'] in ['draft','canceled']: + unlink_ids.append(s['id']) + else: + raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sale Order(s) which are already confirmed !')) + osv.osv.unlink(self, cr, uid, unlink_ids) + return True + def onchange_shop_id(self, cr, uid, ids, shop_id): v={} if shop_id: From d3e1d24f1bc9bfc9760bffa1189716171115362e Mon Sep 17 00:00:00 2001 From: Rucha Patel Date: Sat, 20 Sep 2008 18:36:56 +0530 Subject: [PATCH 02/72] Moved Latest Inventory from report_stock to stock bzr revid: ruchakpatel@gmail.com-20080920130656-wuf24lx0u40tnv6p --- addons/stock/stock.py | 32 ++++++++++++++++++++++++++++++++ addons/stock/stock_view.xml | 27 ++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 5b4a416f8fa..82143484ee1 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1395,4 +1395,36 @@ class product_product(osv.osv): return res product_product() + + +class report_inventory_latest(osv.osv): + _name = "report.inventory.latest" + _description = "Latest inventories by product." + _auto = False + _columns = { + 'name': fields.datetime('Latest Date',readonly=True), + 'product': fields.many2one('product.product', 'Product', readonly=True, select=True), + 'inventory': fields.many2one('stock.inventory', 'Inventory Name', readonly=True, select=True), + 'qty': fields.float('Quantity', readonly=True, select=True), + 'uom' : fields.many2one('product.uom', 'UoM', readonly=True), +# 'date' : fields.datetime('Latest Date',readonly=True), + } + _order = 'name desc' + def init(self, cr): + cr.execute(""" + create or replace view report_inventory_latest as ( + select max(l.id) as id, + l.product_id as product, + l.product_qty as qty, + l.product_uom as uom , + min(l.inventory_id) as inventory, + i.date as name + from stock_inventory_line l + join stock_inventory i on (l.inventory_id=i.id) + group by l.product_uom,l.product_qty,l.product_id,i.date + + )""") +report_inventory_latest() + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 5e7d96ff2e4..e78edfc67e0 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1275,7 +1275,32 @@   -       +       + report.inventory.latest.view + report.inventory.latest + tree + + + + + + + + + + + + + Latest Inventories by product + ir.actions.act_window + report.inventory.latest + form + tree + [('name','>=',time.strftime('%Y-%m-01'))] + + + + From 5093e92aeeb8c707a28097af31a45644a8937606 Mon Sep 17 00:00:00 2001 From: Rucha Patel Date: Mon, 22 Sep 2008 18:22:52 +0530 Subject: [PATCH 03/72] Check UoM In invoices like in sales : Minor changes in ivoice.py and invoice view bzr revid: ruchakpatel@gmail.com-20080922125252-4bm2us5swwgolqed --- addons/account/account_invoice_view.xml | 5 ++++- addons/account/invoice.py | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 46239314c40..2798975fd62 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -53,7 +53,10 @@ - + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index a6d39d42f10..fc5dbb69d9f 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -847,7 +847,7 @@ class account_invoice_line(osv.osv): if type in ('in_invoice', 'in_refund'): return {'domain':{'product_uom':[]}} else: - return {'value': {'price_unit': 0.0}, 'domain':{'product_uom':[]}} + return {'value': {'price_unit': 0.0 }, 'domain':{'uos_id': []}} lang=False context.update({'lang': lang}) res = self.pool.get('product.product').browse(cr, uid, product, context=context) @@ -892,11 +892,12 @@ class account_invoice_line(osv.osv): result['account_id'] = a domain = {} - result['uos_id'] = uom or res.uom_id.id or False + result['uos_id'] = res.uom_id.id or uom or False if result['uos_id']: res2 = res.uom_id.category_id.id if res2 : domain = {'uos_id':[('category_id','=',res2 )]} + result return {'value':result, 'domain':domain} def move_line_get(self, cr, uid, invoice_id, context={}): From bc6d378757021174712ad27a1ac84340ba52ab91 Mon Sep 17 00:00:00 2001 From: Rucha Patel Date: Mon, 22 Sep 2008 18:51:14 +0530 Subject: [PATCH 04/72] Fill From Unreceived Products : improved picking added new field in stock.move ,so that it shows only moves from the partner selected in the picking. bzr revid: ruchakpatel@gmail.com-20080922132114-xl0jooywvj7qv34x --- addons/stock/stock.py | 1 + addons/stock/stock_view.xml | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 82143484ee1..d7555ac1b25 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -908,6 +908,7 @@ class stock_move(osv.osv): 'state': fields.selection([('draft','Draft'),('waiting','Waiting'),('confirmed','Confirmed'),('assigned','Assigned'),('done','Done'),('cancel','cancel')], 'Status', readonly=True, select=True), 'price_unit': fields.float('Unit Price', digits=(16, int(config['price_accuracy']))), + 'partner_id':fields.related('picking_id','address_id',type='many2one',relation='res.partner.address', string='Partner'), } _constraints = [ diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index e78edfc67e0..55c68761f72 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -448,7 +448,7 @@
- +