chore: clean up sales invoice form

This commit is contained in:
Saqib Ansari 2021-02-01 15:45:26 +05:30
parent 13d48a0c20
commit cee3670167
8 changed files with 60 additions and 121 deletions

View File

@ -6,6 +6,7 @@
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"period_details_section",
"period_start_date", "period_start_date",
"period_end_date", "period_end_date",
"column_break_3", "column_break_3",
@ -65,7 +66,8 @@
}, },
{ {
"fieldname": "section_break_5", "fieldname": "section_break_5",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "User Details"
}, },
{ {
"fieldname": "company", "fieldname": "company",
@ -121,7 +123,7 @@
"collapsible_depends_on": "eval:doc.docstatus==0", "collapsible_depends_on": "eval:doc.docstatus==0",
"fieldname": "section_break_13", "fieldname": "section_break_13",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Details" "label": "Totals"
}, },
{ {
"default": "0", "default": "0",
@ -196,6 +198,11 @@
"options": "Draft\nSubmitted\nQueued\nCancelled", "options": "Draft\nSubmitted\nQueued\nCancelled",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
},
{
"fieldname": "period_details_section",
"fieldtype": "Section Break",
"label": "Period Details"
} }
], ],
"is_submittable": 1, "is_submittable": 1,
@ -205,7 +212,7 @@
"link_fieldname": "pos_closing_entry" "link_fieldname": "pos_closing_entry"
} }
], ],
"modified": "2021-01-12 12:21:05.388650", "modified": "2021-02-01 13:47:20.722104",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Closing Entry", "name": "POS Closing Entry",

View File

@ -13,11 +13,11 @@
"customer", "customer",
"customer_name", "customer_name",
"tax_id", "tax_id",
"is_pos",
"pos_profile", "pos_profile",
"offline_pos_name",
"is_return",
"consolidated_invoice", "consolidated_invoice",
"is_pos",
"is_return",
"update_billed_amount_in_sales_order",
"column_break1", "column_break1",
"company", "company",
"posting_date", "posting_date",
@ -25,10 +25,7 @@
"set_posting_time", "set_posting_time",
"due_date", "due_date",
"amended_from", "amended_from",
"returns",
"return_against", "return_against",
"column_break_21",
"update_billed_amount_in_sales_order",
"accounting_dimensions_section", "accounting_dimensions_section",
"project", "project",
"dimension_col_break", "dimension_col_break",
@ -183,8 +180,7 @@
"column_break_140", "column_break_140",
"auto_repeat", "auto_repeat",
"update_auto_repeat_reference", "update_auto_repeat_reference",
"against_income_account", "against_income_account"
"pos_total_qty"
], ],
"fields": [ "fields": [
{ {
@ -265,14 +261,6 @@
"options": "POS Profile", "options": "POS Profile",
"print_hide": 1 "print_hide": 1
}, },
{
"fieldname": "offline_pos_name",
"fieldtype": "Data",
"hidden": 1,
"label": "Offline POS Name",
"print_hide": 1,
"read_only": 1
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"default": "0", "default": "0",
@ -348,26 +336,16 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"depends_on": "return_against",
"fieldname": "returns",
"fieldtype": "Section Break",
"label": "Returns"
},
{ {
"depends_on": "return_against", "depends_on": "return_against",
"fieldname": "return_against", "fieldname": "return_against",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Return Against POS Invoice", "label": "Return Against",
"no_copy": 1, "no_copy": 1,
"options": "POS Invoice", "options": "POS Invoice",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "column_break_21",
"fieldtype": "Column Break"
},
{ {
"default": "0", "default": "0",
"depends_on": "eval: doc.is_return && doc.return_against", "depends_on": "eval: doc.is_return && doc.return_against",
@ -587,19 +565,21 @@
}, },
{ {
"fieldname": "sec_warehouse", "fieldname": "sec_warehouse",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Warehouse"
}, },
{ {
"depends_on": "update_stock", "depends_on": "update_stock",
"fieldname": "set_warehouse", "fieldname": "set_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Set Source Warehouse", "label": "Source Warehouse",
"options": "Warehouse", "options": "Warehouse",
"print_hide": 1 "print_hide": 1
}, },
{ {
"fieldname": "items_section", "fieldname": "items_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "fa fa-shopping-cart" "options": "fa fa-shopping-cart"
}, },
@ -1501,7 +1481,7 @@
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "sales_team", "fieldname": "sales_team",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Sales Team1", "label": "Sales Team",
"oldfieldname": "sales_team", "oldfieldname": "sales_team",
"oldfieldtype": "Table", "oldfieldtype": "Table",
"options": "Sales Team", "options": "Sales Team",
@ -1560,15 +1540,6 @@
"print_hide": 1, "print_hide": 1,
"report_hide": 1 "report_hide": 1
}, },
{
"fieldname": "pos_total_qty",
"fieldtype": "Float",
"hidden": 1,
"label": "Total Qty",
"print_hide": 1,
"print_hide_if_no_value": 1,
"read_only": 1
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "consolidated_invoice", "fieldname": "consolidated_invoice",
@ -1581,7 +1552,7 @@
"icon": "fa fa-file-text", "icon": "fa fa-file-text",
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-10-30 13:56:51.056083", "modified": "2021-02-01 15:03:33.800707",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Invoice", "name": "POS Invoice",
@ -1626,7 +1597,6 @@
"role": "All" "role": "All"
} }
], ],
"quick_entry": 1,
"search_fields": "posting_date, due_date, customer, base_grand_total, outstanding_amount", "search_fields": "posting_date, due_date, customer, base_grand_total, outstanding_amount",
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "modified", "sort_field": "modified",

