mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit of stock_warehouse_procurement for 10.0
This commit is contained in:
3
stock_warehouse_procurement/__init__.py
Normal file
3
stock_warehouse_procurement/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import wizard
|
||||
from . import models
|
||||
22
stock_warehouse_procurement/__manifest__.py
Normal file
22
stock_warehouse_procurement/__manifest__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2017 Hibou Corp.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{'name': 'Reorder Rules per Warehouse',
|
||||
'version': '10.0.1.0.0',
|
||||
'category': 'Warehouse',
|
||||
'depends': ['stock',
|
||||
],
|
||||
'description': """
|
||||
Patches `procurement.orderpoint.compute` wizard to allow running on demand per-warehouse.
|
||||
|
||||
""",
|
||||
'author': "Hibou Corp.",
|
||||
'license': 'AGPL-3',
|
||||
'website': 'https://hibou.io/',
|
||||
'data': [
|
||||
'wizard/procurement_order_compute_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
}
|
||||
2
stock_warehouse_procurement/models/__init__.py
Normal file
2
stock_warehouse_procurement/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import procurement
|
||||
14
stock_warehouse_procurement/models/procurement.py
Normal file
14
stock_warehouse_procurement/models/procurement.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProcurementOrder(models.Model):
|
||||
_inherit = "procurement.order"
|
||||
|
||||
def _get_orderpoint_domain(self, company_id=False):
|
||||
domain = super(ProcurementOrder, self)._get_orderpoint_domain(company_id)
|
||||
warehouse_id = self.env.context.get('warehouse_id', None)
|
||||
if warehouse_id:
|
||||
domain += [('warehouse_id', '=', warehouse_id)]
|
||||
return domain
|
||||
2
stock_warehouse_procurement/wizard/__init__.py
Normal file
2
stock_warehouse_procurement/wizard/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import procurement_order_compute
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProcurementOrderpointConfirm(models.TransientModel):
|
||||
_inherit = 'procurement.orderpoint.compute'
|
||||
|
||||
warehouse_id = fields.Many2one('stock.warehouse', string='Warehouse')
|
||||
|
||||
@api.multi
|
||||
def procure_calculation(self):
|
||||
if self.warehouse_id:
|
||||
self = self.with_context(warehouse_id=self.warehouse_id.id)
|
||||
return super(ProcurementOrderpointConfirm, self).procure_calculation()
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_procurement_compute_wizard" model="ir.ui.view">
|
||||
<field name="name">Run Reordering Rules</field>
|
||||
<field name="model">procurement.orderpoint.compute</field>
|
||||
<field name="inherit_id" ref="stock.view_procurement_compute_wizard"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group" position="after">
|
||||
<group>
|
||||
<field name="warehouse_id"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="stock.action_procurement_compute" id="menu_procurement_compute" parent="stock.menu_warehouse_config" sequence="2" />
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user