feat(UAE VAT 201): emirate according to branch

This commit is contained in:
Mohammad Hasnain 2020-11-16 17:36:27 +05:30
parent b8d0b546a7
commit 2e1787300d
2 changed files with 33 additions and 3 deletions

View File

@ -446,6 +446,29 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
this.frm.refresh_field("outstanding_amount");
this.frm.refresh_field("paid_amount");
this.frm.refresh_field("base_paid_amount");
},
branch: function(){
const me = this
if (this.frm.doc.branch) {
frappe.call({
async: false,
method: "frappe.client.get_value",
args: {
"doctype": "Branch",
"filters": {
'name': this.frm.doc.branch
},
"fieldname": ['emirate']
},
callback: function (res) {
if (res.message && res.message['emirate']) {
me.frm.set_value("vat_emirate", res.message['emirate'])
me.frm.refresh_field("vat_emirate")
}
}
})
}
}
});

View File

@ -38,8 +38,9 @@ def make_custom_fields():
dict(fieldname='supplier_name_in_arabic', label='Supplier Name in Arabic',
fieldtype='Read Only', insert_after='supplier_name',
fetch_from='supplier.supplier_name_in_arabic', print_hide=1),
dict(fieldname='recoverable_standard_rated_expenses', label='Recoverable Standard Rated Expenses (AED)',
insert_after='permit_no', fieldtype='Currency', print_hide=1, default='0'),
dict(fieldname='recoverable_standard_rated_expenses', print_hide=1, default='0',
label='Recoverable Standard Rated Expenses (AED)', insert_after='permit_no',
fieldtype='Currency', ),
dict(fieldname='reverse_charge', label='Reverse Charge Applicable',
fieldtype='Select', insert_after='recoverable_standard_rated_expenses', print_hide=1,
options='Y\nN', default='N'),
@ -55,6 +56,8 @@ def make_custom_fields():
dict(fieldname='customer_name_in_arabic', label='Customer Name in Arabic',
fieldtype='Read Only', insert_after='customer_name',
fetch_from='customer.customer_name_in_arabic', print_hide=1),
dict(fieldname='branch', label='Branch', options='Branch',
fieldtype='Link', insert_after='company', print_hide=1),
dict(fieldname='vat_emirate', label='VAT Emirate', insert_after='permit_no', fieldtype='Select',
options='\nAbu Dhabi\nAjman\nDubai\nFujairah\nRas Al Khaimah\nSharjah\nUmm Al Quwain',
fetch_from='company_address.emirate'),
@ -103,7 +106,11 @@ def make_custom_fields():
],
'Address': [
dict(fieldname='emirate', label='Emirate', fieldtype='Select', insert_after='state',
options='Abu Dhabi\nAjman\nDubai\nFujairah\nRas Al Khaimah\nSharjah\nUmm Al Quwain')
options='\nAbu Dhabi\nAjman\nDubai\nFujairah\nRas Al Khaimah\nSharjah\nUmm Al Quwain')
],
'Branch': [
dict(fieldname='emirate', label='Emirate', fieldtype='Select', insert_after='state',
options='\nAbu Dhabi\nAjman\nDubai\nFujairah\nRas Al Khaimah\nSharjah\nUmm Al Quwain')
],
'Purchase Invoice': purchase_invoice_fields + invoice_fields,
'Purchase Order': purchase_invoice_fields + invoice_fields,