merge sale stock loc
authorjke-openerp <jke@openerp.com>
Tue, 8 Oct 2013 14:32:31 +0000 (16:32 +0200)
committerjke-openerp <jke@openerp.com>
Tue, 8 Oct 2013 14:32:31 +0000 (16:32 +0200)
bzr revid: jke@openerp.com-20131008143231-6l30g8z2bju8z4cu

13 files changed:
addons/sale_stock/res_config.py
addons/sale_stock/res_config_view.xml
addons/sale_stock/sale_stock.py
addons/sale_stock/sale_stock_view.xml
addons/sale_stock/security/sale_stock_security.xml
addons/sale_stock/stock_view.xml
addons/sale_stock_location/__init__.py [deleted file]
addons/sale_stock_location/__openerp__.py [deleted file]
addons/sale_stock_location/res_config.py [deleted file]
addons/sale_stock_location/res_config_view.xml [deleted file]
addons/sale_stock_location/sale_stock_location.py [deleted file]
addons/sale_stock_location/sale_stock_location_view.xml [deleted file]
addons/sale_stock_location/security/sale_stock_location_security.xml [deleted file]

index ed815e8..cbc1c61 100644 (file)
@@ -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 = {
index 93bc8e5..e7b32c0 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
     <data>
-    
          <record id="view_sales_config_sale_stock" model="ir.ui.view">
              <field name="name">sale settings</field>
              <field name="model">sale.config.settings</field>
                              <field name="time_unit" domain="[('category_id.name','=','Working Time')]" class="oe_inline"/>
                          </div>
                      </xpath>
+                     <xpath expr="//div[@name='Sale Features']" position="inside">
+                         <div>
+                              <field name="group_route_so_lines" class="oe_inline"/>
+                              <label for="group_route_so_lines"/>
+                         </div>
+                     </xpath>
                 </data>
              </field>
          </record>
-
     </data>
 </openerp>
\ No newline at end of file
index 9f45bf0..37444de 100644 (file)
@@ -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")
+        }
index e786f32..1ad8193 100644 (file)
                             <field name="order_policy"/>
                         </group>
                    </xpath>
+                   <xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before">
+                        <field name="route_id" groups="sale_stock_location.group_route_so_lines"/>
+                   </xpath>
+                   <xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="before">
+                       <field name="route_id" groups="sale_stock_location.group_route_so_lines"/>
+                   </xpath>
                 </data>
            </field>
         </record>
         </record>
 
 
+        <record id="view_order_form_inherit2" model="ir.ui.view">
+            <field name="name">sale.order.line.form.sale.stock.location</field>
+            <field name="model">sale.order.line</field>
+            <field name="inherit_id" ref="sale.view_order_line_form2"/>
+            <field name="arch" type="xml">
+                <data>
+                   <xpath expr="//field[@name='price_unit']" position="before">
+                       <field name="route_id" groups="sale_stock_location.group_route_so_lines" />
+                   </xpath>
+                </data>
+           </field>
+        </record>
+        
+        <record id="view_order_line_tree_inherit" model="ir.ui.view">
+            <field name="name">sale.order.line.tree.sale.stock.location</field>
+            <field name="inherit_id" ref="sale.view_order_line_tree"/>
+            <field name="model">sale.order.line</field>
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='price_subtotal']" position="before">
+                    <field name="route_id" groups="sale_stock_location.group_route_so_lines"/>
+                </xpath>
+            </field>
+        </record>
     </data>
 </openerp>
index 7f93084..0f70053 100644 (file)
@@ -1,11 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
-    <data noupdate="0">
-    
-    <record id="group_invoice_deli_orders" model="res.groups">
-        <field name="name">Enable Invoicing Delivery orders</field>
-        <field name="category_id" ref="base.module_category_hidden"/>
-    </record>
-    
+    <data noupdate="0">    
+        <record id="group_invoice_deli_orders" model="res.groups">
+            <field name="name">Enable Invoicing Delivery orders</field>
+            <field name="category_id" ref="base.module_category_hidden"/>
+        </record>
+        
+        <record id="group_route_so_lines" model="res.groups">
+            <field name="name">Enable Route on Sales Order Line</field>
+            <field name="category_id" ref="base.module_category_hidden"/>
+        </record>
     </data>
 </openerp>
index 9091787..0f5898e 100644 (file)
         </record>
         <menuitem id="base.menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="5"/>
         <menuitem action="outgoing_picking_list_to_invoice" id="menu_action_picking_list_to_invoice" parent="base.menu_invoiced" groups="sale_stock.group_invoice_deli_orders" sequence="20"/>
