forked from OCA/stock-logistics-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] stock_lot_scrap: Migration to 11.0
- Loading branch information
1 parent
8624d84
commit eb70f0d
Showing
13 changed files
with
526 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
===== | ||
|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
|
@@ -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,' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import stock_scrap_lot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
|
@@ -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' | ||
|
||
|
@@ -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, | ||
} | ||
|
||
|
@@ -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), | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Go to *Inventory > Configuration > Settings > Traceability*. | ||
* Enable *Lots & Serial Numbers*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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* |
Oops, something went wrong.