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 = {
<?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
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 = {
_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 = {
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")
+ }
<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>
<?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>
</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>
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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:
+++ /dev/null
-# -*- 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:
+++ /dev/null
-<?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
+++ /dev/null
-# -*- 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:
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>