From 0f7ca6e784b51abac7d32094fcc634aa8bd39394 Mon Sep 17 00:00:00 2001 From: "Jitendra Prajapati (OpenERP)" Date: Mon, 20 Jan 2014 12:22:22 +0530 Subject: [PATCH 01/29] [FIX]mrp_repair:set unique constraint on name bzr revid: prajapatijitendra7969@gmail.com-20140120065222-05hw8t0ca05mq7r4 --- addons/mrp_repair/mrp_repair.py | 4 ++++ addons/mrp_repair/mrp_repair_demo.yml | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index b178d4e12a4..c287bbff56d 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -186,6 +186,10 @@ class mrp_repair(osv.osv): 'pricelist_id': lambda self, cr, uid,context : self.pool.get('product.pricelist').search(cr, uid, [('type','=','sale')])[0] } + _sql_constraints = [ + ('name', 'unique (name)', 'The name of the Repair Order must be unique!'), + ] + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} diff --git a/addons/mrp_repair/mrp_repair_demo.yml b/addons/mrp_repair/mrp_repair_demo.yml index 1299cbfb6d2..93fc19a1f91 100644 --- a/addons/mrp_repair/mrp_repair_demo.yml +++ b/addons/mrp_repair/mrp_repair_demo.yml @@ -20,7 +20,6 @@ location_id: stock.stock_location_14 picking_type_id: stock.picking_type_out move_id: 'stock_move_pcbasicpc0' - name: RMA00004 operations: - location_dest_id: stock.location_production location_id: stock.stock_location_stock @@ -62,7 +61,6 @@ location_id: stock.stock_location_14 picking_type_id: stock.picking_type_out move_id: 'stock.stock_move_stockmvmrp1' - name: RMA-00007 operations: - location_dest_id: stock.location_production location_id: stock.stock_location_stock @@ -104,7 +102,6 @@ location_id: stock.stock_location_14 picking_type_id: stock.picking_type_out move_id: 'stock.stock_move_stockmvmrp2' - name: RMA-00011 operations: - location_dest_id: stock.location_production location_id: stock.stock_location_stock From 49104e91081adef130424db0414d0a51f2f9f0d3 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Mon, 20 Jan 2014 11:30:48 +0100 Subject: [PATCH 02/29] [FIX]add PO name to origin field when generating picking from PO lp bug: https://launchpad.net/bugs/1269353 fixed bzr revid: csn@openerp.com-20140120103048-ebb2ow8rutn2gs21 --- addons/purchase/purchase.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 235b9d6c2bd..8f3ecbc05ce 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -694,6 +694,7 @@ class purchase_order(osv.osv): 'picking_type_id': order.picking_type_id.id, 'group_id': group_id, 'procurement_id': order_line.procurement_ids and order_line.procurement_ids[0].id or False, + 'origin': order.name, 'route_ids': order.picking_type_id.warehouse_id and [(6, 0, [x.id for x in order.picking_type_id.warehouse_id.route_ids])] or [], }] #if the order line has a bigger quantity than the procurement it was for (manually changed or minimal quantity), then From fbd144c9e7e6f78556fbdc1b91eea66e36384f39 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 22 Jan 2014 13:31:59 +0100 Subject: [PATCH 03/29] [WIP] Start changing move to quant bzr revid: jco@openerp.com-20140122123159-v9tvkzrry61a6n39 --- addons/mrp_repair/mrp_repair.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index b178d4e12a4..9fd49d5840f 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -139,7 +139,7 @@ class mrp_repair(osv.osv): \n* The \'Cancelled\' status is used when user cancel repair order.'), 'location_id': fields.many2one('stock.location', 'Current Location', select=True, readonly=True, states={'draft':[('readonly',False)], 'confirmed':[('readonly',True)]}), 'location_dest_id': fields.many2one('stock.location', 'Delivery Location', readonly=True, states={'draft':[('readonly',False)], 'confirmed':[('readonly',True)]}), - 'move_id': fields.many2one('stock.move', 'Move',required=True, domain="[('product_id','=',product_id)]", readonly=True, states={'draft':[('readonly',False)]}), + 'quant_id': fields.many2one('stock.quant', 'Quant',required=True, domain="[('product_id','=',product_id)]", readonly=True, states={'draft':[('readonly',False)]}), 'guarantee_limit': fields.date('Warranty Expiration', help="The warranty expiration limit is computed as: last move date + warranty defined on selected product. If the current date is below the warranty expiration limit, each operation and fee you will add will be set as 'not to invoiced' by default. Note that you can change manually afterwards.", states={'confirmed':[('readonly',True)]}), 'operations' : fields.one2many('mrp.repair.line', 'repair_id', 'Operation Lines', readonly=True, states={'draft':[('readonly',False)]}), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', help='Pricelist of the selected partner.'), @@ -205,25 +205,26 @@ class mrp_repair(osv.osv): @return: Dictionary of values. """ return {'value': { - 'move_id': False, + 'quant_id': False, 'guarantee_limit' :False, 'location_id': False, 'location_dest_id': False, } } - def onchange_move_id(self, cr, uid, ids, prod_id=False, move_id=False): + def onchange_quant_id(self, cr, uid, ids, prod_id=False, quant_id=False): """ On change of move id sets values of guarantee limit, source location, destination location, partner and partner address. @param prod_id: Id of product in current record. - @param move_id: Changed move. + @param quant_id: Quant to handle @return: Dictionary of values. """ data = {} data['value'] = {'guarantee_limit': False, 'location_id': False, 'partner_id': False} - if not prod_id: + if prod_id and + if not prod_id and not quant_id: return data - if move_id: + if quant_id: move = self.pool.get('stock.move').browse(cr, uid, move_id) product = self.pool.get('product.product').browse(cr, uid, prod_id) limit = datetime.strptime(move.date_expected, '%Y-%m-%d %H:%M:%S') + relativedelta(months=int(product.warranty)) From e086290eb047966f2e05959009ccaab1ef047ac4 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Wed, 22 Jan 2014 14:04:11 +0100 Subject: [PATCH 04/29] [FIX]inventory adjustment: should not show negative qty at start and prevent user should not input negative qty lp bug: https://launchpad.net/bugs/1271244 fixed bzr revid: csn@openerp.com-20140122130411-vab09j3bo5r7ks0f --- addons/stock/stock.py | 5 +++++ addons/stock/stock_view.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 91feb16bca5..66e40e8df5b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2018,6 +2018,7 @@ class stock_inventory(osv.osv): 'date': fields.datetime('Inventory Date', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Inventory Create Date."), 'date_done': fields.datetime('Date done', help="Inventory Validation Date."), 'line_ids': fields.one2many('stock.inventory.line', 'inventory_id', 'Inventories', readonly=False, states={'done': [('readonly', True)]}, help="Inventory Lines."), + 'line_view_ids': fields.one2many('stock.inventory.line', 'inventory_id', 'Inventories', readonly=False, domain=['|',('th_qty', '>=', 0),('th_qty', '=', False)], states={'done': [('readonly', True)]}, help="Inventory Lines."), 'move_ids': fields.one2many('stock.move', 'inventory_id', 'Created Moves', help="Inventory Moves."), 'state': fields.selection([('draft', 'Draft'), ('cancel', 'Cancelled'), ('confirm', 'In Progress'), ('done', 'Validated')], 'Status', readonly=True, select=True), 'company_id': fields.many2one('res.company', 'Company', required=True, select=True, readonly=True, states={'draft': [('readonly', False)]}), @@ -2073,6 +2074,10 @@ class stock_inventory(osv.osv): context = {} move_obj = self.pool.get('stock.move') for inv in self.browse(cr, uid, ids, context=context): + if inv.line_ids: + for inventory_line in inv.line_ids: + if inventory_line.product_qty < 0 and inventory_line.th_qty >= 0: + raise osv.except_osv(_('Warning'),_('You cannot have a negative product quantity in an inventory line')) if not inv.move_ids: self.action_check(cr, uid, [inv.id], context=context) inv.refresh() diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 7ba08b1a6f1..bd77f6f40c9 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -119,7 +119,7 @@