diff --git a/stock_picking_returned_qty/README.rst b/stock_picking_returned_qty/README.rst new file mode 100644 index 000000000..22318843a --- /dev/null +++ b/stock_picking_returned_qty/README.rst @@ -0,0 +1,70 @@ +.. |company| replace:: ADHOC SA + +.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png + :alt: ADHOC SA + :target: https://www.adhoc.com.ar + +.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png + +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +=============================== +Stock Picking Returned Quantity +=============================== + +Calculates the quantity to deliver in the sale order taking into account the returned quantity + +Installation +============ + +To install this module, you need to: + +#. Just install this module. + +Configuration +============= + +To configure this module, you need to: + +#. No configuration nedeed. + +Usage +===== + +To use this module, you need to: + +#. Go to ... + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: http://runbot.adhoc.com.ar/ + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* |company| |icon| + +Contributors +------------ + +Maintainer +---------- + +|company_logo| + +This module is maintained by the |company|. + +To contribute to this module, please visit https://www.adhoc.com.ar. diff --git a/stock_picking_returned_qty/__init__.py b/stock_picking_returned_qty/__init__.py new file mode 100644 index 000000000..d03377692 --- /dev/null +++ b/stock_picking_returned_qty/__init__.py @@ -0,0 +1,5 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from . import models diff --git a/stock_picking_returned_qty/__manifest__.py b/stock_picking_returned_qty/__manifest__.py new file mode 100644 index 000000000..05b1c1e79 --- /dev/null +++ b/stock_picking_returned_qty/__manifest__.py @@ -0,0 +1,41 @@ +############################################################################## +# +# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) +# All Rights Reserved. +# +# 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': 'Stock Picking Returned Quantity', + 'version': "17.0.1.0.0", + 'category': 'Warehouse Management', + 'sequence': 14, + 'summary': '', + 'author': 'ADHOC SA', + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'images': [ + ], + 'depends': [ + 'stock_ux', + ], + 'data': [ + ], + 'demo': [ + ], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/stock_picking_returned_qty/models/__init__.py b/stock_picking_returned_qty/models/__init__.py new file mode 100644 index 000000000..0c1dc32ba --- /dev/null +++ b/stock_picking_returned_qty/models/__init__.py @@ -0,0 +1,5 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from . import stock_move diff --git a/stock_picking_returned_qty/models/stock_move.py b/stock_picking_returned_qty/models/stock_move.py new file mode 100644 index 000000000..31d55fc7c --- /dev/null +++ b/stock_picking_returned_qty/models/stock_move.py @@ -0,0 +1,17 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from odoo import models, fields, api + + +class StockMove(models.Model): + _inherit = 'stock.move' + + @api.model_create_multi + def create(self, vals_list): + if vals_list and vals_list[0].get('picking_type_id') and self.env['stock.picking.type'].browse(vals_list[0]['picking_type_id']).code == 'outgoing': + sale_line_qty_ret = self.env['sale.order.line'].browse(vals_list[0]['sale_line_id']).quantity_returned + vals_list[0]['product_uom_qty'] -= sale_line_qty_ret + res = super().create(vals_list) + return res