Conversation
dalonsod
left a comment
There was a problem hiding this comment.
Only code review. Some minor changes and a bug overriding a method.
When comments attended, I'll functionally test it.
Looks great!!
|
Made first functionally test, I've found the following problem. Steps to reproduce:
This error underlies an unexpected problem: since we're defining a kind of plan that does not actually require a |
|
I think the problem is in: |
They are different methods, fired at different events on different models. Unfortunately, both methods have the same name:
|
|
@lmiguens-solvos I've made some changes in order to get our own And don't forget adding some missing fields to the maintenance plan grid view inside "Maintenance" tab! |
e39ac50 to
a4a7819
Compare
|
@lmiguens-solvos I've added demo data and tests to the module. Maybe you could take a look at the test code and run it. For achieving it, you'd need to run Odoo updating the module and adding the proper flag ( , or the detailed errors if test fails. |
|
@dalonsod Demo data and tests looks good to me. |
|
@lmiguens-solvos great! @lromero-solvos we need your review! |
| @api.onchange('meter_autoinc_mode') | ||
| def _onchange_meter_mode(self): | ||
| if self.meter_autoinc_mode: | ||
| self.meter_autoinc_value = None |
There was a problem hiding this comment.
The suggested code is actually the same, but maybe clearer (coherent with cron recordset selection domain)
| self.meter_autoinc_value = None | |
| self.meter_autoinc_value = 0 |
| values['maintenance_plan_horizon'] = None | ||
| values['planning_step'] = None | ||
| if meter_autoinc_mode: | ||
| values['meter_autoinc_value'] = None |
There was a problem hiding this comment.
The same as above
| values['meter_autoinc_value'] = None | |
| values['meter_autoinc_value'] = 0 |
| meter_autoinc_mode = fields.Boolean( | ||
| string='Manual or External auto increment') |
There was a problem hiding this comment.
Since it's not a selection field, I think it's better a short description with the True (checked) option. In the frontend it's a little bit confusing "Manual or External" for a check, actually is "Self-increased vs Only Manual" (and "Manual" can be through frontend or from and external access e.g. RPC):
| meter_autoinc_mode = fields.Boolean( | |
| string='Manual or External auto increment') | |
| meter_autoinc_mode = fields.Boolean( | |
| string='Auto incremental mode', | |
| help='If checked, Current value is periodically incremented according a self-increase value; otherwise only manual changes of Current value are allowed') |
| <field name="meter_autoinc_lastvalue"/> | ||
| </xpath> | ||
| <xpath expr="//notebook" position="inside"> | ||
| <page string="Maintenance Meter Mode"> |
There was a problem hiding this comment.
what do you think? In fact, I don't like "Maintenance" for the other tab...
| <page string="Maintenance Meter Mode"> | |
| <page string="Meter Mode Plans"> |
| <tree string="Meter mode Plans"> | ||
| <field name="maintenance_kind_id"/> | ||
| <field name="name"/> | ||
| <field name="meter_mode"/> |
There was a problem hiding this comment.
This field could be removed from the view, only meter mode plans are actually shown
| attrs="{'required':[('meter_mode', '=', True),('meter_autoinc_mode', '=', False)] | ||
| ,'readonly':[('meter_mode', '=', False)]}"/> |
There was a problem hiding this comment.
I think better invisible than readonly, the same for the other field:
| attrs="{'required':[('meter_mode', '=', True),('meter_autoinc_mode', '=', False)] | |
| ,'readonly':[('meter_mode', '=', False)]}"/> | |
| attrs="{'required':[('meter_mode', '=', True),('meter_autoinc_mode', '=', False)] | |
| ,'invisible':[('meter_mode', '=', False)]}"/> |
|
The new The |
9d7f03a to
251b33d
Compare
Maintenance plan by self-increasing meter.
Adds new mode: meter mode.
When meter mode is true you have to configure autoincrement params.