View File

@ -6,11 +6,10 @@
"doctype": "DocType", "doctype": "DocType",
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"disabled",
"section_break_2",
"customer",
"company", "company",
"customer",
"country", "country",
"disabled",
"column_break_9", "column_break_9",
"warehouse", "warehouse",
"campaign", "campaign",
@ -61,10 +60,6 @@
"fieldtype": "Check", "fieldtype": "Check",
"label": "Disabled" "label": "Disabled"
}, },
{
"fieldname": "section_break_2",
"fieldtype": "Section Break"
},
{ {
"fieldname": "customer", "fieldname": "customer",
"fieldtype": "Link", "fieldtype": "Link",
@ -348,9 +343,9 @@
"label": "Allow User to Edit Discount" "label": "Allow User to Edit Discount"
}, },
{ {
"collapsible": 1,
"fieldname": "section_break_23", "fieldname": "section_break_23",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Filters"
}, },
{ {
"fieldname": "column_break_25", "fieldname": "column_break_25",
@ -360,8 +355,29 @@
"icon": "icon-cog", "icon": "icon-cog",
"idx": 1, "idx": 1,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [
"modified": "2021-01-06 14:42:41.713864", {
"group": "Invoices",
"link_doctype": "Sales Invoice",
"link_fieldname": "pos_profile"
},
{
"group": "Invoices",
"link_doctype": "POS Invoice",
"link_fieldname": "pos_profile"
},
{
"group": "Opening & Closing",
"link_doctype": "POS Opening Entry",
"link_fieldname": "pos_profile"
},
{
"group": "Opening & Closing",
"link_doctype": "POS Closing Entry",
"link_fieldname": "pos_profile"
}
],
"modified": "2021-02-01 13:52:51.081311",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Profile", "name": "POS Profile",

View File

@ -1,14 +0,0 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'pos_profile',
'transactions': [
{
'items': ['Sales Invoice', 'POS Closing Entry', 'POS Opening Entry']
}
]
}

View File

@ -12,11 +12,11 @@
"customer", "customer",
"customer_name", "customer_name",
"tax_id", "tax_id",
"pos_profile",
"is_pos", "is_pos",
"is_consolidated", "is_consolidated",
"pos_profile",
"offline_pos_name",
"is_return", "is_return",
"update_billed_amount_in_sales_order",
"column_break1", "column_break1",
"company", "company",
"company_tax_id", "company_tax_id",
@ -24,11 +24,8 @@
"posting_time", "posting_time",
"set_posting_time", "set_posting_time",
"due_date", "due_date",
"amended_from",
"returns",
"return_against", "return_against",
"column_break_21", "amended_from",
"update_billed_amount_in_sales_order",
"accounting_dimensions_section", "accounting_dimensions_section",
"project", "project",
"dimension_col_break", "dimension_col_break",
@ -188,8 +185,7 @@
"column_break_140", "column_break_140",
"auto_repeat", "auto_repeat",
"update_auto_repeat_reference", "update_auto_repeat_reference",
"against_income_account", "against_income_account"
"pos_total_qty"
], ],
"fields": [ "fields": [
{ {
@ -296,16 +292,6 @@
"options": "POS Profile", "options": "POS Profile",
"print_hide": 1 "print_hide": 1
}, },
{
"fieldname": "offline_pos_name",
"fieldtype": "Data",
"hidden": 1,
"hide_days": 1,
"hide_seconds": 1,
"label": "Offline POS Name",
"print_hide": 1,
"read_only": 1
},
{ {
"default": "0", "default": "0",
"fieldname": "is_return", "fieldname": "is_return",
@ -404,33 +390,19 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"depends_on": "return_against",
"fieldname": "returns",
"fieldtype": "Section Break",
"hide_days": 1,
"hide_seconds": 1,
"label": "Returns"
},
{ {
"depends_on": "return_against", "depends_on": "return_against",
"fieldname": "return_against", "fieldname": "return_against",
"fieldtype": "Link", "fieldtype": "Link",
"hide_days": 1, "hide_days": 1,
"hide_seconds": 1, "hide_seconds": 1,
"label": "Return Against Sales Invoice", "label": "Return Against",
"no_copy": 1, "no_copy": 1,
"options": "Sales Invoice", "options": "Sales Invoice",
"print_hide": 1, "print_hide": 1,
"read_only": 1, "read_only": 1,
"search_index": 1 "search_index": 1
}, },
{
"fieldname": "column_break_21",
"fieldtype": "Column Break",
"hide_days": 1,
"hide_seconds": 1
},
{ {
"default": "0", "default": "0",
"depends_on": "eval: doc.is_return && doc.return_against", "depends_on": "eval: doc.is_return && doc.return_against",
@ -678,7 +650,8 @@
"fieldname": "sec_warehouse", "fieldname": "sec_warehouse",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hide_days": 1, "hide_days": 1,
"hide_seconds": 1 "hide_seconds": 1,
"label": "Warehouse"
}, },
{ {
"depends_on": "update_stock", "depends_on": "update_stock",
@ -686,7 +659,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hide_days": 1, "hide_days": 1,
"hide_seconds": 1, "hide_seconds": 1,
"label": "Set Source Warehouse", "label": "Source Warehouse",
"options": "Warehouse", "options": "Warehouse",
"print_hide": 1 "print_hide": 1
}, },
@ -695,6 +668,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hide_days": 1, "hide_days": 1,
"hide_seconds": 1, "hide_seconds": 1,
"label": "Items",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "fa fa-shopping-cart" "options": "fa fa-shopping-cart"
}, },
@ -1904,17 +1878,6 @@
"print_hide": 1, "print_hide": 1,
"report_hide": 1 "report_hide": 1
}, },
{
"fieldname": "pos_total_qty",
"fieldtype": "Float",
"hidden": 1,
"hide_days": 1,
"hide_seconds": 1,
"label": "Total Qty",
"print_hide": 1,
"print_hide_if_no_value": 1,
"read_only": 1
},
{ {
"collapsible": 1, "collapsible": 1,
"fieldname": "accounting_dimensions_section", "fieldname": "accounting_dimensions_section",
@ -1995,7 +1958,7 @@
"link_fieldname": "consolidated_invoice" "link_fieldname": "consolidated_invoice"
} }
], ],
"modified": "2021-01-12 12:16:15.192520", "modified": "2021-02-01 15:42:26.261540",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",

