Skip to content

Commit

Permalink
[8.0.1.0.0] stock_move_default_procure_method
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Sep 17, 2018
1 parent e24dd2a commit 07445a3
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 0 deletions.
50 changes: 50 additions & 0 deletions stock_move_default_procure_method/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. 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 Move Default Procure Method
=================================

Stock move's *procure_method* default value based on picking type


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 Move Default Procure Method*
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>
* Michael Viriyananda <viriyananda.michael@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_move_default_procure_method/__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
19 changes: 19 additions & 0 deletions stock_move_default_procure_method/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Stock Move Default Procure Method",
"version": "8.0.1.0.0",
"category": "Stock Management",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"stock",
],
"data": [
"views/stock_picking_type_views.xml",
],
}
6 changes: 6 additions & 0 deletions stock_move_default_procure_method/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_move
from . import stock_picking_type
16 changes: 16 additions & 0 deletions stock_move_default_procure_method/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, api


class StockMove(models.Model):
_inherit = "stock.move"

@api.onchange("picking_type_id")
def onchange_procure_method(self):
picking_type = self.picking_type_id or False
if picking_type:
self.procure_method = picking_type.default_move_procure_method or \
"make_to_stock"
17 changes: 17 additions & 0 deletions stock_move_default_procure_method/models/stock_picking_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields


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

default_move_procure_method = fields.Selection(
string="Default Procure Method",
selection=[
("make_to_stock", "Default: Take From Stock"),
("make_to_order", "Advanced: Apply Procurement Rules")
],
)
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,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="stock_picking_type_view_form" model="ir.ui.view">
<field name="name">Stock Picking Type Policy Form</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='warehouse_id']" position="after">
<field name="default_move_procure_method"/>
</xpath>
</data>
</field>
</record>
</data>
</openerp>

0 comments on commit 07445a3

Please sign in to comment.