Merge pull request #28277 from frappe/mergify/bp/develop/pr-28262
fix: Taxjar customer_address fix, currency fix (backport #28262)
This commit is contained in:
commit
2da17031af
@ -7,6 +7,23 @@ frappe.ui.form.on('TaxJar Settings', {
|
|||||||
frm.toggle_reqd("sandbox_api_key", frm.doc.is_sandbox);
|
frm.toggle_reqd("sandbox_api_key", frm.doc.is_sandbox);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
on_load: (frm) => {
|
||||||
|
frm.set_query('shipping_account_head', function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'company': frm.doc.company
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
frm.set_query('tax_account_head', function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'company': frm.doc.company
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
refresh: (frm) => {
|
refresh: (frm) => {
|
||||||
frm.add_custom_button(__('Update Nexus List'), function() {
|
frm.add_custom_button(__('Update Nexus List'), function() {
|
||||||
frm.call({
|
frm.call({
|
||||||
|
|||||||
@ -14,6 +14,8 @@
|
|||||||
"cb_keys",
|
"cb_keys",
|
||||||
"sandbox_api_key",
|
"sandbox_api_key",
|
||||||
"configuration",
|
"configuration",
|
||||||
|
"company",
|
||||||
|
"column_break_10",
|
||||||
"tax_account_head",
|
"tax_account_head",
|
||||||
"configuration_cb",
|
"configuration_cb",
|
||||||
"shipping_account_head",
|
"shipping_account_head",
|
||||||
@ -67,10 +69,6 @@
|
|||||||
"fieldtype": "Password",
|
"fieldtype": "Password",
|
||||||
"label": "Sandbox API Key"
|
"label": "Sandbox API Key"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "configuration_cb",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"depends_on": "taxjar_calculate_tax",
|
"depends_on": "taxjar_calculate_tax",
|
||||||
@ -104,11 +102,25 @@
|
|||||||
"label": "Nexus",
|
"label": "Nexus",
|
||||||
"options": "TaxJar Nexus",
|
"options": "TaxJar Nexus",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "configuration_cb",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_10",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Company",
|
||||||
|
"options": "Company"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-10-06 10:59:13.475442",
|
"modified": "2021-11-08 18:02:29.232090",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Integrations",
|
"module": "ERPNext Integrations",
|
||||||
"name": "TaxJar Settings",
|
"name": "TaxJar Settings",
|
||||||
|
|||||||
@ -80,9 +80,9 @@ def make_custom_fields(update=True):
|
|||||||
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
|
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
|
||||||
label='Product Tax Category', fetch_from='item_code.product_tax_category'),
|
label='Product Tax Category', fetch_from='item_code.product_tax_category'),
|
||||||
dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
|
dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
|
||||||
label='Tax Collectable', read_only=1),
|
label='Tax Collectable', read_only=1, options='currency'),
|
||||||
dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
|
dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
|
||||||
label='Taxable Amount', read_only=1)
|
label='Taxable Amount', read_only=1, options='currency')
|
||||||
],
|
],
|
||||||
'Item': [
|
'Item': [
|
||||||
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='item_group', options='Product Tax Category',
|
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='item_group', options='Product Tax Category',
|
||||||
|
|||||||
@ -6,7 +6,7 @@ from frappe import _
|
|||||||
from frappe.contacts.doctype.address.address import get_company_address
|
from frappe.contacts.doctype.address.address import get_company_address
|
||||||
from frappe.utils import cint, flt
|
from frappe.utils import cint, flt
|
||||||
|
|
||||||
from erpnext import get_default_company
|
from erpnext import get_default_company, get_region
|
||||||
|
|
||||||
TAX_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "tax_account_head")
|
TAX_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "tax_account_head")
|
||||||
SHIP_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "shipping_account_head")
|
SHIP_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "shipping_account_head")
|
||||||
@ -21,6 +21,7 @@ SUPPORTED_STATE_CODES = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', '
|
|||||||
'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY']
|
'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_client():
|
def get_client():
|
||||||
taxjar_settings = frappe.get_single("TaxJar Settings")
|
taxjar_settings = frappe.get_single("TaxJar Settings")
|
||||||
|
|
||||||
@ -158,6 +159,9 @@ def set_sales_tax(doc, method):
|
|||||||
if not TAXJAR_CALCULATE_TAX:
|
if not TAXJAR_CALCULATE_TAX:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if get_region(doc.company) != 'United States':
|
||||||
|
return
|
||||||
|
|
||||||
if not doc.items:
|
if not doc.items:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -262,7 +266,7 @@ def get_shipping_address_details(doc):
|
|||||||
if doc.shipping_address_name:
|
if doc.shipping_address_name:
|
||||||
shipping_address = frappe.get_doc("Address", doc.shipping_address_name)
|
shipping_address = frappe.get_doc("Address", doc.shipping_address_name)
|
||||||
elif doc.customer_address:
|
elif doc.customer_address:
|
||||||
shipping_address = frappe.get_doc("Address", doc.customer_address_name)
|
shipping_address = frappe.get_doc("Address", doc.customer_address)
|
||||||
else:
|
else:
|
||||||
shipping_address = get_company_address_details(doc)
|
shipping_address = get_company_address_details(doc)
|
||||||
|
|
||||||
|
|||||||
@ -283,8 +283,8 @@ erpnext.patches.v13_0.reset_clearance_date_for_intracompany_payment_entries
|
|||||||
erpnext.patches.v13_0.einvoicing_deprecation_warning
|
erpnext.patches.v13_0.einvoicing_deprecation_warning
|
||||||
execute:frappe.reload_doc("erpnext_integrations", "doctype", "TaxJar Settings")
|
execute:frappe.reload_doc("erpnext_integrations", "doctype", "TaxJar Settings")
|
||||||
execute:frappe.reload_doc("erpnext_integrations", "doctype", "Product Tax Category")
|
execute:frappe.reload_doc("erpnext_integrations", "doctype", "Product Tax Category")
|
||||||
erpnext.patches.v13_0.custom_fields_for_taxjar_integration
|
|
||||||
erpnext.patches.v14_0.delete_einvoicing_doctypes
|
erpnext.patches.v14_0.delete_einvoicing_doctypes
|
||||||
|
erpnext.patches.v13_0.custom_fields_for_taxjar_integration #08-11-2021
|
||||||
erpnext.patches.v13_0.set_operation_time_based_on_operating_cost
|
erpnext.patches.v13_0.set_operation_time_based_on_operating_cost
|
||||||
erpnext.patches.v13_0.validate_options_for_data_field
|
erpnext.patches.v13_0.validate_options_for_data_field
|
||||||
erpnext.patches.v13_0.create_gst_payment_entry_fields
|
erpnext.patches.v13_0.create_gst_payment_entry_fields
|
||||||
|
|||||||
@ -21,13 +21,17 @@ def execute():
|
|||||||
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
|
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
|
||||||
label='Product Tax Category', fetch_from='item_code.product_tax_category'),
|
label='Product Tax Category', fetch_from='item_code.product_tax_category'),
|
||||||
dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
|
dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
|
||||||
label='Tax Collectable', read_only=1),
|
label='Tax Collectable', read_only=1, options='currency'),
|
||||||
dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
|
dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
|
||||||
label='Taxable Amount', read_only=1)
|
label='Taxable Amount', read_only=1, options='currency')
|
||||||
],
|
],
|
||||||
'Item': [
|
'Item': [
|
||||||
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='item_group', options='Product Tax Category',
|
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='item_group', options='Product Tax Category',
|
||||||
label='Product Tax Category')
|
label='Product Tax Category')
|
||||||
|
],
|
||||||
|
'TaxJar Settings': [
|
||||||
|
dict(fieldname='company', fieldtype='Link', insert_after='configuration', options='Company',
|
||||||
|
label='Company')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
create_custom_fields(custom_fields, update=True)
|
create_custom_fields(custom_fields, update=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user