Skip to content

Commit

Permalink
Merge 73c4923 into 603c573
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Nov 11, 2018
2 parents 603c573 + 73c4923 commit b07256d
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 10 deletions.
1 change: 1 addition & 0 deletions oca_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
# To provide both the URL and a branch, use:
opnsynid-stock-logistics-warehouse https://github.com/open-synergy/opnsynid-stock-logistics-warehouse 8.0
stock-logistics-workflow https://github.com/OCA/stock-logistics-workflow 8.0
stock-logistics-warehouse https://github.com/OCA/stock-logistics-warehouse 8.0
2 changes: 1 addition & 1 deletion stock_inventory_workflow_policy/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Stock Inventory Workflow Policy",
"version": "8.0.1.0.0",
"version": "8.0.1.0.1",
"category": "Accounting & Finance",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
Expand Down
16 changes: 7 additions & 9 deletions stock_inventory_workflow_policy/models/stock_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,20 @@ class StockInventory(models.Model):
)
def _compute_policy(self):
for inventory in self:
if self.env.user.id == SUPERUSER_ID:
inventory.validate_ok = inventory.restart_ok = \
inventory.restart_ok = \
inventory.start_ok = inventory.cancel_ok = True
continue

if inventory.location_id:
location = inventory.location_id
for policy in location.\
_get_inventory_adjustment_button_policy_map():
if self.env.user.id == SUPERUSER_ID:
result = True
else:
result = location.\
_get_inventory_adjustment_button_policy(
policy[1])
setattr(
inventory,
policy[0],
location.
_get_inventory_adjustment_button_policy(
policy[1]),
result,
)

start_ok = fields.Boolean(
Expand Down
48 changes: 48 additions & 0 deletions stock_inventory_workflow_policy_discrepancy/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

=======================================================
Stock Inventory Workflow Policy - Discrepancy Extension
=======================================================


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 Inventory Workflow Policy - Discrepancy Extension*
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.
5 changes: 5 additions & 0 deletions stock_inventory_workflow_policy_discrepancy/__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 models
20 changes: 20 additions & 0 deletions stock_inventory_workflow_policy_discrepancy/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- 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 Inventory Workflow Policy - Discrepancy Extension",
"version": "8.0.1.0.0",
"category": "Accounting & Finance",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"stock_inventory_discrepancy",
],
"data": [
"views/stock_location_views.xml",
"views/stock_inventory_views.xml",
],
}
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.html).

from . import stock_location
from . import stock_inventory
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.html).

from openerp import models, fields


class StockInventory(models.Model):
_inherit = "stock.inventory"

force_ok = fields.Boolean(
string="Can Force Validation",
compute="_compute_policy",
store=False,
readonly=True,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api


class StockLocation(models.Model):
_inherit = "stock.location"

inventory_adjustment_force_grp_ids = fields.Many2many(
string="Allowed To Force Validation Inventory Adjustment",
comodel_name="res.groups",
relation="rel_inventory_adjustment_allowed_force_groups",
column1="location_id",
column2="group_id",
)

@api.model
def _get_inventory_adjustment_button_policy_map(self):
_super = super(StockLocation, self)
result = _super._get_inventory_adjustment_button_policy_map()
result.append(
("force_ok", "inventory_adjustment_force_grp_ids")
)
return result
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,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<record id="stock_inventory_view_form" model="ir.ui.view">
<field name="name">stock.inventory form</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock_inventory_workflow_policy.stock_inventory_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='validate_ok']" position="after">
<field name="force_ok"/>
</xpath>
</field>
</record>

<record id="stock_inventory_view_form_1" model="ir.ui.view">
<field name="name">stock.inventory form</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock_inventory_discrepancy.view_inventory_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_force_done']" position="attributes">
<attribute name="groups"/>
<attribute name="attrs">{'invisible':['|','|',('state','!=','pending'),('force_ok','=',False),('over_discrepancy_line_count', '=', 0)]}</attribute>
<attribute name="states"/>
</xpath>
<xpath expr="//button[@name='action_done']" position="attributes">
<attribute name="groups"/>
<attribute name="attrs">{'invisible':['|',('state','!=','confirm'),('validate_ok','=',False)]}</attribute>
<attribute name="states"/>
</xpath>
</field>
</record>

</data>
</openerp>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<record id="stock_location_view_form" model="ir.ui.view">
<field name="name">stock.location.form invetory policy</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock_inventory_workflow_policy.stock_location_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='inventory_adjustment_validate_grp_ids']" position="after">
<field name="inventory_adjustment_force_grp_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>

</data>
</openerp>

0 comments on commit b07256d

Please sign in to comment.