@@ -111,7 +111,7 @@ frappe.ui.form.on(DOCTYPE, {
111
111
// Set Default Values
112
112
set_default_company_gstin ( frm ) ;
113
113
set_options_for_year ( frm ) ;
114
- set_options_for_month_or_quarter ( frm , true ) ;
114
+ set_options_for_month_or_quarter ( frm ) ;
115
115
116
116
if ( is_gstr1_api_enabled ( ) ) {
117
117
frm . set_df_property ( "filing_preference" , "read_only" , 1 ) ;
@@ -164,6 +164,7 @@ frappe.ui.form.on(DOCTYPE, {
164
164
165
165
if (
166
166
frm . doc . company_gstin !== filters . company_gstin ||
167
+ frm . doc . month_or_quarter != filters . month_or_quarter ||
167
168
frm . doc . year != filters . year
168
169
)
169
170
return ;
@@ -218,7 +219,7 @@ frappe.ui.form.on(DOCTYPE, {
218
219
219
220
year ( frm ) {
220
221
render_empty_state ( frm ) ;
221
- set_options_for_month_or_quarter ( frm , true ) ;
222
+ set_options_for_month_or_quarter ( frm ) ;
222
223
} ,
223
224
224
225
refresh ( frm ) {
@@ -2996,11 +2997,10 @@ async function update_fields_based_on_filing_preference(frm) {
2996
2997
2997
2998
if ( preference === undefined || preference === frm . doc . filing_preference ) return ;
2998
2999
2999
- frm . doc . filing_preference = preference ;
3000
- frm . refresh_field ( "filing_preference" ) ;
3000
+ frm . set_value ( "filing_preference" , preference ) ;
3001
3001
}
3002
3002
3003
- function set_options_for_month_or_quarter ( frm , with_update = false ) {
3003
+ function set_options_for_month_or_quarter ( frm ) {
3004
3004
/**
3005
3005
* Set options for Month or Quarter based on the year and current date
3006
3006
* 1. If the year is current year, then options are till current month
@@ -3029,8 +3029,6 @@ function set_options_for_month_or_quarter(frm, with_update = false) {
3029
3029
3030
3030
set_field_options ( "month_or_quarter" , options ) ;
3031
3031
3032
- if ( ! with_update ) return ;
3033
-
3034
3032
if ( frm . doc . year === current_year && options . length > 1 )
3035
3033
// set second last option as default
3036
3034
frm . set_value ( "month_or_quarter" , options [ options . length - 2 ] ) ;
0 commit comments