Skip to content

Commit

Permalink
Merge 106d3c5 into 91df158
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Oct 17, 2018
2 parents 91df158 + 106d3c5 commit 3e4fab7
Show file tree
Hide file tree
Showing 14 changed files with 425 additions and 0 deletions.
47 changes: 47 additions & 0 deletions stock_picking_cancel_reason/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. 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

=================================
Stock Picking Cancellation Reason
=================================

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 *Stock Picking Cancellation Reason*
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
------------

* Michael Viriyananda <viriyananda.michael@gmail.com>
* 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.
6 changes: 6 additions & 0 deletions stock_picking_cancel_reason/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import wizards
from . import models
22 changes: 22 additions & 0 deletions stock_picking_cancel_reason/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- 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": "Stock Picking Cancellation Reason",
"version": "8.0.1.0.0",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"category": "Stock Management",
"license": "AGPL-3",
"installable": True,
"depends": [
"stock",
],
"data": [
"wizards/stock_picking_cancel.xml",
"views/stock_picking_cancel_reason_view.xml",
"views/stock_picking_view.xml",
"security/ir.model.access.csv"
],
}
147 changes: 147 additions & 0 deletions stock_picking_cancel_reason/i18n/stock_picking_cancel_reason.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_cancel_reason
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-17 15:21+0000\n"
"PO-Revision-Date: 2018-10-17 15:21+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_picking_cancel_reason
#: model:ir.actions.act_window,help:stock_picking_cancel_reason.stock_picking_cancel_reason_action
msgid "<p class=\"oe_view_nocontent_create\">\n"
" Click to add a Picking Cancellation Reason.\n"
" </p>\n"
" "
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel.reason,active:0
msgid "Active"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking.cancel:stock_picking_cancel_reason.stock_picking_cancel_view_form
msgid "Cancel"
msgstr ""

#. module: stock_picking_cancel_reason
#: model:ir.ui.menu,name:stock_picking_cancel_reason.stock_picking_cancel_reason_menu
msgid "Cancel Reasons"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking:stock_picking_cancel_reason.stock_picking_view_form
msgid "Cancel Transfer"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking:stock_picking_cancel_reason.stock_picking_view_form
msgid "Cancellation reason:"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking.cancel:stock_picking_cancel_reason.stock_picking_cancel_view_form
msgid "Choose the reason for the cancellation of the\n"
" picking."
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking.cancel:stock_picking_cancel_reason.stock_picking_cancel_view_form
msgid "Confirm"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel,create_uid:0
#: field:stock.picking.cancel.reason,create_uid:0
msgid "Created by"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel,create_date:0
#: field:stock.picking.cancel.reason,create_date:0
msgid "Created on"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel.reason,description:0
msgid "Description"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel,id:0
#: field:stock.picking.cancel.reason,id:0
msgid "ID"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel,write_uid:0
#: field:stock.picking.cancel.reason,write_uid:0
msgid "Last Updated by"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel,write_date:0
#: field:stock.picking.cancel.reason,write_date:0
msgid "Last Updated on"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking.cancel.reason:stock_picking_cancel_reason.stock_picking_cancel_reason_view_form
msgid "Picking Cancellation Reason"
msgstr ""

#. module: stock_picking_cancel_reason
#: model:ir.model,name:stock_picking_cancel_reason.model_stock_picking
msgid "Picking List"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking.cancel,reason_id:0
#: field:stock.picking.cancel.reason,name:0
msgid "Reason"
msgstr ""

#. module: stock_picking_cancel_reason
#: field:stock.picking,cancel_reason_id:0
msgid "Reason for cancellation"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking.cancel:stock_picking_cancel_reason.stock_picking_cancel_view_form
msgid "Reason for the cancellation"
msgstr ""

#. module: stock_picking_cancel_reason
#: model:ir.model,name:stock_picking_cancel_reason.model_stock_picking_cancel_reason
msgid "Stock Picking Cancel Reason"
msgstr ""

#. module: stock_picking_cancel_reason
#: model:ir.actions.act_window,name:stock_picking_cancel_reason.stock_picking_cancel_reason_action
msgid "Stock Picking Cancellation Reason"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking:stock_picking_cancel_reason.stock_picking_view_form
msgid "True"
msgstr ""

