diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2024-11-20 16:54:38 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2024-11-20 16:54:38 +0700 |
| commit | 488ef03eea611f249022b57892d9e9f70a0e9c4f (patch) | |
| tree | 5a0fc384c5a30d6d844bb6dbabe45375cbee83a6 | |
| parent | 5e9bfc5cd95b01fad589c99de9cdeec1e01016b7 (diff) | |
update date
| -rw-r--r-- | update_reserved_status.ktr | 126 |
1 files changed, 116 insertions, 10 deletions
diff --git a/update_reserved_status.ktr b/update_reserved_status.ktr index dcff80a..6cfa81a 100644 --- a/update_reserved_status.ktr +++ b/update_reserved_status.ktr @@ -489,22 +489,27 @@ <order> <hop> <from>outstanding do</from> - <to>Modified JavaScript value</to> + <to>javascript reserve state</to> <enabled>Y</enabled> </hop> <hop> - <from>Modified JavaScript value</from> - <to>Update</to> + <from>Update</from> + <to>Write to log</to> <enabled>Y</enabled> </hop> <hop> - <from>Update</from> - <to>Write to log</to> + <from>javascript reserve state</from> + <to>javascript reserve date</to> + <enabled>Y</enabled> + </hop> + <hop> + <from>javascript reserve date</from> + <to>Update</to> <enabled>Y</enabled> </hop> </order> <step> - <name>Modified JavaScript value</name> + <name>javascript reserve state</name> <type>ScriptValueMod</type> <description/> <distribute>Y</distribute> @@ -527,7 +532,7 @@ if(state == "done"){ else if(state == "cancel"){ reserve_state = "cancel" } -else if(qty_reserved-qty_need==0){ +else if(qty_reserved-qty_need==0 && qty_reserved > 0){ reserve_state = "ready" } else{ @@ -589,6 +594,10 @@ else{ <name>state_reserve</name> <rename>reserve_state</rename> </value> + <value> + <name>date_reserved</name> + <rename>new_date_reserved</rename> + </value> </lookup> <attributes/> <cluster_schema/> @@ -599,7 +608,7 @@ else{ </output> </remotesteps> <GUI> - <xloc>544</xloc> + <xloc>704</xloc> <yloc>80</yloc> <draw>Y</draw> </GUI> @@ -617,7 +626,8 @@ else{ </partitioning> <connection>erp indoteknik production (localhost)</connection> <sql>select sp.id as picking_id, sp.state, sum(coalesce(sm.product_uom_qty,0)) as qty_need, -sum(coalesce(sml.product_uom_qty,0)) as qty_reserved, sum(coalesce(sml.qty_done,0)) as qty_done +sum(coalesce(sml.product_uom_qty,0)) as qty_reserved, sum(coalesce(sml.qty_done,0)) as qty_done, +sp.date_reserved, now()::timestamp as current_date from stock_picking sp join stock_move sm on sm.picking_id = sp.id left join stock_move_line sml on sml.move_id = sm.id @@ -750,6 +760,52 @@ group by sp.id</sql> <date_format_timezone>Asia/Bangkok</date_format_timezone> <lenient_string_to_number>N</lenient_string_to_number> </value-meta> + <value-meta> + <type>Timestamp</type> + <storagetype>normal</storagetype> + <name>date_reserved</name> + <length>6</length> + <precision>-1</precision> + <origin>outstanding do</origin> + <comments>date_reserved</comments> + <conversion_Mask/> + <decimal_symbol>.</decimal_symbol> + <grouping_symbol>,</grouping_symbol> + <currency_symbol/> + <trim_type>none</trim_type> + <case_insensitive>N</case_insensitive> + <collator_disabled>Y</collator_disabled> + <collator_strength>0</collator_strength> + <sort_descending>N</sort_descending> + <output_padding>N</output_padding> + <date_format_lenient>N</date_format_lenient> + <date_format_locale>en_US</date_format_locale> + <date_format_timezone>Asia/Bangkok</date_format_timezone> + <lenient_string_to_number>N</lenient_string_to_number> + </value-meta> + <value-meta> + <type>Timestamp</type> + <storagetype>normal</storagetype> + <name>current_date</name> + <length>6</length> + <precision>-1</precision> + <origin>outstanding do</origin> + <comments>current_date</comments> + <conversion_Mask/> + <decimal_symbol>.</decimal_symbol> + <grouping_symbol>,</grouping_symbol> + <currency_symbol/> + <trim_type>none</trim_type> + <case_insensitive>N</case_insensitive> + <collator_disabled>Y</collator_disabled> + <collator_strength>0</collator_strength> + <sort_descending>N</sort_descending> + <output_padding>N</output_padding> + <date_format_lenient>N</date_format_lenient> + <date_format_locale>en_US</date_format_locale> + <date_format_timezone>Asia/Bangkok</date_format_timezone> + <lenient_string_to_number>N</lenient_string_to_number> + </value-meta> </row-meta> <attributes/> <cluster_schema/> @@ -810,7 +866,57 @@ group by sp.id</sql> </output> </remotesteps> <GUI> - <xloc>688</xloc> + <xloc>848</xloc> + <yloc>80</yloc> + <draw>Y</draw> + </GUI> + </step> + <step> + <name>javascript reserve date</name> + <type>ScriptValueMod</type> + <description/> + <distribute>Y</distribute> + <custom_distribution/> + <copies>1</copies> + <partitioning> + <method>none</method> + <schema_name/> + </partitioning> + <compatible>N</compatible> + <optimizationLevel>9</optimizationLevel> + <jsScripts> + <jsScript> + <jsScript_type>0</jsScript_type> + <jsScript_name>Script 1</jsScript_name> + <jsScript_script>var new_date_reserved = date_reserved +if (!date_reserved){ + new_date_reserved = current_date +} +else{ + new_date_reserved = date_reserved +}</jsScript_script> + </jsScript> + </jsScripts> + <fields> + <field> + <name>new_date_reserved</name> + <rename>new_date_reserved</rename> + <type>Timestamp</type> + <length>-1</length> + <precision>-1</precision> + <replace>N</replace> + </field> + </fields> + <attributes/> + <cluster_schema/> + <remotesteps> + <input> + </input> + <output> + </output> + </remotesteps> + <GUI> + <xloc>528</xloc> <yloc>80</yloc> <draw>Y</draw> </GUI> |
