Skip to content

Commit

Permalink
[MIG] stock_lot_scrap: Migration to 11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cubells authored and carolinafernandez-tecnativa committed Jan 5, 2024
1 parent 8624d84 commit eb70f0d
Show file tree
Hide file tree
Showing 13 changed files with 526 additions and 48 deletions.
84 changes: 58 additions & 26 deletions stock_lot_scrap/README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==================
Scrap Complete Lot
==================
====================
Scrap Production Lot
====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/11.0/stock_lot_scrap
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-11-0/stock-logistics-workflow-11-0-stock_lot_scrap
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/154/11.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a button in *Production Lot/Serial Number* view form to
*Scrap* all quants contained.

**Table of contents**

.. contents::
:local:

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

* Go to *Inventory > Configuration > Settings*.
* Enable *Track lots or serial numbers*.
* Go to *Inventory > Configuration > Settings > Traceability*.
* Enable *Lots & Serial Numbers*.

Usage
=====
Expand All @@ -22,39 +46,47 @@ Usage
view form mode.
* Click button *Scrap*

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/154/10.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/
stock-logistics-workflow/issues>`_.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_lot_scrap%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
------------
* Carlos Dauden <[email protected]>
* Pedro M. Baeza <[email protected]>
* David Vidal <[email protected]>
~~~~~~~~~~~~

Maintainer
----------
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Dauden <[email protected]>
* Pedro M. Baeza <[email protected]>
* David Vidal <[email protected]>
* Vicent Cubells <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://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 https://odoo-community.org.
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/11.0/stock_lot_scrap>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 0 additions & 2 deletions stock_lot_scrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# -*- coding: utf-8 -*-

from . import models
3 changes: 1 addition & 2 deletions stock_lot_scrap/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Carlos Dauden <[email protected]>
# Copyright 2016 Pedro M. Baeza <[email protected]>
# Copyright 2017 David Vidal <[email protected]>
Expand All @@ -7,7 +6,7 @@
'name': 'Scrap Production Lot',
'summary': 'This module adds a button in Production Lot/Serial Number '
'view form to Scrap all products contained.',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'category': 'Stock',
'license': 'AGPL-3',
'author': 'Tecnativa,'
Expand Down
21 changes: 17 additions & 4 deletions stock_lot_scrap/i18n/stock_lot_scrap.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,48 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-02 12:04+0000\n"
"PO-Revision-Date: 2018-10-02 12:04+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: stock_lot_scrap
#: code:addons/stock_lot_scrap/models/stock_scrap_lot.py:18
#, python-format
msgid "Lot was scrapped by <b>%s</b>."
msgstr ""

#. module: stock_lot_scrap
#: model:ir.model,name:stock_lot_scrap.model_stock_production_lot
msgid "Lot/Serial"
msgstr ""

#. module: stock_lot_scrap
#: code:addons/stock_lot_scrap/models/stock_scrap_lot.py:40
#: code:addons/stock_lot_scrap/models/stock_scrap_lot.py:50
#, python-format
msgid "Scrap"
msgstr ""

#. module: stock_lot_scrap
#: code:addons/stock_lot_scrap/models/stock_scrap_lot.py:67
#: code:addons/stock_lot_scrap/models/stock_scrap_lot.py:76
#, python-format
msgid "This lot doesn't contain any quant in internal location."
msgstr ""

#. module: stock_lot_scrap
#: code:addons/stock_lot_scrap/models/stock_scrap_lot.py:38
#: code:addons/stock_lot_scrap/models/stock_scrap_lot.py:48
#, python-format
msgid "This will scrap the whole lot. Are you sure you want to continue?"
msgstr ""

#. module: stock_lot_scrap
#: model:ir.model,name:stock_lot_scrap.model_stock_scrap
msgid "stock.scrap"
msgstr ""

2 changes: 0 additions & 2 deletions stock_lot_scrap/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# -*- coding: utf-8 -*-

from . import stock_scrap_lot
18 changes: 13 additions & 5 deletions stock_lot_scrap/models/stock_scrap_lot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Carlos Dauden <[email protected]>
# Copyright 2016 Pedro M. Baeza <[email protected]>
# Copyright 2017 David Vidal <[email protected]>
Expand All @@ -9,6 +8,17 @@
from lxml import etree


class StockScrap(models.Model):
_inherit = 'stock.scrap'

@api.multi
def action_validate(self):
self.ensure_one()
self.lot_id.message_post(
body=_("Lot was scrapped by <b>%s</b>.") % self.env.user.name)
return super(StockScrap, self).action_validate()


class StockProductionLot(models.Model):
_inherit = 'stock.production.lot'

Expand Down Expand Up @@ -48,11 +58,10 @@ def _prepare_scrap_vals(self, quant, scrap_location_id):
'origin': quant.lot_id.name,
'product_id': quant.product_id.id,
'product_uom_id': quant.product_id.uom_id.id,
'scrap_qty': quant.qty,
'scrap_qty': quant.quantity,
'location_id': quant.location_id.id,
'scrap_location_id': scrap_location_id,
'lot_id': self.id,
'picking_id': quant.history_ids[-1:].picking_id.id,
'package_id': quant.package_id.id,
}

Expand All @@ -69,8 +78,7 @@ def action_scrap_lot(self):
scrap_obj = self.env['stock.scrap']
scraps = scrap_obj.browse()
scrap_location_id = self.env.ref('stock.stock_location_scrapped').id
for quant in quants.sorted(key=lambda x: x.history_ids[-1:].
picking_id.picking_type_id.warehouse_id.id):
for quant in quants:
scrap = scrap_obj.create(
self._prepare_scrap_vals(quant, scrap_location_id),
)
Expand Down
2 changes: 2 additions & 0 deletions stock_lot_scrap/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Go to *Inventory > Configuration > Settings > Traceability*.
* Enable *Lots & Serial Numbers*.
6 changes: 6 additions & 0 deletions stock_lot_scrap/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Dauden <[email protected]>
* Pedro M. Baeza <[email protected]>
* David Vidal <[email protected]>
* Vicent Cubells <[email protected]>
2 changes: 2 additions & 0 deletions stock_lot_scrap/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds a button in *Production Lot/Serial Number* view form to
*Scrap* all quants contained.
3 changes: 3 additions & 0 deletions stock_lot_scrap/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Go to *Inventory > Inventory Control > Serial Numbers / Lots*, and enter in
view form mode.
* Click button *Scrap*
Loading

0 comments on commit eb70f0d

Please sign in to comment.