diff --git a/sale_exception_nostock_by_line/__init__.py b/sale_exception_nostock_by_line/__init__.py new file mode 100644 index 00000000000..643bee7abed --- /dev/null +++ b/sale_exception_nostock_by_line/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright 2013 Camptocamp SA +# +# 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 . import model diff --git a/sale_exception_nostock_by_line/__openerp__.py b/sale_exception_nostock_by_line/__openerp__.py new file mode 100644 index 00000000000..2b7f3ed265f --- /dev/null +++ b/sale_exception_nostock_by_line/__openerp__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Joel Grand-Guillaume +# Copyright 2013 Camptocamp SA +# +# 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': 'Sale No stock by line', + 'version': '0.1', + 'author': 'Camptocamp', + 'category': 'Warehouse', + 'license': 'AGPL-3', + 'complexity': 'expert', + 'images': [], + 'website': "http://www.camptocamp.com", + 'description': """ +Sale No stock by line +===================== + +This module depends on both sale_exception_nostock and sale_sourced_by_line and make the +exception occure based on the location of each line. + +The principle of the no-stock exception is to raise a warning when no enough stock are +gound in the location of the SO shop. This module make the warning occure for every line +location instead of looking at the shop location for all line. + +""", + 'depends': [ + 'sale_exception_nostock', + 'sale_sourced_by_line', + ], + 'demo': [], + 'data': [], + 'test': [], + 'auto_install': False, + 'installable': True, + } diff --git a/sale_exception_nostock_by_line/model/__init__.py b/sale_exception_nostock_by_line/model/__init__.py new file mode 100644 index 00000000000..d65199e72a4 --- /dev/null +++ b/sale_exception_nostock_by_line/model/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright 2013 Camptocamp SA +# +# 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 . import sale diff --git a/sale_exception_nostock_by_line/model/sale.py b/sale_exception_nostock_by_line/model/sale.py new file mode 100644 index 00000000000..b215e3866fa --- /dev/null +++ b/sale_exception_nostock_by_line/model/sale.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Joel Grand-Guillaume +# Copyright 2013 Camptocamp SA +# +# 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 orm + + +class sale_order_line(orm.Model): + """Override the _get_line_location method to look at the right + one for every line instead of taking the shop location for all.""" + + _inherit = "sale.order.line" + + def _get_line_location(self, line_br, context=None): + return line_br.location_id.id +