mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit/port of stock_warehouse_procurement for 11.0
This commit is contained in:
2
stock_warehouse_procurement/__init__.py
Normal file
2
stock_warehouse_procurement/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import wizard
|
||||
from . import models
|
||||
20
stock_warehouse_procurement/__manifest__.py
Normal file
20
stock_warehouse_procurement/__manifest__.py
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
'name': 'Reorder Rules per Warehouse',
|
||||
'version': '11.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,
|
||||
}
|
||||
1
stock_warehouse_procurement/models/__init__.py
Normal file
1
stock_warehouse_procurement/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import procurement
|
||||
12
stock_warehouse_procurement/models/procurement.py
Normal file
12
stock_warehouse_procurement/models/procurement.py
Normal 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
|
||||
1
stock_warehouse_procurement/wizard/__init__.py
Normal file
1
stock_warehouse_procurement/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import stock_scheduler_compute
|
||||
@@ -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()
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user