Merge branch 'develop' into sales-commission-payout

This commit is contained in:
Afshan
2021-10-28 13:20:10 +05:30
committed by GitHub
22 changed files with 161 additions and 16 deletions

View File

@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:06:53.083133",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Purchase Invoice",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:06:53.083133",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}

View File

@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 17:50:00.152759",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Sales Invoice",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:13:20.894207",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}

View File

@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:07:19.253457",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Purchase Order",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:07:19.253457",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}

View File

@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:09:08.103919",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Supplier Quotation",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:09:08.103919",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}

View File

@@ -132,7 +132,8 @@ def supplier_query(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select {field} from `tabSupplier`
where docstatus < 2
and ({key} like %(txt)s
or supplier_name like %(txt)s) and disabled=0
or supplier_name like %(txt)s) and disabled=0
and (on_hold = 0 or (on_hold = 1 and CURDATE() > release_date))
{mcond}
order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),

View File

@@ -314,6 +314,8 @@ def make_request_for_quotation(source_name, target_doc=None):
@frappe.whitelist()
def make_customer(source_name, target_doc=None):
def set_missing_values(source, target):
target.opportunity_name = source.name
if source.opportunity_from == "Lead":
target.lead_name = source.party_name

View File

@@ -182,6 +182,7 @@
"reqd": 1
},
{
"default": "1.0",
"fieldname": "qty",
"fieldtype": "Float",
"label": "Qty To Manufacture",
@@ -572,10 +573,11 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2021-08-24 15:14:03.844937",
"modified": "2021-10-27 19:21:35.139888",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order",
"naming_rule": "By \"Naming Series\" field",
"nsm_parent_field": "parent_work_order",
"owner": "Administrator",
"permissions": [

View File

@@ -685,9 +685,7 @@ class WorkOrder(Document):
if not d.operation:
d.operation = operation
else:
# Attribute a big number (999) to idx for sorting putpose in case idx is NULL
# For instance in BOM Explosion Item child table, the items coming from sub assembly items
for item in sorted(item_dict.values(), key=lambda d: d['idx'] or 9999):
for item in sorted(item_dict.values(), key=lambda d: d['idx'] or float('inf')):
self.append('required_items', {
'rate': item.rate,
'amount': item.rate * item.qty,

View File

@@ -113,15 +113,15 @@ function get_filters() {
"fieldname":"period_start_date",
"label": __("Start Date"),
"fieldtype": "Date",
"hidden": 1,
"reqd": 1
"reqd": 1,
"depends_on": "eval:doc.filter_based_on == 'Date Range'"
},
{
"fieldname":"period_end_date",
"label": __("End Date"),
"fieldtype": "Date",
"hidden": 1,
"reqd": 1
"reqd": 1,
"depends_on": "eval:doc.filter_based_on == 'Date Range'"
},
{
"fieldname":"from_fiscal_year",
@@ -129,7 +129,8 @@ function get_filters() {
"fieldtype": "Link",
"options": "Fiscal Year",
"default": frappe.defaults.get_user_default("fiscal_year"),
"reqd": 1
"reqd": 1,
"depends_on": "eval:doc.filter_based_on == 'Fiscal Year'"
},
{
"fieldname":"to_fiscal_year",
@@ -137,7 +138,8 @@ function get_filters() {
"fieldtype": "Link",
"options": "Fiscal Year",
"default": frappe.defaults.get_user_default("fiscal_year"),
"reqd": 1
"reqd": 1,
"depends_on": "eval:doc.filter_based_on == 'Fiscal Year'"
},
{
"fieldname": "periodicity",

View File

@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 15:48:56.416449",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Quotation",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:11:33.553722",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}

View File

@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:04:24.443076",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Sales Order",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:04:24.443076",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}

View File

@@ -25,19 +25,29 @@ class ItemAlternative(Document):
frappe.throw(_("Alternative item must not be same as item code"))
item_meta = frappe.get_meta("Item")
fields = ["is_stock_item", "include_item_in_manufacturing","has_serial_no","has_batch_no"]
item_data = frappe.db.get_values("Item", self.item_code, fields, as_dict=1)
alternative_item_data = frappe.db.get_values("Item", self.alternative_item_code, fields, as_dict=1)
fields = ["is_stock_item", "include_item_in_manufacturing","has_serial_no", "has_batch_no", "allow_alternative_item"]
item_data = frappe.db.get_value("Item", self.item_code, fields, as_dict=1)
alternative_item_data = frappe.db.get_value("Item", self.alternative_item_code, fields, as_dict=1)
for field in fields:
if item_data[0].get(field) != alternative_item_data[0].get(field):
if item_data.get(field) != alternative_item_data.get(field):
raise_exception, alert = [1, False] if field == "is_stock_item" else [0, True]
frappe.msgprint(_("The value of {0} differs between Items {1} and {2}") \
.format(frappe.bold(item_meta.get_label(field)),
frappe.bold(self.alternative_item_code),
frappe.bold(self.item_code)),
alert=alert, raise_exception=raise_exception)
alert=alert, raise_exception=raise_exception, indicator="Orange")
alternate_item_check_msg = _("Allow Alternative Item must be checked on Item {}")
if not item_data.allow_alternative_item:
frappe.throw(alternate_item_check_msg.format(self.item_code))
if self.two_way and not alternative_item_data.allow_alternative_item:
frappe.throw(alternate_item_check_msg.format(self.item_code))
def validate_duplicate(self):
if frappe.db.get_value("Item Alternative", {'item_code': self.item_code,

View File

@@ -0,0 +1,34 @@
{% macro render_row(label, value) %}
<div class="field row">
<div class="col-7 {%- if doc.align_labels_right %} text-right{%- endif -%}">
<div class="label">{{ label }}</div>
</div>
<div class="text-right col-5">
{{ value }}
</div>
</div>
{% endmacro %}
{%- macro render_discount_amount(doc) -%}
{%- if doc.discount_amount -%}
{{ render_row(_(doc.meta.get_label('discount_amount')), '- ' + doc.get_formatted("discount_amount", doc)) }}
{%- endif -%}
{%- endmacro -%}
<div class="row">
<div class="col"></div>
<div class="col">
{%- if doc.apply_discount_on == "Net Total" -%}
{{ render_discount_amount(doc) }}
{%- endif -%}
{%- for charge in doc.taxes -%}
{%- if (charge.tax_amount or print_settings.print_taxes_with_zero_amount) and (not charge.included_in_print_rate or doc.flags.show_inclusive_tax_in_print) -%}
{{ render_row(charge.get_formatted("description"), charge.get_formatted('tax_amount', doc)) }}
{%- endif -%}
{%- endfor -%}
{%- if doc.apply_discount_on == "Grand Total" -%}
{{ render_discount_amount(doc) }}
{%- endif -%}
</div>
</div>