Merge branch 'develop' into fix/subcontracting/additional-cost
This commit is contained in:
commit
dd719099bc
@ -36,6 +36,15 @@ frappe.ui.form.on('POS Closing Entry', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
set_html_data(frm);
|
set_html_data(frm);
|
||||||
|
|
||||||
|
if (frm.doc.docstatus == 1) {
|
||||||
|
if (!frm.doc.posting_date) {
|
||||||
|
frm.set_value("posting_date", frappe.datetime.nowdate());
|
||||||
|
}
|
||||||
|
if (!frm.doc.posting_time) {
|
||||||
|
frm.set_value("posting_time", frappe.datetime.now_time());
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"period_end_date",
|
"period_end_date",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
"posting_date",
|
"posting_date",
|
||||||
|
"posting_time",
|
||||||
"pos_opening_entry",
|
"pos_opening_entry",
|
||||||
"status",
|
"status",
|
||||||
"section_break_5",
|
"section_break_5",
|
||||||
@ -51,7 +52,6 @@
|
|||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Period End Date",
|
"label": "Period End Date",
|
||||||
"read_only": 1,
|
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -219,6 +219,13 @@
|
|||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"label": "Error",
|
"label": "Error",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "posting_time",
|
||||||
|
"fieldtype": "Time",
|
||||||
|
"label": "Posting Time",
|
||||||
|
"no_copy": 1,
|
||||||
|
"reqd": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
@ -228,10 +235,11 @@
|
|||||||
"link_fieldname": "pos_closing_entry"
|
"link_fieldname": "pos_closing_entry"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-10-20 16:19:25.340565",
|
"modified": "2022-08-01 11:37:14.991228",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "POS Closing Entry",
|
"name": "POS Closing Entry",
|
||||||
|
"naming_rule": "Expression (old style)",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
@ -278,5 +286,6 @@
|
|||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"states": [],
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
@ -15,6 +15,9 @@ from erpnext.controllers.status_updater import StatusUpdater
|
|||||||
|
|
||||||
class POSClosingEntry(StatusUpdater):
|
class POSClosingEntry(StatusUpdater):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
self.posting_date = self.posting_date or frappe.utils.nowdate()
|
||||||
|
self.posting_time = self.posting_time or frappe.utils.nowtime()
|
||||||
|
|
||||||
if frappe.db.get_value("POS Opening Entry", self.pos_opening_entry, "status") != "Open":
|
if frappe.db.get_value("POS Opening Entry", self.pos_opening_entry, "status") != "Open":
|
||||||
frappe.throw(_("Selected POS Opening Entry should be open."), title=_("Invalid Opening Entry"))
|
frappe.throw(_("Selected POS Opening Entry should be open."), title=_("Invalid Opening Entry"))
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"posting_date",
|
"posting_date",
|
||||||
|
"posting_time",
|
||||||
"merge_invoices_based_on",
|
"merge_invoices_based_on",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
"pos_closing_entry",
|
"pos_closing_entry",
|
||||||
@ -105,12 +106,19 @@
|
|||||||
"label": "Customer Group",
|
"label": "Customer Group",
|
||||||
"mandatory_depends_on": "eval:doc.merge_invoices_based_on == 'Customer Group'",
|
"mandatory_depends_on": "eval:doc.merge_invoices_based_on == 'Customer Group'",
|
||||||
"options": "Customer Group"
|
"options": "Customer Group"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "posting_time",
|
||||||
|
"fieldtype": "Time",
|
||||||
|
"label": "Posting Time",
|
||||||
|
"no_copy": 1,
|
||||||
|
"reqd": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-09-14 11:17:19.001142",
|
"modified": "2022-08-01 11:36:42.456429",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "POS Invoice Merge Log",
|
"name": "POS Invoice Merge Log",
|
||||||
@ -173,5 +181,6 @@
|
|||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"states": [],
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ from frappe import _
|
|||||||
from frappe.core.page.background_jobs.background_jobs import get_info
|
from frappe.core.page.background_jobs.background_jobs import get_info
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.model.mapper import map_child_doc, map_doc
|
from frappe.model.mapper import map_child_doc, map_doc
|
||||||
from frappe.utils import cint, flt, getdate, nowdate
|
from frappe.utils import cint, flt, get_time, getdate, nowdate, nowtime
|
||||||
from frappe.utils.background_jobs import enqueue
|
from frappe.utils.background_jobs import enqueue
|
||||||
from frappe.utils.scheduler import is_scheduler_inactive
|
from frappe.utils.scheduler import is_scheduler_inactive
|
||||||
|
|
||||||
@ -99,6 +99,7 @@ class POSInvoiceMergeLog(Document):
|
|||||||
sales_invoice.is_consolidated = 1
|
sales_invoice.is_consolidated = 1
|
||||||
sales_invoice.set_posting_time = 1
|
sales_invoice.set_posting_time = 1
|
||||||
sales_invoice.posting_date = getdate(self.posting_date)
|
sales_invoice.posting_date = getdate(self.posting_date)
|
||||||
|
sales_invoice.posting_time = get_time(self.posting_time)
|
||||||
sales_invoice.save()
|
sales_invoice.save()
|
||||||
sales_invoice.submit()
|
sales_invoice.submit()
|
||||||
|
|
||||||
@ -115,6 +116,7 @@ class POSInvoiceMergeLog(Document):
|
|||||||
credit_note.is_consolidated = 1
|
credit_note.is_consolidated = 1
|
||||||
credit_note.set_posting_time = 1
|
credit_note.set_posting_time = 1
|
||||||
credit_note.posting_date = getdate(self.posting_date)
|
credit_note.posting_date = getdate(self.posting_date)
|
||||||
|
credit_note.posting_time = get_time(self.posting_time)
|
||||||
# TODO: return could be against multiple sales invoice which could also have been consolidated?
|
# TODO: return could be against multiple sales invoice which could also have been consolidated?
|
||||||
# credit_note.return_against = self.consolidated_invoice
|
# credit_note.return_against = self.consolidated_invoice
|
||||||
credit_note.save()
|
credit_note.save()
|
||||||
@ -402,6 +404,9 @@ def create_merge_logs(invoice_by_customer, closing_entry=None):
|
|||||||
merge_log.posting_date = (
|
merge_log.posting_date = (
|
||||||
getdate(closing_entry.get("posting_date")) if closing_entry else nowdate()
|
getdate(closing_entry.get("posting_date")) if closing_entry else nowdate()
|
||||||
)
|
)
|
||||||
|
merge_log.posting_time = (
|
||||||
|
get_time(closing_entry.get("posting_time")) if closing_entry else nowtime()
|
||||||
|
)
|
||||||
merge_log.customer = customer
|
merge_log.customer = customer
|
||||||
merge_log.pos_closing_entry = closing_entry.get("name") if closing_entry else None
|
merge_log.pos_closing_entry = closing_entry.get("name") if closing_entry else None
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ class GrossProfitGenerator(object):
|
|||||||
previous_stock_value = len(my_sle) > i + 1 and flt(my_sle[i + 1].stock_value) or 0.0
|
previous_stock_value = len(my_sle) > i + 1 and flt(my_sle[i + 1].stock_value) or 0.0
|
||||||
|
|
||||||
if previous_stock_value:
|
if previous_stock_value:
|
||||||
return (previous_stock_value - flt(sle.stock_value)) * flt(row.qty) / abs(flt(sle.qty))
|
return abs(previous_stock_value - flt(sle.stock_value)) * flt(row.qty) / abs(flt(sle.qty))
|
||||||
else:
|
else:
|
||||||
return flt(row.qty) * self.get_average_buying_rate(row, item_code)
|
return flt(row.qty) * self.get_average_buying_rate(row, item_code)
|
||||||
else:
|
else:
|
||||||
|
@ -12,7 +12,9 @@ from decimal import Decimal
|
|||||||
import frappe
|
import frappe
|
||||||
from bs4 import BeautifulSoup as bs
|
from bs4 import BeautifulSoup as bs
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
from frappe.custom.doctype.custom_field.custom_field import (
|
||||||
|
create_custom_fields as _create_custom_fields,
|
||||||
|
)
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils.data import format_datetime
|
from frappe.utils.data import format_datetime
|
||||||
|
|
||||||
@ -577,22 +579,25 @@ class TallyMigration(Document):
|
|||||||
new_year.save()
|
new_year.save()
|
||||||
oldest_year = new_year
|
oldest_year = new_year
|
||||||
|
|
||||||
def create_custom_fields(doctypes):
|
def create_custom_fields():
|
||||||
tally_guid_df = {
|
_create_custom_fields(
|
||||||
"fieldtype": "Data",
|
{
|
||||||
"fieldname": "tally_guid",
|
("Journal Entry", "Purchase Invoice", "Sales Invoice"): [
|
||||||
"read_only": 1,
|
{
|
||||||
"label": "Tally GUID",
|
"fieldtype": "Data",
|
||||||
}
|
"fieldname": "tally_guid",
|
||||||
tally_voucher_no_df = {
|
"read_only": 1,
|
||||||
"fieldtype": "Data",
|
"label": "Tally GUID",
|
||||||
"fieldname": "tally_voucher_no",
|
},
|
||||||
"read_only": 1,
|
{
|
||||||
"label": "Tally Voucher Number",
|
"fieldtype": "Data",
|
||||||
}
|
"fieldname": "tally_voucher_no",
|
||||||
for df in [tally_guid_df, tally_voucher_no_df]:
|
"read_only": 1,
|
||||||
for doctype in doctypes:
|
"label": "Tally Voucher Number",
|
||||||
create_custom_field(doctype, df)
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def create_price_list():
|
def create_price_list():
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
@ -628,7 +633,7 @@ class TallyMigration(Document):
|
|||||||
|
|
||||||
create_fiscal_years(vouchers)
|
create_fiscal_years(vouchers)
|
||||||
create_price_list()
|
create_price_list()
|
||||||
create_custom_fields(["Journal Entry", "Purchase Invoice", "Sales Invoice"])
|
create_custom_fields()
|
||||||
|
|
||||||
total = len(vouchers)
|
total = len(vouchers)
|
||||||
is_last = False
|
is_last = False
|
||||||
|
@ -6,7 +6,7 @@ from urllib.parse import urlparse
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils.nestedset import get_root_of
|
from frappe.utils.nestedset import get_root_of
|
||||||
|
|
||||||
@ -19,27 +19,24 @@ class WoocommerceSettings(Document):
|
|||||||
|
|
||||||
def create_delete_custom_fields(self):
|
def create_delete_custom_fields(self):
|
||||||
if self.enable_sync:
|
if self.enable_sync:
|
||||||
custom_fields = {}
|
create_custom_fields(
|
||||||
# create
|
{
|
||||||
for doctype in ["Customer", "Sales Order", "Item", "Address"]:
|
("Customer", "Sales Order", "Item", "Address"): dict(
|
||||||
df = dict(
|
fieldname="woocommerce_id",
|
||||||
fieldname="woocommerce_id",
|
label="Woocommerce ID",
|
||||||
label="Woocommerce ID",
|
fieldtype="Data",
|
||||||
fieldtype="Data",
|
read_only=1,
|
||||||
read_only=1,
|
print_hide=1,
|
||||||
print_hide=1,
|
),
|
||||||
)
|
("Customer", "Address"): dict(
|
||||||
create_custom_field(doctype, df)
|
fieldname="woocommerce_email",
|
||||||
|
label="Woocommerce Email",
|
||||||
for doctype in ["Customer", "Address"]:
|
fieldtype="Data",
|
||||||
df = dict(
|
read_only=1,
|
||||||
fieldname="woocommerce_email",
|
print_hide=1,
|
||||||
label="Woocommerce Email",
|
),
|
||||||
fieldtype="Data",
|
}
|
||||||
read_only=1,
|
)
|
||||||
print_hide=1,
|
|
||||||
)
|
|
||||||
create_custom_field(doctype, df)
|
|
||||||
|
|
||||||
if not frappe.get_value("Item Group", {"name": _("WooCommerce Products")}):
|
if not frappe.get_value("Item Group", {"name": _("WooCommerce Products")}):
|
||||||
item_group = frappe.new_doc("Item Group")
|
item_group = frappe.new_doc("Item Group")
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||||
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
|
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
|
||||||
from frappe.utils import cint
|
from frappe.utils import cint
|
||||||
|
|
||||||
@ -83,35 +83,32 @@ def setup_currency_exchange():
|
|||||||
|
|
||||||
|
|
||||||
def create_print_setting_custom_fields():
|
def create_print_setting_custom_fields():
|
||||||
create_custom_field(
|
create_custom_fields(
|
||||||
"Print Settings",
|
|
||||||
{
|
{
|
||||||
"label": _("Compact Item Print"),
|
"Print Settings": [
|
||||||
"fieldname": "compact_item_print",
|
{
|
||||||
"fieldtype": "Check",
|
"label": _("Compact Item Print"),
|
||||||
"default": 1,
|
"fieldname": "compact_item_print",
|
||||||
"insert_after": "with_letterhead",
|
"fieldtype": "Check",
|
||||||
},
|
"default": "1",
|
||||||
)
|
"insert_after": "with_letterhead",
|
||||||
create_custom_field(
|
},
|
||||||
"Print Settings",
|
{
|
||||||
{
|
"label": _("Print UOM after Quantity"),
|
||||||
"label": _("Print UOM after Quantity"),
|
"fieldname": "print_uom_after_quantity",
|
||||||
"fieldname": "print_uom_after_quantity",
|
"fieldtype": "Check",
|
||||||
"fieldtype": "Check",
|
"default": "0",
|
||||||
"default": 0,
|
"insert_after": "compact_item_print",
|
||||||
"insert_after": "compact_item_print",
|
},
|
||||||
},
|
{
|
||||||
)
|
"label": _("Print taxes with zero amount"),
|
||||||
create_custom_field(
|
"fieldname": "print_taxes_with_zero_amount",
|
||||||
"Print Settings",
|
"fieldtype": "Check",
|
||||||
{
|
"default": "0",
|
||||||
"label": _("Print taxes with zero amount"),
|
"insert_after": "allow_print_for_cancelled",
|
||||||
"fieldname": "print_taxes_with_zero_amount",
|
},
|
||||||
"fieldtype": "Check",
|
]
|
||||||
"default": 0,
|
}
|
||||||
"insert_after": "allow_print_for_cancelled",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,8 +55,6 @@
|
|||||||
"in_words",
|
"in_words",
|
||||||
"bill_no",
|
"bill_no",
|
||||||
"bill_date",
|
"bill_date",
|
||||||
"accounting_details_section",
|
|
||||||
"provisional_expense_account",
|
|
||||||
"more_info",
|
"more_info",
|
||||||
"status",
|
"status",
|
||||||
"column_break_39",
|
"column_break_39",
|
||||||
@ -528,19 +526,6 @@
|
|||||||
"options": "Company",
|
"options": "Company",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"collapsible": 1,
|
|
||||||
"fieldname": "accounting_details_section",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"label": "Accounting Details"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "provisional_expense_account",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 1,
|
|
||||||
"label": "Provisional Expense Account",
|
|
||||||
"options": "Account"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "is_return",
|
"fieldname": "is_return",
|
||||||
|
Loading…
Reference in New Issue
Block a user