feat(company): remove E-Taxes profile and Set Main Activity buttons
Drop the "Get E-Taxes Profile" and "Set Main Activity" custom buttons from the Company form. main_activity stays read-only (Custom Field read_only=1) and can no longer be overridden via the dialog. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d370d74e32
commit
1fff9d13a1
|
|
@ -5,16 +5,6 @@
|
||||||
|
|
||||||
frappe.ui.form.on('Company', {
|
frappe.ui.form.on('Company', {
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
// Add E-Taxes profile button
|
|
||||||
frm.add_custom_button(__('Get E-Taxes Profile'), function() {
|
|
||||||
ETaxesCompany.checkAuthAndFetchProfile(frm);
|
|
||||||
}, __('E-Taxes'));
|
|
||||||
|
|
||||||
// Add Set Main Activity button
|
|
||||||
frm.add_custom_button(__('Set Main Activity'), function() {
|
|
||||||
ETaxesCompany.showMainActivitySelector(frm);
|
|
||||||
}, __('E-Taxes'));
|
|
||||||
|
|
||||||
// Make declaration default fields always editable
|
// Make declaration default fields always editable
|
||||||
ETaxesCompany.enableDeclarationDefaultFields(frm);
|
ETaxesCompany.enableDeclarationDefaultFields(frm);
|
||||||
|
|
||||||
|
|
@ -187,56 +177,6 @@ window.ETaxesCompany = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Show main activity selector dialog
|
|
||||||
*/
|
|
||||||
showMainActivitySelector: function(frm) {
|
|
||||||
const dialog = new frappe.ui.Dialog({
|
|
||||||
title: __('Select Main Activity'),
|
|
||||||
fields: [{
|
|
||||||
fieldname: 'main_activity',
|
|
||||||
fieldtype: 'Link',
|
|
||||||
label: __('Main Activity Code'),
|
|
||||||
options: 'Main type of activity',
|
|
||||||
reqd: 1
|
|
||||||
}],
|
|
||||||
primary_action_label: __('Update'),
|
|
||||||
primary_action: function(values) {
|
|
||||||
if (values.main_activity) {
|
|
||||||
ETaxesCompany.forceUpdateMainActivity(frm, values.main_activity);
|
|
||||||
dialog.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (frm.doc.main_activity) {
|
|
||||||
dialog.set_value('main_activity', frm.doc.main_activity);
|
|
||||||
}
|
|
||||||
dialog.show();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Force update main activity
|
|
||||||
*/
|
|
||||||
forceUpdateMainActivity: function(frm, activityCode) {
|
|
||||||
frappe.call({
|
|
||||||
method: 'taxes_az.company_etaxes.force_update_single_field',
|
|
||||||
args: {
|
|
||||||
company_name: frm.doc.name,
|
|
||||||
field_name: 'main_activity',
|
|
||||||
field_value: activityCode
|
|
||||||
},
|
|
||||||
callback: function(r) {
|
|
||||||
if (r.message && r.message.success) {
|
|
||||||
frm.set_value('main_activity', activityCode);
|
|
||||||
frm.reload_doc();
|
|
||||||
} else {
|
|
||||||
frappe.msgprint(__('Failed to update main activity'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make declaration default fields editable regardless of docstatus
|
* Make declaration default fields editable regardless of docstatus
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue