Skip to content

Commit

Permalink
[ADD] sale_exception_nostock_by_line module
Browse files Browse the repository at this point in the history
(../trunk-generic/ rev 29.1.21)
  • Loading branch information
jgrandguillaume committed Nov 1, 2013
1 parent e35b0f6 commit 00f4b19
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 0 deletions.
22 changes: 22 additions & 0 deletions sale_exception_nostock_by_line/__init__.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import model
51 changes: 51 additions & 0 deletions sale_exception_nostock_by_line/__openerp__.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################

{'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,
}
22 changes: 22 additions & 0 deletions sale_exception_nostock_by_line/model/__init__.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import sale
32 changes: 32 additions & 0 deletions sale_exception_nostock_by_line/model/sale.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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

0 comments on commit 00f4b19

Please sign in to comment.