mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[ADD] mrp_exception: initial work
H11147
This commit is contained in:
1
mrp_exception/__init__.py
Normal file
1
mrp_exception/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
29
mrp_exception/__manifest__.py
Normal file
29
mrp_exception/__manifest__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Manufaturing Order Exception',
|
||||
'version': '15.0.1.0.0',
|
||||
'author': 'Hibou Corp.',
|
||||
'license': 'OPL-1',
|
||||
'category': 'Generic Modules',
|
||||
'summary': 'Custom exceptions on Manufacturing Orders',
|
||||
'description': """
|
||||
Custom exceptions on journal entries
|
||||
""",
|
||||
'website': 'https://hibou.io/',
|
||||
'depends': [
|
||||
'base_exception_user',
|
||||
'mrp',
|
||||
],
|
||||
'data': [
|
||||
# 'demo/mrp_production_exception.xml',
|
||||
# 'security/ir.model.access.csv',
|
||||
# 'views/account_move_views.xml',
|
||||
# 'wizard/account_move_exception_confirm_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
'demo/account_exception_demo.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
12
mrp_exception/demo/mrp_production_exception.xml
Normal file
12
mrp_exception/demo/mrp_production_exception.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="excep_wrong_label_type" model="exception.rule">
|
||||
<field name="name">Wrong Label Type</field>
|
||||
<field name="description">Please, ensure thet the correct Label Type is confirmed.</field>
|
||||
<field name="sequence">50</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="code">if production.label_type == 'ORG' and any(production.po_lot_id.order_line.mapped(lambda l: l.organic_status == 'NON-ORG')): failed=True</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
1
mrp_exception/models/__init__.py
Normal file
1
mrp_exception/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import mrp_production
|
||||
34
mrp_exception/models/mrp_production.py
Normal file
34
mrp_exception/models/mrp_production.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ExceptionRule(models.Model):
|
||||
_inherit = 'exception.rule'
|
||||
|
||||
model = fields.Selection(
|
||||
selection_add=[
|
||||
('mrp.production', 'Production'),
|
||||
],
|
||||
ondelete={
|
||||
'mrp.production': 'cascade',
|
||||
},
|
||||
)
|
||||
production_ids = fields.Many2many('mrp.production', string="Productions")
|
||||
|
||||
|
||||
class MrpProduction(models.Model):
|
||||
_inherit = ['mrp.production', 'base.exception']
|
||||
_name = 'mrp.production'
|
||||
|
||||
@api.model
|
||||
def _reverse_field(self):
|
||||
return 'production_ids'
|
||||
|
||||
@api.model
|
||||
def _get_popup_action(self):
|
||||
return self.env.ref('omf_mrp.action_mrp_production_exception_confirm')
|
||||
|
||||
def action_confirm(self):
|
||||
self.ensure_one()
|
||||
if self.detect_exceptions():
|
||||
return self._popup_exceptions()
|
||||
return super().action_confirm()
|
||||
0
mrp_exception/security/ir.model.access.csv
Normal file
0
mrp_exception/security/ir.model.access.csv
Normal file
|
|
Reference in New Issue
Block a user