Merge branch 'develop' into se-required-items-from-jc
This commit is contained in:
commit
031178224f
@ -519,8 +519,6 @@ class Subscription(Document):
|
||||
2. Change the `Subscription` status to 'Past Due Date'
|
||||
3. Change the `Subscription` status to 'Cancelled'
|
||||
"""
|
||||
if getdate() > getdate(self.current_invoice_end) and self.is_prepaid_to_invoice():
|
||||
self.update_subscription_period(add_days(self.current_invoice_end, 1))
|
||||
|
||||
if not self.is_current_invoice_generated(self.current_invoice_start, self.current_invoice_end) \
|
||||
and (self.is_postpaid_to_invoice() or self.is_prepaid_to_invoice()):
|
||||
@ -528,6 +526,9 @@ class Subscription(Document):
|
||||
prorate = frappe.db.get_single_value('Subscription Settings', 'prorate')
|
||||
self.generate_invoice(prorate)
|
||||
|
||||
if getdate() > getdate(self.current_invoice_end) and self.is_prepaid_to_invoice():
|
||||
self.update_subscription_period(add_days(self.current_invoice_end, 1))
|
||||
|
||||
if self.cancel_at_period_end and getdate() > getdate(self.current_invoice_end):
|
||||
self.cancel_subscription_at_period_end()
|
||||
|
||||
|
@ -420,8 +420,7 @@ def set_gl_entries_by_account(
|
||||
{additional_conditions}
|
||||
and posting_date <= %(to_date)s
|
||||
and is_cancelled = 0
|
||||
{distributed_cost_center_query}
|
||||
order by account, posting_date""".format(
|
||||
{distributed_cost_center_query}""".format(
|
||||
additional_conditions=additional_conditions,
|
||||
distributed_cost_center_query=distributed_cost_center_query), gl_filters, as_dict=True) #nosec
|
||||
|
||||
|
@ -210,12 +210,15 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
meta = frappe.get_meta("Item", cached=True)
|
||||
searchfields = meta.get_search_fields()
|
||||
|
||||
if "description" in searchfields:
|
||||
searchfields.remove("description")
|
||||
# these are handled separately
|
||||
ignored_search_fields = ("item_name", "description")
|
||||
for ignored_field in ignored_search_fields:
|
||||
if ignored_field in searchfields:
|
||||
searchfields.remove(ignored_field)
|
||||
|
||||
columns = ''
|
||||
extra_searchfields = [field for field in searchfields
|
||||
if not field in ["name", "item_group", "description"]]
|
||||
if not field in ["name", "item_group", "description", "item_name"]]
|
||||
|
||||
if extra_searchfields:
|
||||
columns = ", " + ", ".join(extra_searchfields)
|
||||
@ -252,10 +255,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
if frappe.db.count('Item', cache=True) < 50000:
|
||||
# scan description only if items are less than 50000
|
||||
description_cond = 'or tabItem.description LIKE %(txt)s'
|
||||
return frappe.db.sql("""select tabItem.name,
|
||||
if(length(tabItem.item_name) > 40,
|
||||
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
|
||||
tabItem.item_group,
|
||||
return frappe.db.sql("""select
|
||||
tabItem.name, tabItem.item_name, tabItem.item_group,
|
||||
if(length(tabItem.description) > 40, \
|
||||
concat(substr(tabItem.description, 1, 40), "..."), description) as description
|
||||
{columns}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"creation": "2016-06-22 02:58:41.024538",
|
||||
"disable_prepared_report": 0,
|
||||
"disabled": 0,
|
||||
@ -13,7 +13,7 @@
|
||||
"name": "Student Fee Collection",
|
||||
"owner": "Administrator",
|
||||
"prepared_report": 0,
|
||||
"query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(grand_total) - sum(outstanding_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(grand_total) as \"Grand Total:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student",
|
||||
"query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(grand_total) - sum(outstanding_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(grand_total) as \"Grand Total:Currency:150\"\nFROM\n `tabFees` \nWHERE\n docstatus=1 \nGROUP BY\n student",
|
||||
"ref_doctype": "Fees",
|
||||
"report_name": "Student Fee Collection",
|
||||
"report_type": "Query Report",
|
||||
@ -22,4 +22,4 @@
|
||||
"role": "Academics User"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,23 @@ frappe.ui.form.on('TaxJar Settings', {
|
||||
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) => {
|
||||
frm.add_custom_button(__('Update Nexus List'), function() {
|
||||
frm.call({
|
||||
|
@ -14,6 +14,8 @@
|
||||
"cb_keys",
|
||||
"sandbox_api_key",
|
||||
"configuration",
|
||||
"company",
|
||||
"column_break_10",
|
||||
"tax_account_head",
|
||||
"configuration_cb",
|
||||
"shipping_account_head",
|
||||
@ -67,10 +69,6 @@
|
||||
"fieldtype": "Password",
|
||||
"label": "Sandbox API Key"
|
||||
},
|
||||
{
|
||||
"fieldname": "configuration_cb",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "taxjar_calculate_tax",
|
||||
@ -104,11 +102,25 @@
|
||||
"label": "Nexus",
|
||||
"options": "TaxJar Nexus",
|
||||
"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,
|
||||
"links": [],
|
||||
"modified": "2021-10-06 10:59:13.475442",
|
||||
"modified": "2021-11-08 18:02:29.232090",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Integrations",
|
||||
"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',
|
||||
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),
|
||||
label='Tax Collectable', read_only=1, options='currency'),
|
||||
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': [
|
||||
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.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")
|
||||
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']
|
||||
|
||||
|
||||
|
||||
def get_client():
|
||||
taxjar_settings = frappe.get_single("TaxJar Settings")
|
||||
|
||||
@ -158,6 +159,9 @@ def set_sales_tax(doc, method):
|
||||
if not TAXJAR_CALCULATE_TAX:
|
||||
return
|
||||
|
||||
if get_region(doc.company) != 'United States':
|
||||
return
|
||||
|
||||
if not doc.items:
|
||||
return
|
||||
|
||||
@ -262,7 +266,7 @@ def get_shipping_address_details(doc):
|
||||
if doc.shipping_address_name:
|
||||
shipping_address = frappe.get_doc("Address", doc.shipping_address_name)
|
||||
elif doc.customer_address:
|
||||
shipping_address = frappe.get_doc("Address", doc.customer_address_name)
|
||||
shipping_address = frappe.get_doc("Address", doc.customer_address)
|
||||
else:
|
||||
shipping_address = get_company_address_details(doc)
|
||||
|
||||
|
@ -28,6 +28,11 @@ frappe.ui.form.on('Job Card', {
|
||||
frappe.flags.resume_job = 0;
|
||||
let has_items = frm.doc.items && frm.doc.items.length;
|
||||
|
||||
if (frm.doc.__onload.work_order_stopped) {
|
||||
frm.disable_save();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!frm.doc.__islocal && has_items && frm.doc.docstatus < 2) {
|
||||
let to_request = frm.doc.for_quantity > frm.doc.transferred_qty;
|
||||
let excess_transfer_allowed = frm.doc.__onload.job_card_excess_transfer;
|
||||
|
@ -36,6 +36,7 @@ class JobCard(Document):
|
||||
def onload(self):
|
||||
excess_transfer = frappe.db.get_single_value("Manufacturing Settings", "job_card_excess_transfer")
|
||||
self.set_onload("job_card_excess_transfer", excess_transfer)
|
||||
self.set_onload("work_order_stopped", self.is_work_order_stopped())
|
||||
|
||||
def validate(self):
|
||||
self.validate_time_logs()
|
||||
@ -44,6 +45,7 @@ class JobCard(Document):
|
||||
self.validate_sequence_id()
|
||||
self.set_sub_operations()
|
||||
self.update_sub_operation_status()
|
||||
self.validate_work_order()
|
||||
|
||||
def set_sub_operations(self):
|
||||
if self.operation:
|
||||
@ -548,6 +550,18 @@ class JobCard(Document):
|
||||
frappe.throw(_("{0}, complete the operation {1} before the operation {2}.")
|
||||
.format(message, bold(row.operation), bold(self.operation)), OperationSequenceError)
|
||||
|
||||
def validate_work_order(self):
|
||||
if self.is_work_order_stopped():
|
||||
frappe.throw(_("You can't make any changes to Job Card since Work Order is stopped."))
|
||||
|
||||
def is_work_order_stopped(self):
|
||||
if self.work_order:
|
||||
status = frappe.get_value('Work Order', self.work_order)
|
||||
|
||||
if status == "Closed":
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_time_log(args):
|
||||
|
@ -12,6 +12,7 @@ from erpnext.manufacturing.doctype.work_order.work_order import (
|
||||
ItemHasVariantError,
|
||||
OverProductionError,
|
||||
StockOverProductionError,
|
||||
close_work_order,
|
||||
make_stock_entry,
|
||||
stop_unstop,
|
||||
)
|
||||
@ -800,6 +801,46 @@ class TestWorkOrder(unittest.TestCase):
|
||||
if row.is_scrap_item:
|
||||
self.assertEqual(row.qty, 1)
|
||||
|
||||
def test_close_work_order(self):
|
||||
items = ['Test FG Item for Closed WO', 'Test RM Item 1 for Closed WO',
|
||||
'Test RM Item 2 for Closed WO']
|
||||
|
||||
company = '_Test Company with perpetual inventory'
|
||||
for item_code in items:
|
||||
create_item(item_code = item_code, is_stock_item = 1,
|
||||
is_purchase_item=1, opening_stock=100, valuation_rate=10, company=company, warehouse='Stores - TCP1')
|
||||
|
||||
item = 'Test FG Item for Closed WO'
|
||||
raw_materials = ['Test RM Item 1 for Closed WO', 'Test RM Item 2 for Closed WO']
|
||||
if not frappe.db.get_value('BOM', {'item': item}):
|
||||
bom = make_bom(item=item, source_warehouse='Stores - TCP1', raw_materials=raw_materials, do_not_save=True)
|
||||
bom.with_operations = 1
|
||||
bom.append('operations', {
|
||||
'operation': '_Test Operation 1',
|
||||
'workstation': '_Test Workstation 1',
|
||||
'hour_rate': 20,
|
||||
'time_in_mins': 60
|
||||
})
|
||||
|
||||
bom.submit()
|
||||
|
||||
wo_order = make_wo_order_test_record(item=item, company=company, planned_start_date=now(), qty=20, skip_transfer=1)
|
||||
job_cards = frappe.db.get_value('Job Card', {'work_order': wo_order.name}, 'name')
|
||||
|
||||
if len(job_cards) == len(bom.operations):
|
||||
for jc in job_cards:
|
||||
job_card_doc = frappe.get_doc('Job Card', jc)
|
||||
job_card_doc.append('time_logs', {
|
||||
'from_time': now(),
|
||||
'time_in_mins': 60,
|
||||
'completed_qty': job_card_doc.for_quantity
|
||||
})
|
||||
|
||||
job_card_doc.submit()
|
||||
|
||||
close_work_order(wo_order, "Closed")
|
||||
self.assertEqual(wo_order.get('status'), "Closed")
|
||||
|
||||
def update_job_card(job_card):
|
||||
job_card_doc = frappe.get_doc('Job Card', job_card)
|
||||
job_card_doc.set('scrap_items', [
|
||||
|
@ -135,24 +135,26 @@ frappe.ui.form.on("Work Order", {
|
||||
frm.set_intro(__("Submit this Work Order for further processing."));
|
||||
}
|
||||
|
||||
if (frm.doc.docstatus===1) {
|
||||
frm.trigger('show_progress_for_items');
|
||||
frm.trigger('show_progress_for_operations');
|
||||
}
|
||||
if (frm.doc.status != "Closed") {
|
||||
if (frm.doc.docstatus===1) {
|
||||
frm.trigger('show_progress_for_items');
|
||||
frm.trigger('show_progress_for_operations');
|
||||
}
|
||||
|
||||
if (frm.doc.docstatus === 1
|
||||
&& frm.doc.operations && frm.doc.operations.length) {
|
||||
if (frm.doc.docstatus === 1
|
||||
&& frm.doc.operations && frm.doc.operations.length) {
|
||||
|
||||
const not_completed = frm.doc.operations.filter(d => {
|
||||
if(d.status != 'Completed') {
|
||||
return true;
|
||||
const not_completed = frm.doc.operations.filter(d => {
|
||||
if (d.status != 'Completed') {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (not_completed && not_completed.length) {
|
||||
frm.add_custom_button(__('Create Job Card'), () => {
|
||||
frm.trigger("make_job_card");
|
||||
}).addClass('btn-primary');
|
||||
}
|
||||
});
|
||||
|
||||
if(not_completed && not_completed.length) {
|
||||
frm.add_custom_button(__('Create Job Card'), () => {
|
||||
frm.trigger("make_job_card");
|
||||
}).addClass('btn-primary');
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,14 +519,22 @@ frappe.ui.form.on("Work Order Operation", {
|
||||
erpnext.work_order = {
|
||||
set_custom_buttons: function(frm) {
|
||||
var doc = frm.doc;
|
||||
if (doc.docstatus === 1) {
|
||||
if (doc.docstatus === 1 && doc.status != "Closed") {
|
||||
frm.add_custom_button(__('Close'), function() {
|
||||
frappe.confirm(__("Once the Work Order is Closed. It can't be resumed."),
|
||||
() => {
|
||||
erpnext.work_order.change_work_order_status(frm, "Closed");
|
||||
}
|
||||
);
|
||||
}, __("Status"));
|
||||
|
||||
if (doc.status != 'Stopped' && doc.status != 'Completed') {
|
||||
frm.add_custom_button(__('Stop'), function() {
|
||||
erpnext.work_order.stop_work_order(frm, "Stopped");
|
||||
erpnext.work_order.change_work_order_status(frm, "Stopped");
|
||||
}, __("Status"));
|
||||
} else if (doc.status == 'Stopped') {
|
||||
frm.add_custom_button(__('Re-open'), function() {
|
||||
erpnext.work_order.stop_work_order(frm, "Resumed");
|
||||
erpnext.work_order.change_work_order_status(frm, "Resumed");
|
||||
}, __("Status"));
|
||||
}
|
||||
|
||||
@ -713,9 +723,10 @@ erpnext.work_order = {
|
||||
});
|
||||
},
|
||||
|
||||
stop_work_order: function(frm, status) {
|
||||
change_work_order_status: function(frm, status) {
|
||||
let method_name = status=="Closed" ? "close_work_order" : "stop_unstop";
|
||||
frappe.call({
|
||||
method: "erpnext.manufacturing.doctype.work_order.work_order.stop_unstop",
|
||||
method: `erpnext.manufacturing.doctype.work_order.work_order.${method_name}`,
|
||||
freeze: true,
|
||||
freeze_message: __("Updating Work Order status"),
|
||||
args: {
|
||||
|
@ -99,7 +99,7 @@
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "status",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nDraft\nSubmitted\nNot Started\nIn Process\nCompleted\nStopped\nCancelled",
|
||||
"options": "\nDraft\nSubmitted\nNot Started\nIn Process\nCompleted\nStopped\nClosed\nCancelled",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
@ -573,7 +573,8 @@
|
||||
"image_field": "image",
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-10-27 19:21:35.139888",
|
||||
"migration_hash": "a18118963f4fcdb7f9d326de5f4063ba",
|
||||
"modified": "2021-10-29 15:12:32.203605",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Work Order",
|
||||
|
@ -175,7 +175,7 @@ class WorkOrder(Document):
|
||||
|
||||
def update_status(self, status=None):
|
||||
'''Update status of work order if unknown'''
|
||||
if status != "Stopped":
|
||||
if status != "Stopped" and status != "Closed":
|
||||
status = self.get_status(status)
|
||||
|
||||
if status != self.status:
|
||||
@ -624,7 +624,6 @@ class WorkOrder(Document):
|
||||
def validate_operation_time(self):
|
||||
for d in self.operations:
|
||||
if not d.time_in_mins > 0:
|
||||
print(self.bom_no, self.production_item)
|
||||
frappe.throw(_("Operation Time must be greater than 0 for Operation {0}").format(d.operation))
|
||||
|
||||
def update_required_items(self):
|
||||
@ -967,6 +966,10 @@ def stop_unstop(work_order, status):
|
||||
frappe.throw(_("Not permitted"), frappe.PermissionError)
|
||||
|
||||
pro_order = frappe.get_doc("Work Order", work_order)
|
||||
|
||||
if pro_order.status == "Closed":
|
||||
frappe.throw(_("Closed Work Order can not be stopped or Re-opened"))
|
||||
|
||||
pro_order.update_status(status)
|
||||
pro_order.update_planned_qty()
|
||||
frappe.msgprint(_("Work Order has been {0}").format(status))
|
||||
@ -1001,6 +1004,29 @@ def make_job_card(work_order, operations):
|
||||
if row.job_card_qty > 0:
|
||||
create_job_card(work_order, row, auto_create=True)
|
||||
|
||||
@frappe.whitelist()
|
||||
def close_work_order(work_order, status):
|
||||
if not frappe.has_permission("Work Order", "write"):
|
||||
frappe.throw(_("Not permitted"), frappe.PermissionError)
|
||||
|
||||
work_order = frappe.get_doc("Work Order", work_order)
|
||||
if work_order.get("operations"):
|
||||
job_cards = frappe.get_list("Job Card",
|
||||
filters={
|
||||
"work_order": work_order.name,
|
||||
"status": "Work In Progress"
|
||||
}, pluck='name')
|
||||
|
||||
if job_cards:
|
||||
job_cards = ", ".join(job_cards)
|
||||
frappe.throw(_("Can not close Work Order. Since {0} Job Cards are in Work In Progress state.").format(job_cards))
|
||||
|
||||
work_order.update_status(status)
|
||||
work_order.update_planned_qty()
|
||||
frappe.msgprint(_("Work Order has been {0}").format(status))
|
||||
work_order.notify_update()
|
||||
return work_order.status
|
||||
|
||||
def split_qty_based_on_batch_size(wo_doc, row, qty):
|
||||
if not cint(frappe.db.get_value("Operation",
|
||||
row.operation, "create_job_card_based_on_batch_size")):
|
||||
|
@ -283,8 +283,8 @@ erpnext.patches.v13_0.reset_clearance_date_for_intracompany_payment_entries
|
||||
erpnext.patches.v13_0.einvoicing_deprecation_warning
|
||||
execute:frappe.reload_doc("erpnext_integrations", "doctype", "TaxJar Settings")
|
||||
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.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.validate_options_for_data_field
|
||||
erpnext.patches.v13_0.create_gst_payment_entry_fields
|
||||
@ -309,3 +309,4 @@ erpnext.patches.v14_0.delete_healthcare_doctypes
|
||||
erpnext.patches.v13_0.update_category_in_ltds_certificate
|
||||
erpnext.patches.v13_0.create_pan_field_for_india #2
|
||||
erpnext.patches.v14_0.delete_hub_doctypes
|
||||
erpnext.patches.v13_0.create_ksa_vat_custom_fields
|
||||
|
12
erpnext/patches/v13_0/create_ksa_vat_custom_fields.py
Normal file
12
erpnext/patches/v13_0/create_ksa_vat_custom_fields.py
Normal file
@ -0,0 +1,12 @@
|
||||
import frappe
|
||||
|
||||
from erpnext.regional.saudi_arabia.setup import make_custom_fields
|
||||
|
||||
|
||||
def execute():
|
||||
company = frappe.get_all('Company', filters = {'country': 'Saudi Arabia'})
|
||||
if not company:
|
||||
return
|
||||
|
||||
make_custom_fields()
|
||||
|
@ -21,13 +21,17 @@ def execute():
|
||||
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),
|
||||
label='Tax Collectable', read_only=1, options='currency'),
|
||||
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': [
|
||||
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)
|
||||
|
@ -134,11 +134,11 @@ def get_ss_earning_map(salary_slips, currency, company_currency):
|
||||
|
||||
ss_earning_map = {}
|
||||
for d in ss_earnings:
|
||||
ss_earning_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_component, [])
|
||||
ss_earning_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_component, 0.0)
|
||||
if currency == company_currency:
|
||||
ss_earning_map[d.parent][d.salary_component] = flt(d.amount) * flt(d.exchange_rate if d.exchange_rate else 1)
|
||||
ss_earning_map[d.parent][d.salary_component] += flt(d.amount) * flt(d.exchange_rate if d.exchange_rate else 1)
|
||||
else:
|
||||
ss_earning_map[d.parent][d.salary_component] = flt(d.amount)
|
||||
ss_earning_map[d.parent][d.salary_component] += flt(d.amount)
|
||||
|
||||
return ss_earning_map
|
||||
|
||||
@ -149,10 +149,10 @@ def get_ss_ded_map(salary_slips, currency, company_currency):
|
||||
|
||||
ss_ded_map = {}
|
||||
for d in ss_deductions:
|
||||
ss_ded_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_component, [])
|
||||
ss_ded_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_component, 0.0)
|
||||
if currency == company_currency:
|
||||
ss_ded_map[d.parent][d.salary_component] = flt(d.amount) * flt(d.exchange_rate if d.exchange_rate else 1)
|
||||
ss_ded_map[d.parent][d.salary_component] += flt(d.amount) * flt(d.exchange_rate if d.exchange_rate else 1)
|
||||
else:
|
||||
ss_ded_map[d.parent][d.salary_component] = flt(d.amount)
|
||||
ss_ded_map[d.parent][d.salary_component] += flt(d.amount)
|
||||
|
||||
return ss_ded_map
|
||||
|
@ -12,7 +12,7 @@ from frappe.utils import today
|
||||
|
||||
def setup(company=None, patch=True):
|
||||
# Company independent fixtures should be called only once at the first company setup
|
||||
if frappe.db.count('Company', {'country': 'India'}) <=1:
|
||||
if patch or frappe.db.count('Company', {'country': 'India'}) <=1:
|
||||
setup_company_independent_fixtures(patch=patch)
|
||||
|
||||
if not patch:
|
||||
|
@ -49,7 +49,6 @@ frappe.query_reports["KSA VAT"] = {
|
||||
value = $(`<span>${value}</span>`);
|
||||
var $value = $(value).css("font-weight", "bold");
|
||||
value = $value.wrap("<p></p>").parent().html();
|
||||
console.log($value)
|
||||
return value
|
||||
}
|
||||
}else{
|
||||
|
@ -118,14 +118,14 @@ def get_tax_data_for_each_vat_setting(vat_setting, filters, doctype):
|
||||
total_taxable_adjustment_amount = 0
|
||||
total_tax = 0
|
||||
# Fetch All Invoices
|
||||
invoices = frappe.get_list(doctype,
|
||||
invoices = frappe.get_all(doctype,
|
||||
filters ={
|
||||
'docstatus': 1,
|
||||
'posting_date': ['between', [from_date, to_date]]
|
||||
}, fields =['name', 'is_return'])
|
||||
|
||||
for invoice in invoices:
|
||||
invoice_items = frappe.get_list(f'{doctype} Item',
|
||||
invoice_items = frappe.get_all(f'{doctype} Item',
|
||||
filters ={
|
||||
'docstatus': 1,
|
||||
'parent': invoice.name,
|
||||
|
@ -5,13 +5,12 @@ import frappe
|
||||
from frappe.permissions import add_permission, update_permission_property
|
||||
from erpnext.regional.united_arab_emirates.setup import make_custom_fields as uae_custom_fields, add_print_formats
|
||||
from erpnext.regional.saudi_arabia.wizard.operations.setup_ksa_vat_setting import create_ksa_vat_setting
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
|
||||
def setup(company=None, patch=True):
|
||||
uae_custom_fields()
|
||||
add_print_formats()
|
||||
add_permissions()
|
||||
create_ksa_vat_setting(company)
|
||||
make_custom_fields()
|
||||
|
||||
def add_permissions():
|
||||
@ -31,28 +30,34 @@ def make_custom_fields():
|
||||
- Company Name in Arabic
|
||||
- Address in Arabic
|
||||
"""
|
||||
qr_code = dict(
|
||||
fieldname='qr_code',
|
||||
label='QR Code',
|
||||
fieldtype='Attach Image',
|
||||
read_only=1, no_copy=1, hidden=1)
|
||||
custom_fields = {
|
||||
'Sales Invoice': [
|
||||
dict(
|
||||
fieldname='qr_code',
|
||||
label='QR Code',
|
||||
fieldtype='Attach Image',
|
||||
read_only=1, no_copy=1, hidden=1
|
||||
)
|
||||
],
|
||||
'Address': [
|
||||
dict(
|
||||
fieldname='address_in_arabic',
|
||||
label='Address in Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='address_line2'
|
||||
)
|
||||
],
|
||||
'Company': [
|
||||
dict(
|
||||
fieldname='company_name_in_arabic',
|
||||
label='Company Name In Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='company_name'
|
||||
)
|
||||
]
|
||||
}
|
||||
|
||||
create_custom_field('Sales Invoice', qr_code)
|
||||
create_custom_fields(custom_fields, update=True)
|
||||
|
||||
company_name_in_arabic = dict(
|
||||
fieldname='company_name_in_arabic',
|
||||
label='Company Name In Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='company_name'
|
||||
)
|
||||
|
||||
create_custom_field('Company', company_name_in_arabic)
|
||||
|
||||
address_in_arabic = dict(
|
||||
fieldname='address_in_arabic',
|
||||
label='Address in Arabic',
|
||||
fieldtype='Data',
|
||||
insert_after='address_line2'
|
||||
)
|
||||
|
||||
create_custom_field('Address', address_in_arabic)
|
||||
def update_regional_tax_settings(country, company):
|
||||
create_ksa_vat_setting(company)
|
||||
|
@ -15,7 +15,7 @@
|
||||
{
|
||||
"title": "Exempted sales",
|
||||
"item_tax_template": "KSA VAT Exempted",
|
||||
"account": "VAT Zero"
|
||||
"account": "VAT Exempted"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -40,7 +40,7 @@
|
||||
{
|
||||
"title": "Exempted purchases",
|
||||
"item_tax_template": "KSA VAT Exempted",
|
||||
"account": "VAT Zero"
|
||||
"account": "VAT Exempted"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -3,14 +3,11 @@ import os
|
||||
|
||||
import frappe
|
||||
|
||||
from erpnext.setup.setup_wizard.operations.taxes_setup import setup_taxes_and_charges
|
||||
|
||||
|
||||
def create_ksa_vat_setting(company):
|
||||
"""On creation of first company. Creates KSA VAT Setting"""
|
||||
|
||||
company = frappe.get_doc('Company', company)
|
||||
setup_taxes_and_charges(company.name, company.country)
|
||||
|
||||
file_path = os.path.join(os.path.dirname(__file__), '..', 'data', 'ksa_vat_settings.json')
|
||||
with open(file_path, 'r') as json_file:
|
||||
|
@ -2120,6 +2120,10 @@
|
||||
"account_name": "VAT 15%",
|
||||
"tax_rate": 15.00
|
||||
},
|
||||
"KSA VAT 5%": {
|
||||
"account_name": "VAT 5%",
|
||||
"tax_rate": 5.00
|
||||
},
|
||||
"KSA VAT Zero": {
|
||||
"account_name": "VAT Zero",
|
||||
"tax_rate": 0.00
|
||||
|
@ -194,7 +194,9 @@ def add_new_address(doc):
|
||||
def create_lead_for_item_inquiry(lead, subject, message):
|
||||
lead = frappe.parse_json(lead)
|
||||
lead_doc = frappe.new_doc('Lead')
|
||||
lead_doc.update(lead)
|
||||
for fieldname in ("lead_name", "company_name", "email_id", "phone"):
|
||||
lead_doc.set(fieldname, lead.get(fieldname))
|
||||
|
||||
lead_doc.set('lead_owner', '')
|
||||
|
||||
if not frappe.db.exists('Lead Source', 'Product Inquiry'):
|
||||
@ -202,6 +204,7 @@ def create_lead_for_item_inquiry(lead, subject, message):
|
||||
'doctype': 'Lead Source',
|
||||
'source_name' : 'Product Inquiry'
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
lead_doc.set('source', 'Product Inquiry')
|
||||
|
||||
try:
|
||||
|
@ -160,7 +160,7 @@ def get_ordered_qty(item_code, warehouse):
|
||||
def get_planned_qty(item_code, warehouse):
|
||||
planned_qty = frappe.db.sql("""
|
||||
select sum(qty - produced_qty) from `tabWork Order`
|
||||
where production_item = %s and fg_warehouse = %s and status not in ("Stopped", "Completed")
|
||||
where production_item = %s and fg_warehouse = %s and status not in ("Stopped", "Completed", "Closed")
|
||||
and docstatus=1 and qty > produced_qty""", (item_code, warehouse))
|
||||
|
||||
return flt(planned_qty[0][0]) if planned_qty else 0
|
||||
|
@ -256,6 +256,7 @@
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Data",
|
||||
"label": "Contact Email",
|
||||
"options": "Email",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@ -361,7 +362,7 @@
|
||||
],
|
||||
"icon": "fa fa-bug",
|
||||
"idx": 1,
|
||||
"modified": "2020-09-18 17:26:09.703215",
|
||||
"modified": "2021-11-09 17:26:09.703215",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Support",
|
||||
"name": "Warranty Claim",
|
||||
@ -385,4 +386,4 @@
|
||||
"sort_order": "DESC",
|
||||
"timeline_field": "customer",
|
||||
"title_field": "customer_name"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user