Skip to content

Commit

Permalink
[8.0.1.0.0] stock_transfer_detail_create_lot
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Sep 25, 2018
1 parent e36a301 commit 8a18b9d
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 0 deletions.
48 changes: 48 additions & 0 deletions stock_transfer_detail_create_lot/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.. 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

==============================================
Auto Create Serial Number From Transfer Detail
==============================================



Installation
============

To install this module, you need to:

1. Clone the branch 8.0 of the repository https://github.com/open-synergy/opnsynid-stock-logistics-workflow
2. Add the path to this repository in your configuration (addons-path)
3. Update the module list
4. Go to menu *Setting -> Modules -> Local Modules*
5. Search For *Auto Create Serial Number From Transfer Detail*
6. Install the module

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

Bugs are tracked on `GitHub Issues
<https://github.com/open-synergy/opnsynid-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.


Credits
=======

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

* Andhitia Rama <andhitia.r@gmail.com>

Maintainer
----------

.. image:: https://opensynergy-indonesia.com/logo.png
:alt: OpenSynergy Indonesia
:target: https://opensynergy-indonesia.com

This module is maintained by the OpenSynergy Indonesia.
5 changes: 5 additions & 0 deletions stock_transfer_detail_create_lot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import wizards
19 changes: 19 additions & 0 deletions stock_transfer_detail_create_lot/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Auto Create Serial Number From Transfer Detail",
"version": "8.0.1.0.0",
"category": "Stock Management",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"stock_production_lot_by_product",
],
"data": [
"wizards/stock_transfer_details.xml",
],
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions stock_transfer_detail_create_lot/wizards/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import stock_transfer_details
34 changes: 34 additions & 0 deletions stock_transfer_detail_create_lot/wizards/stock_transfer_details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, api


class StockTransferDetails(models.TransientModel):
_inherit = "stock.transfer_details"

@api.multi
def button_generate_lot(self):
self.ensure_one()
for detail in self.item_ids:
detail._generate_lot()
return self.wizard_view()


class StockTransferDetailsItems(models.TransientModel):
_inherit = "stock.transfer_details_items"

@api.multi
def _generate_lot(self):
self.ensure_one()
obj_lot = self.env["stock.production.lot"]
lot = obj_lot.create(self._prepare_generate_lot())
self.write({"lot_id": lot.id})

@api.multi
def _prepare_generate_lot(self):
return {
"name": "/",
"product_id": self.product_id.id,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="stock_transfer_details_view_form" model="ir.ui.view">
<field name="name">stock.transfer_details Form</field>
<field name="model">stock.transfer_details</field>
<field name="inherit_id" ref="stock.view_stock_enter_transfer_details"/>
<field name="arch" type="xml">
<data>
<xpath expr="//group/div[@class='oe_grey']" position="after">
<button name="button_generate_lot" type="object" string="Generate Lot"/>
</xpath>
</data>
</field>
</record>
</data>
</openerp>

0 comments on commit 8a18b9d

Please sign in to comment.