Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.0] quantity warning on lot with negative number #45

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sudo: required
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove.

language: python

python:
Expand Down
22 changes: 22 additions & 0 deletions quantity_warn_on_lot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - present Savoir-faire Linux
# (<http://www.savoirfairelinux.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 . import models
45 changes: 45 additions & 0 deletions quantity_warn_on_lot/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - present Savoir-faire Linux
# (<http://www.savoirfairelinux.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/>.
#
##############################################################################
{
'name': 'Quantity warn on lot',
'version': '0.1',
'author': 'Savoir-faire Linux',
'maintainer': 'Savoir-faire Linux',
'website': 'http://www.savoirfairelinux.com',
'license': 'AGPL-3',
'category': 'Others',
'summary': 'Warnings for invalid lot quantities',
'description': """
Add a warning message when user is trying to book a stock move with a lot
number having not enough quantity available.
""",
'depends': [
'stock',
],
'external_dependencies': {
'python': [],
},
'data': [
],
'installable': True,
'application': False,
}
59 changes: 59 additions & 0 deletions quantity_warn_on_lot/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * quantity_warn_on_lot
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-15 22:11+0000\n"
"PO-Revision-Date: 2015-04-15 22:11+0000\n"
"Last-Translator: Loïc Faure-Lacroix<[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "{message}"
msgstr ""

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "Continue"
msgstr "Laisser tel quel"

#. module: quantity_warn_on_lot
#: code:addons/quantity_warn_on_lot/models/stock_move_split.py:80
#, python-format
msgid "Pressed continue button in the confirmation window"
msgstr "A cliqué sur le bouton 'laisser tel quel' dans la fenêtre de confirmation."

#. module: quantity_warn_on_lot
#: code:addons/quantity_warn_on_lot/models/stock_move_split.py:61
#, python-format
msgid "Pressed correct button in the confirmation window"
msgstr "A cliqué sur le bouton 'modifier' dans la fenêtre de confirmations."

#. module: quantity_warn_on_lot
#: code:addons/quantity_warn_on_lot/models/stock_move_split.py:133
#, python-format
msgid "The remaining amount of <b>%(product_name)s</b> in the lot <b>%(lot_number)s</b> isn't enough.The remaining amount of products in this lot number is <b>%(quantity)d</b>.Please correct your sale order"
msgstr "La quantité restante de <b>%(product_name)s</b> du lot <b>%(lot_number)s</b> n'est pas suffisante. La quantité restante dans ce numéro de lot est <b>%(quantity)d</b>. Merci de corriger votre bon de livraison."

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "Confirm move split"
msgstr "Confirmez la division du mouvement"

#. module: quantity_warn_on_lot
#: model:ir.model,name:quantity_warn_on_lot.model_stock_move_split
msgid "Split in Serial Numbers"
msgstr "Divisé en numéros de séries"

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "Correct"
msgstr "Modifier"
60 changes: 60 additions & 0 deletions quantity_warn_on_lot/i18n/quantity_warn_on_lot.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * quantity_warn_on_lot
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-15 22:11+0000\n"
"PO-Revision-Date: 2015-04-15 22:11+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "{message}"
msgstr ""

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "Continue"
msgstr ""

#. module: quantity_warn_on_lot
#: code:addons/quantity_warn_on_lot/models/stock_move_split.py:80
#, python-format
msgid "Pressed continue button in the confirmation window"
msgstr ""

#. module: quantity_warn_on_lot
#: code:addons/quantity_warn_on_lot/models/stock_move_split.py:61
#, python-format
msgid "Pressed correct button in the confirmation window"
msgstr ""

#. module: quantity_warn_on_lot
#: code:addons/quantity_warn_on_lot/models/stock_move_split.py:133
#, python-format
msgid "The remaining amount of <b>%(product_name)s</b> in the lot <b>%(lot_number)s</b> of the product isn't enough.The remaining amount of products in this lot number is <b>%(quantity)d</b>.Please correct your sale order"
msgstr ""

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "Confirm move split"
msgstr ""

#. module: quantity_warn_on_lot
#: model:ir.model,name:quantity_warn_on_lot.model_stock_move_split
msgid "Split in Serial Numbers"
msgstr ""

#. module: quantity_warn_on_lot
#: view:stock.move.split:0
msgid "Correct"
msgstr ""

22 changes: 22 additions & 0 deletions quantity_warn_on_lot/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@llacroix Copyright?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - present Savoir-faire Linux
# (<http://www.savoirfairelinux.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 . import stock_move_split
71 changes: 71 additions & 0 deletions quantity_warn_on_lot/models/stock_move_split.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@llacroix Copyright?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - present Savoir-faire Linux
# (<http://www.savoirfairelinux.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/>.
#
##############################################################################
import logging

from openerp.osv import orm
from openerp.tools.translate import _

_logger = logging.getLogger(__name__)


class StockMoveSplit(orm.TransientModel):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@llacroix In version 7.0 is more common to put wizards (models and views) in the wizard namespace (folder).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to move that in a different folder with the according views.


"""StockMoveSplit override to handle the amount of available products."""

_inherit = 'stock.move.split'

def split(self, cr, uid, ids, move_ids, context=None):
""" To split stock moves into serial numbers

:param move_ids: the ID or list of IDs of stock move we want to split
"""
if context is None:
context = {}
base_func = super(StockMoveSplit, self).split
res = base_func(cr, uid, ids, move_ids, context)
move_obj = self.pool.get('stock.move')
uom_obj = self.pool.get('product.uom')
for data in self.browse(cr, uid, ids, context=context):
for move in move_obj.browse(cr, uid, move_ids, context=context):
product_uom = move.product_uom
if data.use_exist:
lines = [l for l in data.line_exist_ids if l]
else:
lines = [l for l in data.line_ids if l]
total_move_qty = 0.0
for line in lines:
quantity = line.quantity
total_move_qty += quantity
amount_actual = uom_obj._compute_qty_obj(
cr, uid, move.product_uom,
line.prodlot_id.stock_available,
product_uom, context=context)
if (data.location_id.usage == 'internal') and \
(quantity > (amount_actual or 0.0)):
raise orm.except_orm(
_('Insufficient Stock for Serial Number !'),
_('You are moving %.2f %s but only %.2f %s '
'available for this serial number.') %
(total_move_qty, move.product_uom.name,
amount_actual, move.product_uom.name))

return res
2 changes: 1 addition & 1 deletion stock_available_immediately/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"name": "Ignore planned receptions in quantity available to promise",
"version": "2.0",
"depends": ["stock_available"],
"author": "Camptocamp",
"author": "Camptocamp,Odoo Community Association (OCA)",
"license": "AGPL-3",
"description": u"""
Ignore planned receptions in quantity available to promise
Expand Down
23 changes: 23 additions & 0 deletions stock_available_reserved_quantity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - Present Savoir-faire Linux
# (<http://www.savoirfairelinux.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 . import models
from . import report
66 changes: 66 additions & 0 deletions stock_available_reserved_quantity/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 - Present Savoir-faire Linux
# (<http://www.savoirfairelinux.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/>.
#
##############################################################################
{
'name': 'Stock available reserved quantity',
'version': '1.0',
'author': 'Savoir-faire Linux',
'category': 'Warehouse',
'depends': [
'stock'
],
'description': """\
Stock available reserved quantity
=================================

Configuration
=============

Usage
=====

Credits
=======

Contributors
------------

* Loïc Faure-Lacroix <[email protected]>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.""",
'license': 'AGPL-3',
'data': [
"views/stock_production_lot.xml",
]
}
Loading