Merge pull request #142 from andhit-r/8.0-procurement_mrp_no_confirm

[8.0][procurement_mrp_no_confirm] Move from odoomrp/odoomrp-wip
This commit is contained in:
Pedro M. Baeza
2016-10-14 01:12:18 +02:00
committed by GitHub
15 changed files with 391 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
.. 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
===============================
Don't confirm MOs when procured
===============================
This module prevents the automatic confirmation of manufacturing order when
procurement orders are executed.
Installation
============
To install this module, you need to:
1. Clone the branch 8.0 of the repository https://github.com/OCA/manufacture
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 *Procurement MRP no Confirm*
6. Install the module
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/129/8.0
Known issues / Roadmap
======================
* If the production order workflow has been altered in the transition
*prod_trans_draft_picking* to have another condition, when uninstalling this
module, you will need to restore the custom condition.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/manufacture/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
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Ainara Galdona <agaldona@avanzosc.es>
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
* Andhitia Rama <andhitia.r@opensynergy-indonesia.com>
Maintainer
----------
.. 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.

View File

@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# © 2015 AvanzOSC
# © 2015 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
from openerp import SUPERUSER_ID, api
def uninstall_hook(cr, registry):
"""Restore workflow condition."""
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
transition = env.ref('mrp.prod_trans_draft_picking')
transition.condition = True

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# © 2015 AvanzOSC
# © 2015 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Procurement MRP no Confirm",
"version": "8.0.1.0.0",
"depends": ["mrp"],
"author": "OdooMRP team,"
"AvanzOSC,"
"Tecnativa,"
"Odoo Community Association (OCA)",
"category": "MRP",
"data": ["data/mrp_production_workflow.xml"],
"installable": True,
"auto_install": False,
"uninstall_hook": "uninstall_hook",
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="mrp.prod_trans_draft_picking" model="workflow.transition">
<field name="act_from" ref="mrp.prod_act_draft"/>
<field name="act_to" ref="mrp.prod_act_confirmed"/>
<field name="signal">button_confirm</field>
<field name="condition">not no_confirm</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mrp_no_confirm
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-20 16:56+0000\n"
"PO-Revision-Date: 2014-11-20 17:57+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_mrp_production
msgid "Manufacturing Order"
msgstr "Órden de fabricación"
#. module: procurement_mrp_no_confirm
#: field:mrp.production,no_confirm:0
msgid "No Confirm"
msgstr "No confirmar"
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_procurement_order
msgid "Procurement"
msgstr "Abastecimiento"

View File

@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mrp_no_confirm
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: odoomrp-wip (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-20 18:10+0000\n"
"PO-Revision-Date: 2015-09-10 16:34+0000\n"
"Last-Translator: <>\n"
"Language-Team: Italian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_mrp_production
msgid "Manufacturing Order"
msgstr "Ordine di produzione"
#. module: procurement_mrp_no_confirm
#: field:mrp.production,no_confirm:0
msgid "No Confirm"
msgstr ""
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_procurement_order
msgid "Procurement"
msgstr ""

View File

@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mrp_no_confirm
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: odoomrp-wip (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-07 10:44+0000\n"
"PO-Revision-Date: 2015-10-09 03:37+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/odoomrp-wip-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_mrp_production
msgid "Manufacturing Order"
msgstr "Ordem de Produção"
#. module: procurement_mrp_no_confirm
#: field:mrp.production,no_confirm:0
msgid "No Confirm"
msgstr ""
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_procurement_order
msgid "Procurement"
msgstr "Aprovisionamento"

View File

@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mrp_no_confirm
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: odoomrp-wip (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-20 18:10+0000\n"
"PO-Revision-Date: 2015-09-10 16:34+0000\n"
"Last-Translator: <>\n"
"Language-Team: Romanian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/ro/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ro\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_mrp_production
msgid "Manufacturing Order"
msgstr "Comandă fabricație"
#. module: procurement_mrp_no_confirm
#: field:mrp.production,no_confirm:0
msgid "No Confirm"
msgstr ""
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_procurement_order
msgid "Procurement"
msgstr "Aprovizionare"

View File

@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mrp_no_confirm
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-20 16:56+0000\n"
"PO-Revision-Date: 2015-08-15 09:03+0200\n"
"Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: sl\n"
"X-Generator: Poedit 1.8.4\n"
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_mrp_production
msgid "Manufacturing Order"
msgstr "Proizvodni nalog"
#. module: procurement_mrp_no_confirm
#: field:mrp.production,no_confirm:0
msgid "No Confirm"
msgstr "Brez potrditve"
#. module: procurement_mrp_no_confirm
#: model:ir.model,name:procurement_mrp_no_confirm.model_procurement_order
msgid "Procurement"
msgstr "Oskrbovanje"

View File

@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# © 2015 AvanzOSC
# © 2015 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import procurement_order
from . import mrp_production

View File

@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# © 2015 AvanzOSC
# © 2015 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
class MrpProduction(models.Model):
_inherit = 'mrp.production'
no_confirm = fields.Boolean('No Confirm')

View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# © 2015 AvanzOSC
# © 2015 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api
class ProcurementOrder(models.Model):
_inherit = 'procurement.order'
@api.multi
def write(self, vals):
production_obj = self.env['mrp.production']
if vals.get('production_id'):
production = production_obj.browse(vals['production_id'])
production.no_confirm = True
return super(ProcurementOrder, self).write(vals)
@api.multi
def make_mo(self):
res = super(ProcurementOrder, self).make_mo()
for procurement in self:
if (procurement.production_id and
procurement.production_id.no_confirm):
procurement.production_id.no_confirm = False
return res

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2015 AvanzOSC
# © 2015 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_procurement

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# © 2015 AvanzOSC
# © 2015 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
from datetime import datetime
class TestProcurement(TransactionCase):
def setUp(self, *args, **kwargs):
result = super(TestProcurement, self).setUp(*args, **kwargs)
self.product = self.env.ref("product.product_product_4b")
self.location = self.env.ref("stock.stock_location_stock")
criteria = [
("location_id", "=", self.location.id),
("action", "=", "manufacture"),
]
self.rule = self.env["procurement.rule"].search(
criteria)[0]
self.proc_data = {
"name": "Test Procurement",
"product_id": self.product.id,
"location_id": self.location.id,
"product_qty": 1.0,
"product_uom": self.product.uom_id.id,
"date_planned": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"rule_id": self.rule.id,
}
return result
def test_1(self):
proc = self.env["procurement.order"].create(self.proc_data)
proc.run()
self.assertEqual(
proc.state,
"running")
# procurement should generate MO
self.assertTrue(proc.production_id)
# MO should in draft state
self.assertEqual(
proc.production_id.state,
"draft")