+        
+
+        
+    
+        
+        <record id="stock_location_route_form_view_inherit" model="ir.ui.view">
+            <field name="name">stock.location.route.form</field>
+            <field name="inherit_id" ref="stock.stock_location_route_form_view"/>
+            <field name="model">stock.location.route</field>
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='warehouse_selectable']" position="after">
+                    <field name="sale_selectable" string="Sale Order Lines"/>
+                </xpath>
+            </field>
+        </record>
+        <record id="stock_location_route_tree_inherit" model="ir.ui.view">
+            <field name="name">stock.location.route.tree.inherit</field>
+            <field name="inherit_id" ref="stock.stock_location_route_tree"/>
+            <field name="model">stock.location.route</field>
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='warehouse_selectable']" position="after">
+                    <field name="sale_selectable"/>
+                </xpath>
+            </field>
+        </record>
+
 
     </data>
 </openerp>
diff --git a/addons/sale_stock_location/__init__.py b/addons/sale_stock_location/__init__.py
deleted file mode 100644 (file)
index 488ab65..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-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 (file)
index 092b5d9..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-{
-    '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 (file)
index dc2e0f3..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Business Applications
-#    Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
-#
-#    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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-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 (file)
index 93fc93a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-    
-         <record id="view_sales_config_sale_stock_location" model="ir.ui.view">
-             <field name="name">sale stock location settings</field>
-             <field name="model">sale.config.settings</field>
-             <field name="inherit_id" ref="sale.view_sales_config"/>
-             <field name="arch" type="xml">
-                 <data>
-                     <xpath expr="//div[@name='Sale Features']" position="inside">
-                         <div>
-                              <field name="group_route_so_lines" class="oe_inline"/>
-                              <label for="group_route_so_lines"/>
-                         </div>
-                     </xpath>
-                </data>
-             </field>
-         </record>
-
-    </data>
-</openerp>
\ 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 (file)
index 4107af9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-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 (file)
index 82b8e97..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<openerp>
-    <data>
-
-        <record id="view_order_form_inherit2" model="ir.ui.view">
-            <field name="name">sale.order.line.form.sale.stock.location</field>
-            <field name="model">sale.order.line</field>
-            <field name="inherit_id" ref="sale.view_order_line_form2"/>
-            <field name="arch" type="xml">
-                <data>
-                   <xpath expr="//field[@name='price_unit']" position="before">
-                       <field name="route_id" groups="sale_stock_location.group_route_so_lines"/>
-                   </xpath>
-                </data>
-           </field>
-        </record>
-        
-        <record id="view_order_line_tree_inherit" model="ir.ui.view">
-            <field name="name">sale.order.line.tree.sale.stock.location</field>
-            <field name="inherit_id" ref="sale.view_order_line_tree"/>
-            <field name="model">sale.order.line</field>
-            <field name="arch" type="xml">
-                <xpath expr="//field[@name='price_subtotal']" position="before">
-                    <field name="route_id" groups="sale_stock_location.group_route_so_lines"/>
-                </xpath>
-            </field>
-        </record>
-        <record id="view_order_form_inherit" model="ir.ui.view">
-            <field name="name">sale.order.form</field>
-            <field name="inherit_id" ref="sale.view_order_form"/>
-            <field name="model">sale.order</field>
-            <field name="arch" type="xml">
-                <xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before">
-                    <field name="route_id" groups="sale_stock_location.group_route_so_lines"/>
-                </xpath>
-                <xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="before">
-                    <field name="route_id" groups="sale_stock_location.group_route_so_lines"/>
-                </xpath>
-            </field>
-        </record>
-        
-        <record id="stock_location_route_form_view_inherit" model="ir.ui.view">
-            <field name="name">stock.location.route.form</field>
-            <field name="inherit_id" ref="stock.stock_location_route_form_view"/>
-            <field name="model">stock.location.route</field>
-            <field name="arch" type="xml">
-                <xpath expr="//field[@name='warehouse_selectable']" position="after">
-                    <field name="sale_selectable" string="Sale Order Lines"/>
-                </xpath>
-            </field>
-        </record>
-        <record id="stock_location_route_tree_inherit" model="ir.ui.view">
-            <field name="name">stock.location.route.tree.inherit</field>
-            <field name="inherit_id" ref="stock.stock_location_route_tree"/>
-            <field name="model">stock.location.route</field>
-            <field name="arch" type="xml">
-                <xpath expr="//field[@name='warehouse_selectable']" position="after">
-                    <field name="sale_selectable"/>
-                </xpath>
-            </field>
-        </record>
-
-    </data>
-</openerp>
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 (file)
index 4114242..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data noupdate="0">
-    
-        <record id="group_route_so_lines" model="res.groups">
-            <field name="name">Enable Route on Sales Order Line</field>
-            <field name="category_id" ref="base.module_category_hidden"/>
-        </record>
-    
-    </data>
-</openerp>