Merge branch 'develop' into incoterms

This commit is contained in:
Raffael Meyer
2022-11-25 16:50:55 +01:00
committed by GitHub
103 changed files with 1949 additions and 7368 deletions

View File

@@ -1,11 +0,0 @@
import frappe
from erpnext.regional.united_states.setup import make_custom_fields
def execute():
company = frappe.get_all("Company", filters={"country": "United States"})
if not company:
return
make_custom_fields()

View File

@@ -1,72 +0,0 @@
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from erpnext.erpnext_integrations.doctype.taxjar_settings.taxjar_settings import add_permissions
def execute():
company = frappe.get_all("Company", filters={"country": "United States"}, fields=["name"])
if not company:
return
TAXJAR_CREATE_TRANSACTIONS = frappe.db.get_single_value(
"TaxJar Settings", "taxjar_create_transactions"
)
TAXJAR_CALCULATE_TAX = frappe.db.get_single_value("TaxJar Settings", "taxjar_calculate_tax")
TAXJAR_SANDBOX_MODE = frappe.db.get_single_value("TaxJar Settings", "is_sandbox")
if not TAXJAR_CREATE_TRANSACTIONS and not TAXJAR_CALCULATE_TAX and not TAXJAR_SANDBOX_MODE:
return
custom_fields = {
"Sales Invoice Item": [
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",
),
dict(
fieldname="tax_collectable",
fieldtype="Currency",
insert_after="net_amount",
label="Tax Collectable",
read_only=1,
options="currency",
),
dict(
fieldname="taxable_amount",
fieldtype="Currency",
insert_after="tax_collectable",
label="Taxable Amount",
read_only=1,
options="currency",
),
],
"Item": [
dict(
fieldname="product_tax_category",
fieldtype="Link",
insert_after="item_group",
options="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)
add_permissions()
frappe.enqueue(
"erpnext.erpnext_integrations.doctype.taxjar_settings.taxjar_settings.add_product_tax_categories",
now=True,
)

View File

@@ -25,5 +25,21 @@ def execute():
).where(
purchase_invoice.docstatus == 1
).run()
purchase_order = frappe.qb.DocType("Purchase Order")
frappe.qb.update(purchase_order).set(
purchase_order.tax_withholding_net_total, purchase_order.net_total
).set(
purchase_order.base_tax_withholding_net_total, purchase_order.base_net_total
).where(
purchase_order.company == company.name
).where(
purchase_order.apply_tds == 1
).where(
purchase_order.transaction_date >= fiscal_year_details.year_start_date
).where(
purchase_order.docstatus == 1
).run()
except FiscalYearError:
pass

View File

@@ -0,0 +1,17 @@
import click
import frappe
def execute():
if "taxjar_integration" in frappe.get_installed_apps():
return
doctypes = ["TaxJar Settings", "TaxJar Nexus", "Product Tax Category"]
for doctype in doctypes:
frappe.delete_doc("DocType", doctype, ignore_missing=True)
click.secho(
"Taxjar Integration is moved to a separate app"
"Please install the app to continue using the module: https://github.com/frappe/taxjar_integration",
fg="yellow",
)