feat(Auto Repeat): Submit on Creation configuration
This commit is contained in:
parent
b08d834363
commit
c805851ebe
3 changed files with 28 additions and 2 deletions
|
|
@ -44,6 +44,20 @@ frappe.ui.form.on('Auto Repeat', {
|
|||
|
||||
// auto repeat schedule
|
||||
frappe.auto_repeat.render_schedule(frm);
|
||||
|
||||
frm.trigger('toggle_submit_on_creation');
|
||||
},
|
||||
|
||||
reference_doctype: function(frm) {
|
||||
frm.trigger('toggle_submit_on_creation');
|
||||
},
|
||||
|
||||
toggle_submit_on_creation: function(frm) {
|
||||
// submit on creation checkbox
|
||||
frappe.model.with_doctype(frm.doc.reference_doctype, () => {
|
||||
let meta = frappe.get_meta(frm.doc.reference_doctype);
|
||||
frm.toggle_display('submit_on_creation', meta.is_submittable);
|
||||
});
|
||||
},
|
||||
|
||||
template: function(frm) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "format:AUT-AR-{#####}",
|
||||
|
|
@ -12,6 +13,7 @@
|
|||
"section_break_3",
|
||||
"reference_doctype",
|
||||
"reference_document",
|
||||
"submit_on_creation",
|
||||
"column_break_5",
|
||||
"start_date",
|
||||
"end_date",
|
||||
|
|
@ -186,9 +188,16 @@
|
|||
"fieldname": "repeat_on_last_day",
|
||||
"fieldtype": "Check",
|
||||
"label": "Repeat on Last Day of the Month"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "submit_on_creation",
|
||||
"fieldtype": "Check",
|
||||
"label": "Submit on Creation"
|
||||
}
|
||||
],
|
||||
"modified": "2019-07-17 11:30:51.412317",
|
||||
"links": [],
|
||||
"modified": "2020-12-10 10:43:13.449172",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Automation",
|
||||
"name": "Auto Repeat",
|
||||
|
|
|
|||
|
|
@ -150,6 +150,9 @@ class AutoRepeat(Document):
|
|||
self.update_doc(new_doc, reference_doc)
|
||||
new_doc.insert(ignore_permissions = True)
|
||||
|
||||
if self.submit_on_creation:
|
||||
new_doc.submit(gnore_permissions = True)
|
||||
|
||||
return new_doc
|
||||
|
||||
def update_doc(self, new_doc, reference_doc):
|
||||
|
|
@ -160,7 +163,7 @@ class AutoRepeat(Document):
|
|||
if new_doc.meta.get_field('auto_repeat'):
|
||||
new_doc.set('auto_repeat', self.name)
|
||||
|
||||
for fieldname in ['naming_series', 'ignore_pricing_rule', 'posting_time', 'select_print_heading', 'remarks', 'owner']:
|
||||
for fieldname in ['naming_series', 'ignore_pricing_rule', 'posting_time', 'select_print_heading', 'user_remark', 'remarks', 'owner']:
|
||||
if new_doc.meta.get_field(fieldname):
|
||||
new_doc.set(fieldname, reference_doc.get(fieldname))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue