Merge branch 'mig/12.0/stock_warehouse_procurement' into '12.0'

mig/12.0/stock_warehouse_procurement into 12.0

See merge request hibou-io/hibou-odoo/suite!119
This commit is contained in:
Kaylie Kipe
2020-10-09 13:43:02 +00:00
8 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
***********************************
Hibou - Reorder Rules Per Warehouse
***********************************
Run the inventory scheduler per warehouse.
For more information and add-ons, visit `Hibou.io <https://hibou.io/docs/hibou-odoo-suite-1/reorder-rules-per-warehouse-163>`_.
=============
Main Features
=============
* Extends the `stock.scheduler.compute` wizard to allow the inventory scheduler to run on demand per warehouse.
.. image:: https://user-images.githubusercontent.com/15882954/45578023-f353d300-b833-11e8-8007-48fa3d96495a.png
:alt: 'Run Scheduler Wizard'
:width: 988
:align: left
=======
License
=======
Please see `LICENSE <https://github.com/hibou-io/hibou-odoo-suite/blob/11.0/LICENSE>`_.
Copyright Hibou Corp. 2018

View File

@@ -0,0 +1,2 @@
from . import wizard
from . import models

View File

@@ -0,0 +1,20 @@
{
'name': 'Reorder Rules per Warehouse',
'version': '12.0.1.0.0',
'category': 'Warehouse',
'depends': [
'stock',
],
'description': """
Extends `stock.scheduler.compute` wizard to allow running on demand per-warehouse.
""",
'author': "Hibou Corp.",
'license': 'AGPL-3',
'website': 'https://hibou.io/',
'data': [
'wizard/stock_scheduler_compute_views.xml',
],
'installable': True,
'application': False,
}

View File

@@ -0,0 +1 @@
from . import procurement

View File

@@ -0,0 +1,12 @@
from odoo import models
class ProcurementGroup(models.Model):
_inherit = 'procurement.group'
def _get_orderpoint_domain(self, company_id=False):
domain = super(ProcurementGroup, self)._get_orderpoint_domain(company_id)
warehouse_id = self.env.context.get('warehouse_id', None)
if warehouse_id:
domain.append(('warehouse_id', '=', warehouse_id))
return domain

View File

@@ -0,0 +1 @@
from . import stock_scheduler_compute

View File

@@ -0,0 +1,14 @@
from odoo import api, fields, models
class StockSchedulerCompute(models.TransientModel):
_inherit = 'stock.scheduler.compute'
warehouse_id = fields.Many2one('stock.warehouse', string='Warehouse')
@api.multi
def procure_calculation(self):
self.ensure_one()
if self.warehouse_id:
self = self.with_context(warehouse_id=self.warehouse_id.id)
return super(StockSchedulerCompute, self).procure_calculation()

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_procurement_compute_wizard" model="ir.ui.view">
<field name="name">Run Schedulers Manually</field>
<field name="model">stock.scheduler.compute</field>
<field name="inherit_id" ref="stock.view_procurement_compute_wizard"/>
<field name="arch" type="xml">
<xpath expr="//p" position="after">
<group>
<field name="warehouse_id"/>
</group>
</xpath>
</field>
</record>
</odoo>