I have created a little script to populate a “custom_po_barcode” field after save. And
in fact, after the save, the barcode does appear on the PO. However, there is also a
work-flow linked to PO and after the first save, when the custom_po_barcode field is
populated , the document must be saved again since new data has been input. The workflow “save” is then performed and this clears the custom_po_barcode field again ???
My little script is below. The reason why I populate the custom_po_barcode field
“after_save” is to allow the system to assign a document number.
Why would the workflow-save clear the “custom_po_barcode” field?
I have tried it. The custom_po_barcode field briefly populates with the barcode when I click the “save” in workflow, but the field is then cleared again. I am also monitoring the
database and the database table is not updated at any point.
It seems to be the workflow-logic that is clearing it ???
I then tried something else … just add a frm.save() …???
I tried it once and it seem to work. Will test again to check.
I am just wondering why the workflow logic would interfere with a field on a doc.
a Bit of a worry because it means that , if you save a doc that has workflow and after
the 1st save, you modify a field, it may not save that last modification ???
Will have to check it. Is this a bug ???
You’ve mixed up the flow. If you’re using a workflow, you need to set it according to the workflow state. If you’re using the regular approach, you can set the logic without needing the workflow.
I used “after save”, and checked so the value update in the field, no need to save multiple times.