mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_orderpoint_manual_procurement: Migration to 13.0
This commit is contained in:
@@ -14,13 +14,13 @@ Stock Orderpoint Manual Procurement
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_orderpoint_manual_procurement
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_orderpoint_manual_procurement
|
||||
:alt: OCA/stock-logistics-warehouse
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_orderpoint_manual_procurement
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_orderpoint_manual_procurement
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/153/12.0
|
||||
:target: https://runbot.odoo-community.org/runbot/153/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -56,7 +56,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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 <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_orderpoint_manual_procurement%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_orderpoint_manual_procurement%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
@@ -66,15 +66,16 @@ Credits
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Eficent
|
||||
* ForgeFlow
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Lois Rilo Antelo <lois.rilo@eficent.com>
|
||||
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
||||
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
||||
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
|
||||
* Joan Sisquella Andrés <joan.sisquella@forgeflow.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -89,6 +90,6 @@ 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.
|
||||
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_orderpoint_manual_procurement>`_ project on GitHub.
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_orderpoint_manual_procurement>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# Copyright 2016-20 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
"name": "Stock Orderpoint Manual Procurement",
|
||||
"summary": "Allows to create procurement orders from orderpoints instead "
|
||||
"of relying only on the scheduler.",
|
||||
"version": "12.0.1.1.0",
|
||||
"author": "Eficent, " "Odoo Community Association (OCA)",
|
||||
"version": "13.0.1.0.0",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"category": "Warehouse Management",
|
||||
"depends": ["purchase_stock"],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" ?>
|
||||
<odoo noupdate="1">
|
||||
<record id="product_supplierinfo_product_7" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product.product_product_7"/>
|
||||
<field name="name" ref="base.res_partner_3"/>
|
||||
<field name="product_tmpl_id" ref="product.product_product_7" />
|
||||
<field name="name" ref="base.res_partner_3" />
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">72</field>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Project-Id-Version: Odoo Server 13.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: <>\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -105,7 +105,7 @@ msgid "Minimum Inventory Rule"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_orderpoint_manual_procurement
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:72
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0
|
||||
#, python-format
|
||||
msgid "No reordering rule found!"
|
||||
msgstr ""
|
||||
@@ -143,7 +143,7 @@ msgid "Quantity"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_orderpoint_manual_procurement
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:70
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0
|
||||
#, python-format
|
||||
msgid "Quantity must be positive."
|
||||
msgstr ""
|
||||
@@ -172,7 +172,8 @@ msgstr ""
|
||||
#. module: stock_orderpoint_manual_procurement
|
||||
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_manual_procurement.view_make_procure_without_security
|
||||
#: model_terms:ir.ui.view,arch_db:stock_orderpoint_manual_procurement.view_make_procurment_buffer_wizard
|
||||
msgid "Use this assistant to generate a procurement request for this\n"
|
||||
msgid ""
|
||||
"Use this assistant to generate a procurement request for this\n"
|
||||
" stock buffer. According to the product configuration,\n"
|
||||
" this may trigger a draft purchase order, a manufacturing\n"
|
||||
" order or a transfer picking."
|
||||
@@ -187,4 +188,3 @@ msgstr ""
|
||||
#: model:ir.model.fields,field_description:stock_orderpoint_manual_procurement.field_make_procurement_orderpoint_item__wiz_id
|
||||
msgid "Wizard"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ msgid "Minimum Inventory Rule"
|
||||
msgstr "最小库存规则"
|
||||
|
||||
#. module: stock_orderpoint_manual_procurement
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:72
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0
|
||||
#, python-format
|
||||
msgid "No reordering rule found!"
|
||||
msgstr "找不到重新订购规则!"
|
||||
@@ -146,7 +146,7 @@ msgid "Quantity"
|
||||
msgstr "数量"
|
||||
|
||||
#. module: stock_orderpoint_manual_procurement
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:70
|
||||
#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0
|
||||
#, python-format
|
||||
msgid "Quantity must be positive."
|
||||
msgstr "数量必须为正数。"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# Copyright 2016-20 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from datetime import datetime
|
||||
@@ -7,10 +6,6 @@ from datetime import datetime
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import float_compare, float_round
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
UNIT = dp.get_precision("Product Unit of Measure")
|
||||
|
||||
|
||||
class StockWarehouseOrderpoint(models.Model):
|
||||
_inherit = "stock.warehouse.orderpoint"
|
||||
@@ -18,13 +13,12 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
procure_recommended_qty = fields.Float(
|
||||
string="Procure Recommendation",
|
||||
compute="_compute_procure_recommended",
|
||||
digits=UNIT,
|
||||
digits="Product Unit of Measure",
|
||||
)
|
||||
procure_recommended_date = fields.Date(
|
||||
string="Recommended Request Date", compute="_compute_procure_recommended"
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def _get_procure_recommended_qty(self, virtual_qty, op_qtys):
|
||||
self.ensure_one()
|
||||
procure_recommended_qty = 0.0
|
||||
@@ -45,7 +39,6 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
procure_recommended_qty = qty_rounded
|
||||
return procure_recommended_qty
|
||||
|
||||
@api.multi
|
||||
@api.depends("product_min_qty", "product_id", "qty_multiple")
|
||||
def _compute_procure_recommended(self):
|
||||
op_qtys = self._quantity_in_progress()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Lois Rilo Antelo <lois.rilo@eficent.com>
|
||||
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
||||
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
||||
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
|
||||
* Joan Sisquella Andrés <joan.sisquella@forgeflow.com>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" ?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="group_change_orderpoint_procure_qty" model="res.groups">
|
||||
<field name="name">Change quantity in manual procurements from reordering rules</field>
|
||||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
<field
|
||||
name="name"
|
||||
>Change quantity in manual procurements from reordering rules</field>
|
||||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]" />
|
||||
<field name="category_id" ref="base.module_category_hidden" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_orderpoint_manual_procurement"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_orderpoint_manual_procurement"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_orderpoint_manual_procurement"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_orderpoint_manual_procurement"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows users to manually start procurements from the list of reordering rules,
|
||||
based on the quantity that is recommended to be procured.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
@@ -403,7 +403,7 @@ procurement unit of measure indicated in the reordering rule.</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_orderpoint_manual_procurement%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_orderpoint_manual_procurement%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -411,16 +411,17 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Eficent</li>
|
||||
<li>ForgeFlow</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Jordi Ballester Alomar <<a class="reference external" href="mailto:jordi.ballester@eficent.com">jordi.ballester@eficent.com</a>></li>
|
||||
<li>Lois Rilo Antelo <<a class="reference external" href="mailto:lois.rilo@eficent.com">lois.rilo@eficent.com</a>></li>
|
||||
<li>Jordi Ballester Alomar <<a class="reference external" href="mailto:jordi.ballester@forgeflow.com">jordi.ballester@forgeflow.com</a>></li>
|
||||
<li>Lois Rilo Antelo <<a class="reference external" href="mailto:lois.rilo@forgeflow.com">lois.rilo@forgeflow.com</a>></li>
|
||||
<li>Bhavesh Odedra <<a class="reference external" href="mailto:bodedra@opensourceintegrators.com">bodedra@opensourceintegrators.com</a>></li>
|
||||
<li>Kitti Upariphutthiphong <<a class="reference external" href="mailto:kittiu@ecosoft.co.th">kittiu@ecosoft.co.th</a>></li>
|
||||
<li>Joan Sisquella Andrés <<a class="reference external" href="mailto:joan.sisquella@forgeflow.com">joan.sisquella@forgeflow.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -430,7 +431,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_orderpoint_manual_procurement">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_orderpoint_manual_procurement">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# Copyright 2016-20 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
@@ -58,7 +57,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
|
||||
# Add default quantity
|
||||
quantity = 20.00
|
||||
self._update_product_qty(self.product, self.location, quantity)
|
||||
self._update_product_qty(self.product, quantity)
|
||||
|
||||
# Create Reordering Rule
|
||||
self.reorder = self.create_orderpoint()
|
||||
@@ -97,12 +96,12 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
)
|
||||
return product
|
||||
|
||||
def _update_product_qty(self, product, location, quantity):
|
||||
def _update_product_qty(self, product, quantity):
|
||||
"""Update Product quantity."""
|
||||
change_product_qty = self.stock_change_model.create(
|
||||
{
|
||||
"location_id": location.id,
|
||||
"product_id": product.id,
|
||||
"product_tmpl_id": product.product_tmpl_id.id,
|
||||
"new_quantity": quantity,
|
||||
}
|
||||
)
|
||||
@@ -111,7 +110,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
|
||||
def create_orderpoint(self):
|
||||
"""Create a Reordering Rule"""
|
||||
reorder = self.reordering_rule_model.sudo(self.user).create(
|
||||
reorder = self.reordering_rule_model.with_user(self.user).create(
|
||||
{
|
||||
"name": "Order-point",
|
||||
"product_id": self.product.id,
|
||||
@@ -130,7 +129,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
"active_id": self.reorder.id,
|
||||
}
|
||||
wizard = (
|
||||
self.make_procurement_orderpoint_model.sudo(self.user)
|
||||
self.make_procurement_orderpoint_model.with_user(self.user)
|
||||
.with_context(context)
|
||||
.create({})
|
||||
)
|
||||
@@ -153,6 +152,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
[("orderpoint_id", "=", self.reorder.id), ("order_id", "=", purchase.id)]
|
||||
)
|
||||
self.assertEquals(len(purchase_line), 1)
|
||||
self.reorder._compute_procure_recommended()
|
||||
self.assertNotEqual(
|
||||
self.reorder.procure_recommended_qty, purchase_line.product_qty
|
||||
)
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_warehouse_orderpoint_tree" model="ir.ui.view">
|
||||
<field name="name">stock.warehouse.orderpoint.tree</field>
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="inherit_id"
|
||||
ref="stock.view_warehouse_orderpoint_tree"/>
|
||||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_uom" position="after">
|
||||
<field name="procure_recommended_qty"/>
|
||||
<field name="procure_recommended_date"/>
|
||||
<button string="Create Procurement"
|
||||
<field name="procure_recommended_qty" />
|
||||
<field name="procure_recommended_date" />
|
||||
<button
|
||||
string="Create Procurement"
|
||||
name="%(stock_orderpoint_manual_procurement.act_make_procurement_from_orderpoint)d"
|
||||
icon="fa-cogs" type="action"/>
|
||||
icon="fa-cogs"
|
||||
type="action"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# Copyright 2016-20 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
@@ -59,13 +58,13 @@ class MakeProcurementOrderpoint(models.TransientModel):
|
||||
res["item_ids"] = items
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def make_procurement(self):
|
||||
self.ensure_one()
|
||||
errors = []
|
||||
# User requesting the procurement is passed by context to be able to
|
||||
# update final MO, PO or trasfer with that information.
|
||||
pg_obj = self.env["procurement.group"].with_context(requested_uid=self.env.user)
|
||||
procurements = []
|
||||
for item in self.item_ids:
|
||||
if not item.qty:
|
||||
raise ValidationError(_("Quantity must be positive."))
|
||||
@@ -75,17 +74,21 @@ class MakeProcurementOrderpoint(models.TransientModel):
|
||||
values["date_planned"] = fields.Datetime.to_string(
|
||||
fields.Date.from_string(item.date_planned)
|
||||
)
|
||||
# Run procurement
|
||||
try:
|
||||
pg_obj.run(
|
||||
procurements.append(
|
||||
pg_obj.Procurement(
|
||||
item.orderpoint_id.product_id,
|
||||
item.qty,
|
||||
item.uom_id,
|
||||
item.orderpoint_id.location_id,
|
||||
item.orderpoint_id.name,
|
||||
item.orderpoint_id.name,
|
||||
item.orderpoint_id.company_id,
|
||||
values,
|
||||
)
|
||||
)
|
||||
try:
|
||||
# Run procurement
|
||||
pg_obj.run(procurements)
|
||||
except UserError as error:
|
||||
errors.append(error.name)
|
||||
if errors:
|
||||
@@ -123,7 +126,6 @@ class MakeProcurementOrderpointItem(models.TransientModel):
|
||||
string="Location", comodel_name="stock.location", readonly=True
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@api.onchange("uom_id")
|
||||
def onchange_uom_id(self):
|
||||
for rec in self:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
|
||||
<!-- Make Procurement with security access right -->
|
||||
<record id="view_make_procurment_buffer_wizard" model="ir.ui.view">
|
||||
<field name="name">Request Procurement</field>
|
||||
@@ -16,25 +15,35 @@
|
||||
<group name="items" string="Items">
|
||||
<field name="item_ids" nolabel="1">
|
||||
<tree string="Items" nocreate="1" editable="top">
|
||||
<field name="orderpoint_id" invisible="True"/>
|
||||
<field name="warehouse_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="product_id"/>
|
||||
<field name="qty"/>
|
||||
<field name="qty_without_security" invisible="1"/>
|
||||
<field name="uom_id" groups="uom.group_uom"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="orderpoint_id" invisible="True" />
|
||||
<field
|
||||
name="warehouse_id"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
/>
|
||||
<field
|
||||
name="location_id"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
/>
|
||||
<field name="product_id" />
|
||||
<field name="qty" />
|
||||
<field name="qty_without_security" invisible="1" />
|
||||
<field name="uom_id" groups="uom.group_uom" />
|
||||
<field name="date_planned" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Execute" name="make_procurement" type="object" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-default" special="cancel"/>
|
||||
<button
|
||||
string="Execute"
|
||||
name="make_procurement"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
/>
|
||||
<button string="Cancel" class="btn-default" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Make Procurement without security access right -->
|
||||
<record id="view_make_procure_without_security" model="ir.ui.view">
|
||||
<field name="name">Request Procurement</field>
|
||||
@@ -50,33 +59,40 @@
|
||||
<group name="items" string="Items">
|
||||
<field name="item_ids" nolabel="1">
|
||||
<tree string="Items" nocreate="1" editable="top">
|
||||
<field name="orderpoint_id" invisible="True"/>
|
||||
<field name="warehouse_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="product_id"/>
|
||||
<field name="qty" invisible="1"/>
|
||||
<field name="qty_without_security" readonly="1"/>
|
||||
<field name="uom_id" groups="uom.group_uom"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="orderpoint_id" invisible="True" />
|
||||
<field
|
||||
name="warehouse_id"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
/>
|
||||
<field
|
||||
name="location_id"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
/>
|
||||
<field name="product_id" />
|
||||
<field name="qty" invisible="1" />
|
||||
<field name="qty_without_security" readonly="1" />
|
||||
<field name="uom_id" groups="uom.group_uom" />
|
||||
<field name="date_planned" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Execute" name="make_procurement" type="object" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-default" special="cancel"/>
|
||||
<button
|
||||
string="Execute"
|
||||
name="make_procurement"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
/>
|
||||
<button string="Cancel" class="btn-default" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window"
|
||||
id="act_make_procurement_from_orderpoint">
|
||||
<record model="ir.actions.act_window" id="act_make_procurement_from_orderpoint">
|
||||
<field name="name">Request Procurement</field>
|
||||
<field name="res_model">make.procurement.orderpoint</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
<field name="binding_model_id"
|
||||
ref="stock.model_stock_warehouse_orderpoint"/>
|
||||
<field name="binding_model_id" ref="stock.model_stock_warehouse_orderpoint" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user