From d86e8623a3131b32329f2b08377db250421d7824 Mon Sep 17 00:00:00 2001 From: jke-openerp Date: Tue, 8 Oct 2013 16:32:31 +0200 Subject: [PATCH] merge sale stock loc bzr revid: jke@openerp.com-20131008143231-6l30g8z2bju8z4cu --- addons/sale_stock/res_config.py | 3 + addons/sale_stock/res_config_view.xml | 8 ++- addons/sale_stock/sale_stock.py | 13 ++++ addons/sale_stock/sale_stock_view.xml | 29 +++++++++ .../security/sale_stock_security.xml | 17 +++-- addons/sale_stock/stock_view.xml | 26 ++++++++ addons/sale_stock_location/__init__.py | 25 -------- addons/sale_stock_location/__openerp__.py | 47 -------------- addons/sale_stock_location/res_config.py | 35 ---------- .../sale_stock_location/res_config_view.xml | 22 ------- .../sale_stock_location.py | 63 ------------------ .../sale_stock_location_view.xml | 64 ------------------- .../security/sale_stock_location_security.xml | 11 ---- 13 files changed, 87 insertions(+), 276 deletions(-) delete mode 100644 addons/sale_stock_location/__init__.py delete mode 100644 addons/sale_stock_location/__openerp__.py delete mode 100644 addons/sale_stock_location/res_config.py delete mode 100644 addons/sale_stock_location/res_config_view.xml delete mode 100644 addons/sale_stock_location/sale_stock_location.py delete mode 100644 addons/sale_stock_location/sale_stock_location_view.xml delete mode 100644 addons/sale_stock_location/security/sale_stock_location_security.xml diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py index ed815e89537..cbc1c61c394 100644 --- a/addons/sale_stock/res_config.py +++ b/addons/sale_stock/res_config.py @@ -52,6 +52,9 @@ class sale_configuration(osv.osv_memory): help="Allows you to tag sales order lines with properties."), 'module_project_timesheet': fields.boolean("Project Timesheet"), 'module_project_mrp': fields.boolean("Project MRP"), + 'group_route_so_lines': fields.boolean('Choose MTO, Dropship, ... on sale order lines', + implied_group='sale_stock.group_route_so_lines', + help="Allows you to set route on sale order lines."), } _defaults = { diff --git a/addons/sale_stock/res_config_view.xml b/addons/sale_stock/res_config_view.xml index 93bc8e5980e..e7b32c0866d 100644 --- a/addons/sale_stock/res_config_view.xml +++ b/addons/sale_stock/res_config_view.xml @@ -1,7 +1,6 @@ - sale settings sale.config.settings @@ -68,9 +67,14 @@ + +
+ +
+
-
\ No newline at end of file diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 9f45bf0be59..37444de7713 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -89,6 +89,11 @@ class sale_order(osv.osv): vals = super(sale_order, self)._prepare_order_line_procurement(cr, uid, order, line, group_id=group_id, context=context) location_id = order.partner_shipping_id.property_stock_customer.id vals['location_id'] = location_id + + routes = [] + routes += order.warehouse_id and [(4, x.id) for x in order.warehouse_id.route_ids] or [] #route_ids + routes += line.route_id and [(4, line.route_id.id)] or [] #route_id + vals['route_ids'] = routes return vals _columns = { @@ -251,6 +256,7 @@ class sale_order_line(osv.osv): _columns = { 'product_packaging': fields.many2one('product.packaging', 'Packaging'), 'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'), + 'route_id': fields.many2one('stock.location.route', 'Route', domain=[('sale_selectable', '=', True)]), } _defaults = { @@ -402,3 +408,10 @@ class stock_move(osv.osv): res['price_unit'] = sale_line.price_unit res['discount'] = sale_line.discount return res + + +class stock_location_route(osv.osv): + _inherit = "stock.location.route" + _columns = { + 'sale_selectable':fields.boolean("Selectable on Sales Order Line") + } diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml index e786f32e583..1ad8193c0fb 100644 --- a/addons/sale_stock/sale_stock_view.xml +++ b/addons/sale_stock/sale_stock_view.xml @@ -71,6 +71,12 @@ + + + + + + @@ -115,5 +121,28 @@ + + sale.order.line.form.sale.stock.location + sale.order.line + + + + + + + + + + + + sale.order.line.tree.sale.stock.location + + sale.order.line + + + + + + diff --git a/addons/sale_stock/security/sale_stock_security.xml b/addons/sale_stock/security/sale_stock_security.xml index 7f93084d43d..0f70053cd7c 100644 --- a/addons/sale_stock/security/sale_stock_security.xml +++ b/addons/sale_stock/security/sale_stock_security.xml @@ -1,11 +1,14 @@ - - - - Enable Invoicing Delivery orders - - - + + + Enable Invoicing Delivery orders + + + + + Enable Route on Sales Order Line + + diff --git a/addons/sale_stock/stock_view.xml b/addons/sale_stock/stock_view.xml index 9091787a7af..0f5898e3016 100644 --- a/addons/sale_stock/stock_view.xml +++ b/addons/sale_stock/stock_view.xml @@ -15,6 +15,32 @@ + + + + + + + stock.location.route.form + + stock.location.route + + + + + + + + stock.location.route.tree.inherit + + stock.location.route + + + + + + + diff --git a/addons/sale_stock_location/__init__.py b/addons/sale_stock_location/__init__.py deleted file mode 100644 index 488ab65e79f..00000000000 --- a/addons/sale_stock_location/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# 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 . -# -############################################################################## - -import sale_stock_location -import res_config - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/sale_stock_location/__openerp__.py b/addons/sale_stock_location/__openerp__.py deleted file mode 100644 index 092b5d9bc74..00000000000 --- a/addons/sale_stock_location/__openerp__.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# 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 . -# -############################################################################## - -{ - 'name': 'Sales and Warehouse and Route Management', - 'version': '1.0', - 'category': 'Hidden', - 'summary': 'Quotation, Sale Orders, Delivery & Invoicing Control', - 'description': """ -Manage sales quotations and stock_location -========================================== - -This adds a route on the sales order and sales order line (mini module) - -""", - 'author': 'OpenERP SA', - 'website': 'http://www.openerp.com', - 'images': [], - 'depends': ['sale', 'stock'], - 'init_xml': [], - 'update_xml': ['sale_stock_location_view.xml', - 'security/sale_stock_location_security.xml', - 'res_config_view.xml'], - 'demo_xml': [], - 'test': [], - 'installable': True, - 'auto_install': True, -} -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale_stock_location/res_config.py b/addons/sale_stock_location/res_config.py deleted file mode 100644 index dc2e0f3df8f..00000000000 --- a/addons/sale_stock_location/res_config.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Business Applications -# Copyright (C) 2004-2012 OpenERP S.A. (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# 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 . -# -############################################################################## - -from openerp.osv import fields, osv -from openerp.tools.translate import _ - -class sale_configuration(osv.osv_memory): - _inherit = 'sale.config.settings' - - _columns = { - 'group_route_so_lines': fields.boolean('Choose MTO, Dropship, ... on sale order lines', - implied_group='sale_stock_location.group_route_so_lines', - help="Allows you to set route on sale order lines."), - } - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale_stock_location/res_config_view.xml b/addons/sale_stock_location/res_config_view.xml deleted file mode 100644 index 93fc93ac27c..00000000000 --- a/addons/sale_stock_location/res_config_view.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - sale stock location settings - sale.config.settings - - - - -
- -
-
-
-
-
- -
-
\ No newline at end of file diff --git a/addons/sale_stock_location/sale_stock_location.py b/addons/sale_stock_location/sale_stock_location.py deleted file mode 100644 index 4107af9e261..00000000000 --- a/addons/sale_stock_location/sale_stock_location.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, - -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# 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 . -# -############################################################################## -from datetime import datetime, timedelta -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare -from dateutil.relativedelta import relativedelta -from openerp.osv import fields, osv -from openerp.tools.translate import _ - - -class sale_order(osv.osv): - _inherit = "sale.order" - - - def _prepare_order_line_procurement(self, cr, uid, order, line, group_id=False, context=None): - ''' - Add route_ids to the procurement. As such, people should choose between them. - ''' - res = super(sale_order, self)._prepare_order_line_procurement(cr, uid, order, line, group_id=group_id, context=context) - routes = [] - route_ids = order.warehouse_id and [(4, x.id) for x in order.warehouse_id.route_ids] or [] - routes += route_ids - route_id = line.route_id and [(4, line.route_id.id)] or [] - routes += route_id - res.update({ - 'route_ids': routes - }) - return res - -class sale_order_line(osv.osv): - _inherit = 'sale.order.line' - _columns = { - 'route_id': fields.many2one('stock.location.route', 'Route', domain=[('sale_selectable', '=', True)]), - } - - -class stock_location_route(osv.osv): - _inherit = "stock.location.route" - _columns = { - 'sale_selectable':fields.boolean("Selectable on Sales Order Line") - } - - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale_stock_location/sale_stock_location_view.xml b/addons/sale_stock_location/sale_stock_location_view.xml deleted file mode 100644 index 82b8e976fb7..00000000000 --- a/addons/sale_stock_location/sale_stock_location_view.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - sale.order.line.form.sale.stock.location - sale.order.line - - - - - - - - - - - - sale.order.line.tree.sale.stock.location - - sale.order.line - - - - - - - - sale.order.form - - sale.order - - - - - - - - - - - - stock.location.route.form - - stock.location.route - - - - - - - - stock.location.route.tree.inherit - - stock.location.route - - - - - - - - - diff --git a/addons/sale_stock_location/security/sale_stock_location_security.xml b/addons/sale_stock_location/security/sale_stock_location_security.xml deleted file mode 100644 index 4114242054c..00000000000 --- a/addons/sale_stock_location/security/sale_stock_location_security.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Enable Route on Sales Order Line - - - - -