From 10079e63a2e7698e8f74883ef46c45cf14d12fd2 Mon Sep 17 00:00:00 2001 From: Aline Preillon Date: Tue, 15 Jun 2010 09:45:32 +0200 Subject: [PATCH 01/21] [FIX] project_planning: correct view bzr revid: aline@aline-laptop-20100615074532-3wgsrsjdubvl2xmi --- addons/project_planning/project_planning_view.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/project_planning/project_planning_view.xml b/addons/project_planning/project_planning_view.xml index d7d2880714c..1d55d9db6c4 100644 --- a/addons/project_planning/project_planning_view.xml +++ b/addons/project_planning/project_planning_view.xml @@ -164,10 +164,10 @@ - - - - + + + + From 536a51efbb093283c05a2b9b3b4487d53d2aaea0 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 15 Jun 2010 10:14:32 +0200 Subject: [PATCH 02/21] 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: From dd20f9ff47ad8e373ffadf608f15a323bcbe6e55 Mon Sep 17 00:00:00 2001 From: "nel@tinyerp.com" <> Date: Tue, 15 Jun 2010 10:46:44 +0200 Subject: [PATCH 03/21] [ADD] stock: packing report bzr revid: nel@tinyerp.com-20100615084644-5qdod7k6vg7c79ty --- addons/product_expiry/__terp__.py | 2 +- addons/product_expiry/wizard/stock_partial.py | 8 + .../wizard/stock_partial_view.xml | 19 ++ addons/stock/__openerp__.py | 1 + addons/stock/report/packing.rml | 317 ++++++++++++++++++ addons/stock/report/picking.py | 1 + addons/stock/stock.py | 3 +- addons/stock/stock_report.xml | 1 + addons/stock/stock_view.xml | 91 +++-- addons/stock/wizard/__init__.py | 1 + 10 files changed, 409 insertions(+), 35 deletions(-) create mode 100644 addons/product_expiry/wizard/stock_partial_view.xml create mode 100644 addons/stock/report/packing.rml diff --git a/addons/product_expiry/__terp__.py b/addons/product_expiry/__terp__.py index 1983088a484..2e44f2c6462 100644 --- a/addons/product_expiry/__terp__.py +++ b/addons/product_expiry/__terp__.py @@ -31,7 +31,7 @@ - removal date - alert date Used, for example, in food industries.''', - "update_xml" : ["product_expiry_view.xml", "report/report_stock_view.xml"], + "update_xml" : ["product_expiry_view.xml", "report/report_stock_view.xml", "wizard/stock_partial_view.xml"], "active": False, "installable": True } diff --git a/addons/product_expiry/wizard/stock_partial.py b/addons/product_expiry/wizard/stock_partial.py index 4edb01073e7..bc44628078c 100644 --- a/addons/product_expiry/wizard/stock_partial.py +++ b/addons/product_expiry/wizard/stock_partial.py @@ -62,3 +62,11 @@ class stock_partial_lot_picking(osv.osv_memory): return res stock_partial_lot_picking() +class stock_move_split_lines_exist(osv.osv_memory): + _name = "stock.move.split.lines.exist" + _inherit = "stock.move.split.lines.exist" + _columns = { + 'date': fields.date('Date'), + } + +stock_move_split_lines_exist() diff --git a/addons/product_expiry/wizard/stock_partial_view.xml b/addons/product_expiry/wizard/stock_partial_view.xml new file mode 100644 index 00000000000..fabc531cf14 --- /dev/null +++ b/addons/product_expiry/wizard/stock_partial_view.xml @@ -0,0 +1,19 @@ + + + + + + Split in lots + stock.move.split + form + + + + + + + + + + + diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 32adb5e84d2..f0a03f9f2a5 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -50,6 +50,7 @@ Thanks to the double entry management, the inventory controlling is powerful and "wizard/stock_invoice_onshipping_view.xml", "wizard/stock_inventory_merge_view.xml", "wizard/stock_location_product_view.xml", + "wizard/stock_splitinto_view.xml", "wizard/stock_inventory_line_split_view.xml", "wizard/stock_change_standard_price_view.xml", "wizard/stock_traceability_view.xml", diff --git a/addons/stock/report/packing.rml b/addons/stock/report/packing.rml new file mode 100644 index 00000000000..c2cceb26238 --- /dev/null +++ b/addons/stock/report/packing.rml @@ -0,0 +1,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects,'picking') ]] + + + + + + + + + + + + [[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]] + [[ picking.address_id and picking.address_id.street or '' ]] + [[ picking.address_id and picking.address_id.zip or '' ]] [[ picking.address_id and picking.address_id.city or '']] + + + + + + + + + + + + + + + + + [[ picking.sale_id and picking.sale_id.partner_shipping_id and 'Shipping Address :' or removeParentNode('para') ]] + [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] + [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.street) or '' ]] + [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.zip) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.city) or '' ]] [[ (picking.address_id and picking.address_id.state_id and picking.address_id.state_id.name) or '' ]] + [[ (picking.address_id and picking.address_id.country_id and picking.address_id.country_id.name) or '' ]] + + + + + + + + + + + + + + + + Packing List: [[ picking.name ]] + + + + + + + + + + + + + Order(Origin) + + + Recipient + + + Expected Shipping Date + + + Weight + + + + + + + [[ picking.origin ]] + + + [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] + + + [[ formatLang(picking.min_date,date_time = True) ]] + + + [[ 'weight' in picking._columns.keys() and picking.weight or '']] + + + + + + + + + + Description + + + Tracking Lot + + + Lot + + + State + + + Quantity + + + Location + + + + + + + + + +
+ [[ repeatIn([line for line in picking.move_lines if (line.state == 'assigned' )],'move_lines') ]] + + + + [ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']] + + + [[ move_lines.tracking_id and move_lines.tracking_id.name or '' ]] + + + [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]] + + + [[ move_lines.state ]] + + + [[ move_lines.product_qty ]] + + + [[ move_lines.product_uom.name ]] + + + [[ (move_lines.location_id and move_lines.location_id.name) or '' ]] + + + + + + +
+ [[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]] + Non Assigned Products: [[ ( line.state == 'assigned' or line.state == 'done' or line.state == 'confirmed' ) and removeParentNode('para') ]] + [[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]] +
+ [[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]] + + + + [ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']] + + + [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]] + + + [[ move_lines.state ]] + + + [[ move_lines.product_qty ]] + + + [[ move_lines.product_uom.name ]] + + + [[ (move_lines.location_id and move_lines.location_id.name) or '' ]] + + + + + + +
+ + + + + + +
+
diff --git a/addons/stock/report/picking.py b/addons/stock/report/picking.py index 8ab08a5016c..4dcbac4b9a0 100644 --- a/addons/stock/report/picking.py +++ b/addons/stock/report/picking.py @@ -32,4 +32,5 @@ class picking(report_sxw.rml_parse): }) report_sxw.report_sxw('report.stock.picking.list','stock.picking','addons/stock/report/picking.rml',parser=picking) +report_sxw.report_sxw('report.stock.packing.list','stock.picking','addons/stock/report/packing.rml',parser=picking) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d6d3a23efa7..eefd359ab39 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1392,7 +1392,8 @@ class stock_move(osv.osv): move_list = self.pool.get('stock.move').read(cr, uid, context['move_line'][0], ['location_dest_id']) return move_list and move_list['location_dest_id'][0] or False if context.get('address_out_id', False): - return self.pool.get('res.partner.address').browse(cr, uid, context['address_out_id'], context).partner_id.property_stock_customer.id + property_out = self.pool.get('res.partner.address').browse(cr, uid, context['address_out_id'], context).partner_id.property_stock_customer + return property_out and property_out.id or False return False def _default_location_source(self, cr, uid, context={}): diff --git a/addons/stock/stock_report.xml b/addons/stock/stock_report.xml index 3084e8527a7..547ed785cd1 100644 --- a/addons/stock/stock_report.xml +++ b/addons/stock/stock_report.xml @@ -3,6 +3,7 @@ + diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 0e26df8bdf9..f9ac9622d56 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -313,6 +313,7 @@ + @@ -336,6 +337,7 @@ + @@ -616,7 +618,7 @@
- + @@ -624,6 +626,7 @@ + @@ -662,9 +665,12 @@ domain="[('product_id','=?',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/> +