From 536a51efbb093283c05a2b9b3b4487d53d2aaea0 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 15 Jun 2010 10:14:32 +0200 Subject: [PATCH] modifs bzr revid: fp@tinyerp.com-20100615081432-9qbkcx3vpb6ll84w --- addons/product/product_view.xml | 2 +- addons/stock/security/ir.model.access.csv | 2 + addons/stock/stock.py | 21 ++++++-- addons/stock/stock_view.xml | 64 ++++++++++++++++++++--- addons/stock_location/mrp_pull.py | 4 +- addons/stock_location/stock.py | 8 +-- 6 files changed, 84 insertions(+), 17 deletions(-) diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index edd5e9e3499..09a287f0a38 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -45,7 +45,7 @@ - + diff --git a/addons/stock/security/ir.model.access.csv b/addons/stock/security/ir.model.access.csv index 9265ac0b2c9..803431d8bd0 100644 --- a/addons/stock/security/ir.model.access.csv +++ b/addons/stock/security/ir.model.access.csv @@ -5,6 +5,8 @@ "access_stock_warehouse_user","stock.warehouse.user","model_stock_warehouse","base.group_user",1,0,0,0 "access_stock_location_manager","stock.location.manager","model_stock_location","stock.group_stock_manager",1,1,1,1 "access_stock_location_user","stock.location.user","model_stock_location","base.group_user",1,0,0,0 +"access_stock_journal_user","stock.journal.user","model_stock_journal","base.group_user",1,0,0,0 +"access_stock_journal_manager","stock.journal.manager","model_stock_journal","stock.group_stock_manager",1,1,1,1 "access_stock_picking_move_wizard","stock.picking.move.wizard","model_stock_picking_move_wizard","stock.group_stock_user",1,1,1,1 "access_stock_tracking","stock.tracking","model_stock_tracking","stock.group_stock_user",1,1,1,0 "access_stock_picking","stock.picking","model_stock_picking","stock.group_stock_user",1,1,1,1 diff --git a/addons/stock/stock.py b/addons/stock/stock.py index ddfe4808dba..b47b3189723 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -49,6 +49,17 @@ class stock_incoterms(osv.osv): stock_incoterms() +class stock_journal(osv.osv): + _name = "stock.journal" + _description = "Stock Journal" + _columns = { + 'name': fields.char('Stock Journal', size=32, required=True), + 'user_id': fields.many2one('res.users','Responsible'), + } + _defaults = { + 'user_id': lambda s,c,u,ctx: u + } +stock_journal() #---------------------------------------------------------- # Stock Location @@ -169,6 +180,7 @@ class stock_location(osv.osv): 'location_id': fields.many2one('stock.location', 'Parent Location', select=True, ondelete='cascade'), 'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'), + 'chained_journal_id': fields.many2one('stock.journal', 'Chained Journal'), 'chained_location_id': fields.many2one('stock.location', 'Chained Location If Fixed'), 'chained_location_type': fields.selection([('none', 'None'), ('customer', 'Customer'), ('fixed', 'Fixed Location')], 'Chained Location Type', required=True), @@ -225,7 +237,7 @@ class stock_location(osv.osv): elif location.chained_location_type == 'fixed': result = location.chained_location_id if result: - return result, location.chained_auto_packing, location.chained_delay + return result, location.chained_auto_packing, location.chained_delay, location.chained_journal_id and location.chained_journal_id.id or False return result def picking_type_get(self, cr, uid, from_location, to_location, context={}): @@ -557,7 +569,7 @@ class stock_picking(osv.osv): 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."), 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the picking without removing it."), 'note': fields.text('Notes'), - + 'stock_journal_id': fields.many2one('stock.journal','Stock Journal'), 'location_id': fields.many2one('stock.location', 'Location', help="Keep empty if you produce at the location where the finished products are needed." \ "Set a location if you produce at a fixed location. This can be a partner location " \ "if you subcontract the manufacturing operations."), @@ -1563,6 +1575,7 @@ class stock_move(osv.osv): pick_name = '' if ptype == 'delivery': pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.delivery') + print todo pickid = self.pool.get('stock.picking').create(cr, uid, { 'name': pick_name or picking.name, 'origin': str(picking.origin or ''), @@ -1570,11 +1583,11 @@ class stock_move(osv.osv): 'note': picking.note, 'move_type': picking.move_type, 'auto_picking': todo[0][1][1] == 'auto', + 'stock_journal_id': todo[0][1][3], 'address_id': picking.address_id.id, 'invoice_state': 'none' }) - for move, (loc, auto, delay) in todo: - # Is it smart to copy ? May be it's better to recreate ? + for move, (loc, auto, delay, journal) in todo: new_id = self.pool.get('stock.move').copy(cr, uid, move.id, { 'location_id': move.location_dest_id.id, 'location_dest_id': loc.id, diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 0e26df8bdf9..92065350c38 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -420,6 +420,7 @@ + @@ -603,15 +604,13 @@
- - - + @@ -715,10 +714,9 @@ - - + @@ -761,8 +759,9 @@ - + + @@ -863,6 +862,7 @@ + @@ -939,6 +939,7 @@ + @@ -1048,6 +1049,7 @@ + @@ -1125,6 +1127,7 @@ + @@ -1220,6 +1223,7 @@ + @@ -1277,6 +1281,7 @@ + @@ -1799,5 +1804,52 @@ + + + + stock.journal.filter + stock.journal + search + + + + + + + + + Stock Journals + stock.journal + tree + + + + + + + + + Stock Journals + stock.journal + form + + + + + + + + + Stock Journals + stock.journal + ir.actions.act_window + form + + + diff --git a/addons/stock_location/mrp_pull.py b/addons/stock_location/mrp_pull.py index e20f75f07f5..a8a5026bf4c 100644 --- a/addons/stock_location/mrp_pull.py +++ b/addons/stock_location/mrp_pull.py @@ -70,6 +70,7 @@ class procurement_order(osv.osv): 'origin': origin, 'company_id': line.company_id and line.company_id.id or False, 'type': line.picking_type, + 'stock_journal_id': line.journal_id and line.journal_id.id or False, 'move_type': 'one', 'address_id': line.partner_address_id.id, 'note': line.name, # TODO: note on procurement ? @@ -124,8 +125,5 @@ class procurement_order(osv.osv): {'location_id':proc.location_id.id}) self.write(cr, uid, [proc.id], {'state':'running','message':_('Moved from other location')}) - return False - - procurement_order() diff --git a/addons/stock_location/stock.py b/addons/stock_location/stock.py index 4aa4a1999ed..f3460fa7e30 100644 --- a/addons/stock_location/stock.py +++ b/addons/stock_location/stock.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -30,6 +30,7 @@ class stock_location_path(osv.osv): 'name': fields.char('Operation', size=64), 'company_id': fields.many2one('res.company', 'Company'), 'product_id' : fields.many2one('product.product', 'Products', ondelete='cascade', select=1), + 'journal_id': fields.many2one('stock.journal','Journal'), 'location_from_id' : fields.many2one('stock.location', 'Source Location', ondelete='cascade', select=1), 'location_dest_id' : fields.many2one('stock.location', 'Destination Location', ondelete='cascade', select=1), 'delay': fields.integer('Delay (days)', help="Number of days to do this transition"), @@ -64,6 +65,7 @@ class product_pulled_flow(osv.osv): 'cancel_cascade': fields.boolean('Cancel Cascade', help="Allow you to cancel moves related to the product pull flow"), 'location_id': fields.many2one('stock.location','Location', required=True, help="Is the destination location that needs supplying"), 'location_src_id': fields.many2one('stock.location','Location Source', help="Location used by Destination Location to supply"), + 'journal_id': fields.many2one('stock.journal','Journal'), '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 re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."), 'type_proc': fields.selection([('produce','Produce'),('buy','Buy'),('move','Move')], 'Type of Procurement', required=True), 'company_id': fields.many2one('res.company', 'Company', help="Is used to know to which company belong packings and moves"), @@ -115,7 +117,7 @@ class stock_location(osv.osv): if product: for path in product.path_ids: if path.location_from_id.id == location.id: - return path.location_dest_id, path.auto, path.delay + return path.location_dest_id, path.auto, path.delay, path.journal_id.id return super(stock_location, self).chained_location_get(cr, uid, location, partner, product, context) stock_location() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: