forked from OCA/manufacture
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] mrp_bom_version: pre-commit stuff
- Loading branch information
Kay K. Cross
committed
Oct 18, 2024
1 parent
fa8e3e0
commit c15be7d
Showing
14 changed files
with
283 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# (c) 2015 Alfredo de la Fuente - AvanzOSC | ||
# (c) 2015 Oihane Crucelaegui - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
@@ -9,10 +8,10 @@ | |
"version": "8.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "OdooMRP team," | ||
"AvanzOSC," | ||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, " | ||
"Odoo Community Association (OCA)", | ||
"website": "http://www.odoomrp.com", | ||
"AvanzOSC," | ||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, " | ||
"Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/manufacture", | ||
"contributors": [ | ||
"Pedro M. Baeza <[email protected]>", | ||
"Ana Juaristi <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,49 @@ | ||
# -*- coding: utf-8 -*- | ||
# (c) 2015 Oihane Crucelaegui - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openerp import api, fields, models | ||
|
||
|
||
class MrpConfigSettings(models.TransientModel): | ||
_inherit = 'mrp.config.settings' | ||
_inherit = "mrp.config.settings" | ||
|
||
group_mrp_bom_version = fields.Boolean( | ||
string='Allow to re-edit BoMs', | ||
implied_group='mrp_bom_version.group_mrp_bom_version', | ||
help='The active state may be passed back to state draft') | ||
string="Allow to re-edit BoMs", | ||
implied_group="mrp_bom_version.group_mrp_bom_version", | ||
help="The active state may be passed back to state draft", | ||
) | ||
active_draft = fields.Boolean( | ||
string='Keep re-editing BoM active', | ||
help='This will allow you to define if those BoM passed back to draft' | ||
' are still activated or not') | ||
string="Keep re-editing BoM active", | ||
help="This will allow you to define if those BoM passed back to draft" | ||
" are still activated or not", | ||
) | ||
|
||
def _get_parameter(self, key, default=False): | ||
param_obj = self.env['ir.config_parameter'] | ||
rec = param_obj.search([('key', '=', key)]) | ||
param_obj = self.env["ir.config_parameter"] | ||
rec = param_obj.search([("key", "=", key)]) | ||
return rec or default | ||
|
||
def _write_or_create_param(self, key, value): | ||
param_obj = self.env['ir.config_parameter'] | ||
param_obj = self.env["ir.config_parameter"] | ||
rec = self._get_parameter(key) | ||
if rec: | ||
if not value: | ||
rec.unlink() | ||
else: | ||
rec.value = value | ||
elif value: | ||
param_obj.create({'key': key, 'value': value}) | ||
param_obj.create({"key": key, "value": value}) | ||
|
||
@api.multi | ||
def get_default_parameters(self): | ||
def get_value(key, default=''): | ||
def get_value(key, default=""): | ||
rec = self._get_parameter(key) | ||
return rec and rec.value or default | ||
|
||
return { | ||
'active_draft': get_value('active.draft', False), | ||
"active_draft": get_value("active.draft", False), | ||
} | ||
|
||
@api.multi | ||
def set_parameters(self): | ||
self._write_or_create_param('active.draft', self.active_draft) | ||
self._write_or_create_param("active.draft", self.active_draft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.