mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
add stock_orderpoint_move_link and stock_orderpoint_purchase_link
This commit is contained in:
committed by
Guewen Baconnier
parent
fcb0c7db81
commit
6e50fc1826
51
stock_orderpoint_move_link/README.rst
Normal file
51
stock_orderpoint_move_link/README.rst
Normal file
@@ -0,0 +1,51 @@
|
||||
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
|
||||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html
|
||||
:alt: License: LGPL-3
|
||||
|
||||
==============================
|
||||
Stock Orderpoint Move Link
|
||||
==============================
|
||||
|
||||
This module adds to stock moves a direct link to the reordering rules
|
||||
that created them. In chained moves, the reordering rule is propagated.
|
||||
|
||||
|
||||
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/153/11.0
|
||||
|
||||
|
||||
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 smash it by providing detailed and welcomed feedback.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Jordi Ballester <jordi.ballester@eficent.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.
|
||||
1
stock_orderpoint_move_link/__init__.py
Normal file
1
stock_orderpoint_move_link/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
21
stock_orderpoint_move_link/__manifest__.py
Normal file
21
stock_orderpoint_move_link/__manifest__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
{
|
||||
"name": "Stock Orderpoint Move Link",
|
||||
"summary": "Link Reordering rules to stock moves",
|
||||
"version": "11.0.1.0.0",
|
||||
"license": "LGPL-3",
|
||||
"website": "https://github.com/stock-logistics-warehouse",
|
||||
"author": "Eficent, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"category": "Warehouse Management",
|
||||
"depends": [
|
||||
"stock",
|
||||
],
|
||||
"data": [
|
||||
"views/stock_move_views.xml",
|
||||
],
|
||||
"installable": True,
|
||||
'auto_install': True,
|
||||
}
|
||||
2
stock_orderpoint_move_link/models/__init__.py
Normal file
2
stock_orderpoint_move_link/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import procurement_rule
|
||||
from . import stock_move
|
||||
20
stock_orderpoint_move_link/models/procurement_rule.py
Normal file
20
stock_orderpoint_move_link/models/procurement_rule.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProcurementRule(models.Model):
|
||||
_inherit = 'procurement.rule'
|
||||
|
||||
def _get_stock_move_values(self, product_id, product_qty, product_uom,
|
||||
location_id, name, origin, values, group_id):
|
||||
vals = super(ProcurementRule, self)._get_stock_move_values(
|
||||
product_id, product_qty, product_uom,
|
||||
location_id, name, origin, values, group_id)
|
||||
if 'orderpoint_id' in values:
|
||||
vals['orderpoint_ids'] = [(4, values['orderpoint_id'].id)]
|
||||
elif 'orderpoint_ids' in values:
|
||||
vals['orderpoint_ids'] = [(4, o.id)
|
||||
for o in vals['orderpoint_ids']]
|
||||
return vals
|
||||
25
stock_orderpoint_move_link/models/stock_move.py
Normal file
25
stock_orderpoint_move_link/models/stock_move.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
orderpoint_ids = fields.Many2many(
|
||||
comodel_name='stock.warehouse.orderpoint',
|
||||
string='Linked Reordering Rules',
|
||||
)
|
||||
|
||||
def _prepare_procurement_values(self):
|
||||
res = super(StockMove, self)._prepare_procurement_values()
|
||||
if self.orderpoint_ids:
|
||||
res['orderpoint_ids'] = self.orderpoint_ids
|
||||
return res
|
||||
|
||||
def _merge_moves_fields(self):
|
||||
res = super(StockMove, self)._merge_moves_fields()
|
||||
res['orderpoint_ids'] = [(4, m.id)
|
||||
for m in self.mapped('orderpoint_ids')]
|
||||
return res
|
||||
BIN
stock_orderpoint_move_link/static/description/icon.png
Normal file
BIN
stock_orderpoint_move_link/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
28
stock_orderpoint_move_link/views/stock_move_views.xml
Normal file
28
stock_orderpoint_move_link/views/stock_move_views.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright 2016 Eficent Business and IT Consulting Services S.L.
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
|
||||
<odoo>
|
||||
|
||||
<record id="view_move_picking_form" model="ir.ui.view">
|
||||
<field name="name">stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="move_dest_ids" position="after">
|
||||
<field name="orderpoint_ids"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="name">stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="move_dest_ids" position="after">
|
||||
<field name="orderpoint_ids"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user