View File

@ -239,9 +239,6 @@ class calculate_taxes_and_totals(object):
self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"]) self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"])
if self.doc.doctype == 'Sales Invoice' and self.doc.is_pos:
self.doc.pos_total_qty = self.doc.total_qty
def calculate_taxes(self): def calculate_taxes(self):
self.doc.rounding_adjustment = 0 self.doc.rounding_adjustment = 0
# maintain actual tax rate based on idx # maintain actual tax rate based on idx

View File

@ -15,7 +15,7 @@ def execute():
log.pos_closing_entry = ( log.pos_closing_entry = (
SELECT clo_ref.parent FROM `tabPOS Invoice Reference` clo_ref SELECT clo_ref.parent FROM `tabPOS Invoice Reference` clo_ref
WHERE clo_ref.pos_invoice = log_ref.pos_invoice WHERE clo_ref.pos_invoice = log_ref.pos_invoice
AND clo_ref.parenttype = 'POS Closing Entry' AND clo_ref.parenttype = 'POS Closing Entry' LIMIT 1
) )
WHERE WHERE
log_ref.parent = log.name log_ref.parent = log.name

View File

@ -127,7 +127,7 @@ def make_custom_fields(update=True):
options="\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), vat_collectability_options)), options="\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), vat_collectability_options)),
fetch_from="company.vat_collectability"), fetch_from="company.vat_collectability"),
dict(fieldname='sb_e_invoicing_reference', label='E-Invoicing', dict(fieldname='sb_e_invoicing_reference', label='E-Invoicing',
fieldtype='Section Break', insert_after='pos_total_qty', print_hide=1), fieldtype='Section Break', insert_after='against_income_account', print_hide=1),
dict(fieldname='company_tax_id', label='Company Tax ID', dict(fieldname='company_tax_id', label='Company Tax ID',
fieldtype='Data', insert_after='sb_e_invoicing_reference', print_hide=1, read_only=1, fieldtype='Data', insert_after='sb_e_invoicing_reference', print_hide=1, read_only=1,
fetch_from="company.tax_id"), fetch_from="company.tax_id"),