editing mrp_repair workflow

Asked by Aldin Draghoender

Hi,

I am having problems editing of the workflow of the mrp_repair module. All help would be much appreciated.

Our scenario is:
A technician recieves a repair order, starts the repair by making a temporary repair to the product while ordering new parts for the full reparation. He must then open the same order and add more orderlines (parts and labour costs) when the parts for the repair arrive. So the workflow will be start the repair (button), make provisional repairs (or full repair) and add the orderlines, if provisional, save the repair order otherwise make invoice(button). Open the repair order when parts arrive, add new parts and more orderlines (parts and labour costs) then finally end repair.

The problem:
When a repair is confirmed, the new button on operations lines (orderlines) disappear. How can I add new repair lines after confirmation? Is there anywhere in the workflow or other code (action definition) where I can remove the rule that makes the "new" button disappear on confirmation of a repair?

In other words, I would like to have repairs in a "Draft" state up untill action_repair_end (end repair button)

Regards ,
Aldin

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Aldin Draghoender
Solved:
Last query:
Last reply:
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#1

Aldin,

There has been defined a domain on the field operation lines, you would need to remove that.

That domain says, whenever the state of repair order moves from Draft to whatever state, make it Readonly.

Hope this helps.

Thanks,
Serpent Consulting Services.
http://www.serpentcs.com

Revision history for this message
Aldin Draghoender (aldin-draghoender) said :
#2

Thank you for your reply Serpent Consulting Services!

I did try removing the the domain but it causes empty journal lines when I want to pay the invoices in accounting modules. The states of repair order ('draft','confirmed','ready', etc ) are actually set to read only and in the operations lines the state draft:readonly is set to false which is the opposite of what you said. So I'm wondering if there is another way to overide it.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#3

Aldin,

You can simply redefine columns by inheriting the model.

Thanks.

Revision history for this message
Aldin Draghoender (aldin-draghoender) said :
#4

Once agaiin thanks for your swift reply!

It sounds like a good idea, the problem is that i'm not sure how to do it or how you mean I shall do it (which columns to redifine, etc ). Do you have an example for me to follow? It would certainly be appreciated as and I'm on my last hours before it should be done.

Regards,
 Aldin

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#5

Aldin,

Its the same way you inherit a model.

While you inherit the model, write the same field once again in _columns. But do not write the draft:readonly=False part in it.

Hope this will help.

Thanks.

Revision history for this message
Aldin Draghoender (aldin-draghoender) said :
#6

Hi again,

Removing draft:readonly=False sets all states to readonly? as operations field also have the condition readonly=TRUE. I guess I should remove :
 readonly=True, states={'draft':[('readonly',False)]}

FROM:
'operations' : fields.one2many('mrp.repair.line', 'repair_id', 'Operation Lines', readonly=True, states={'draft':[('readonly',False)]}),

Another question is should I add _view.xml and would this work for the form view and should i change the tree view?

  <record id="model_index_view" model="ir.ui.view">
   <field name="name">Model Index</field>
   <field name="model">mrp.repair</field>
   <field name="type">form</field>
   <field name="inherit_id" ref="mrp_repair.view_repair_order_form"/>
   <field name="arch" type="xml">
         <page string="Operations" position="inside">
     <field colspan="4" mode="tree,form" name="operations" position="replace" nolabel="1" widget="one2many_list">
                        <field name="perations" />
     </page>
    </field>
   </field>
  </record>

Thanks,
Aldin

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#7

Aldin,

Yes, you caught it right. You also need to disable the property which set the field readonly=True mandatorily.(better to set readonly=False on py now)

No, you need not to change anything from XML side, because the change of readonly-ness is being handled on py side in this case.

I checked the code and the xml change is not needed here.

Hope this will surely help.

Thanks,
Serpent Consulting Services.

Revision history for this message
Aldin Draghoender (aldin-draghoender) said :
#8

Hi Serpent Consulting Services,

Your suggestions seem to work well. I recommend you for your dedication and efforts.

Keep up the good work, we need people like you and I will try to help others too with the knowledge you shared with me.

Best Regards,
Aldin

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#9

Thanks Aldin,

We appreciate your feedback.