#. module: stock_picking_cancel_reason
#: view:stock.picking.cancel:stock_picking_cancel_reason.stock_picking_cancel_view_form
msgid "or"
msgstr ""

#. module: stock_picking_cancel_reason
#: model:ir.actions.act_window,name:stock_picking_cancel_reason.stock_picking_cancel_action
msgid "stock.picking.cancel action"
msgstr ""

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

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

from openerp import models, fields


class StockPicking(models.Model):
_inherit = "stock.picking"

cancel_reason_id = fields.Many2one(
comodel_name="stock.picking.cancel.reason",
string="Reason for cancellation",
readonly=True,
ondelete="restrict"
)
22 changes: 22 additions & 0 deletions stock_picking_cancel_reason/models/stock_picking_cancel_reason.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields


class StockPickingCancelReason(models.Model):
_name = "stock.picking.cancel.reason"
_description = "Stock Picking Cancel Reason"

name = fields.Char(
string="Reason",
required=True
)
description = fields.Text(
string="Description"
)
active = fields.Boolean(
string="Active",
default=True
)
3 changes: 3 additions & 0 deletions stock_picking_cancel_reason/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_picking_cancel_reason_user,access_stock_picking_cancel_reason user,model_stock_picking_cancel_reason,stock.group_stock_user,1,0,0,0
access_stock_picking_cancel_reason_manager,access_stock_picking_cancel_reason manager,model_stock_picking_cancel_reason,stock.group_stock_manager,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record id="stock_picking_cancel_reason_view_tree" model="ir.ui.view">
<field name="name">stock.picking.cancel.reason tree</field>
<field name="model">stock.picking.cancel.reason</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="description" />
</tree>
</field>
</record>

<record id="stock_picking_cancel_reason_view_form" model="ir.ui.view">
<field name="name">stock.picking.cancel.reason form</field>
<field name="model">stock.picking.cancel.reason</field>
<field name="arch" type="xml">
<form string="Picking Cancellation Reason">
<sheet>
<group coslapn="4" col="2">
<field name="name"/>
<field name="description" />
<field name="active" />
</group>
</sheet>
</form>
</field>
</record>

<record id="stock_picking_cancel_reason_action" model="ir.actions.act_window">
<field name="name">Stock Picking Cancellation Reason</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.picking.cancel.reason</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a Picking Cancellation Reason.
</p>
</field>
</record>

<menuitem
id="stock_picking_cancel_reason_menu"
name="Cancel Reasons"
parent="stock.menu_stock_configuration"
action="stock_picking_cancel_reason_action"
sequence="999"
/>

</data>
</openerp>
30 changes: 30 additions & 0 deletions stock_picking_cancel_reason/views/stock_picking_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record id="stock_picking_view_form" model="ir.ui.view">
<field name="name">stock.picking.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_cancel']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="//button[@name='action_cancel']" position="before">
<button
name="%(stock_picking_cancel_action)d"
states="assigned,confirmed,partially_available,draft,waiting"
string="Cancel Transfer"
type="action"
groups="base.group_user"/>
</xpath>
<xpath expr="/form/sheet/h1[1]" position="after">
<h2 attrs="{'invisible': [('state', '!=', 'cancel')]}">
<label for="cancel_reason_id" string="Cancellation reason:"/>
<field name="cancel_reason_id" class="oe_inline"
options='{"no_open": True}' />
</h2>
</xpath>
</field>
</record>
</data>
</openerp>
5 changes: 5 additions & 0 deletions stock_picking_cancel_reason/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_picking_cancel
29 changes: 29 additions & 0 deletions stock_picking_cancel_reason/wizards/stock_picking_cancel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api


class StockPickingCancelReason(models.TransientModel):
_name = "stock.picking.cancel"

reason_id = fields.Many2one(
comodel_name="stock.picking.cancel.reason",
string="Reason",
required=True
)

@api.multi
def button_confirm(self):
self.ensure_one()
obj_stock_picking = self.env["stock.picking"]
act_close = {"type": "ir.actions.act_window_close"}
picking_ids = self._context.get("active_ids")
if picking_ids is None:
return act_close
assert len(picking_ids) == 1, "Only 1 picking ID expected"
picking = obj_stock_picking.browse(picking_ids)
picking.cancel_reason_id = self.reason_id.id
picking.action_cancel()
return act_close
Loading

0 comments on commit 3e4fab7

Please sign in to comment.