Fixes in Taxes, Quotation and Address Territory
This commit is contained in:
parent
33e1db8c40
commit
ac32bad25a
@ -27,6 +27,7 @@ class AccountsController(TransactionBase):
|
||||
self.set(fieldname, today())
|
||||
if not self.fiscal_year:
|
||||
self.fiscal_year = get_fiscal_year(self.get(fieldname))[0]
|
||||
break
|
||||
|
||||
def validate_date_with_fiscal_year(self):
|
||||
if self.meta.get_field("fiscal_year") :
|
||||
@ -125,12 +126,15 @@ class AccountsController(TransactionBase):
|
||||
tax_master = frappe.get_doc(tax_master_doctype, self.get(tax_master_field))
|
||||
|
||||
for i, tax in enumerate(tax_master.get(tax_parentfield)):
|
||||
tax = tax.as_dict()
|
||||
|
||||
for fieldname in default_fields:
|
||||
tax.set(fieldname, None)
|
||||
if fieldname in tax:
|
||||
del tax[fieldname]
|
||||
|
||||
self.append(tax_parentfield, tax)
|
||||
|
||||
def get_other_charges(self):
|
||||
def set_other_charges(self):
|
||||
self.set("other_charges", [])
|
||||
self.set_taxes("other_charges", "taxes_and_charges")
|
||||
|
||||
|
@ -62,14 +62,36 @@ class SellingController(StockController):
|
||||
shipping_amount = condition.shipping_amount
|
||||
break
|
||||
|
||||
self.append("other_charges", {
|
||||
shipping_charge = {
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
"charge_type": "Actual",
|
||||
"account_head": shipping_rule.account,
|
||||
"cost_center": shipping_rule.cost_center,
|
||||
"description": shipping_rule.label,
|
||||
"rate": shipping_amount
|
||||
"cost_center": shipping_rule.cost_center
|
||||
}
|
||||
|
||||
existing_shipping_charge = self.get("other_charges", filters=shipping_charge)
|
||||
if existing_shipping_charge:
|
||||
# take the last record found
|
||||
existing_shipping_charge[-1].rate = shipping_amount
|
||||
else:
|
||||
shipping_charge["rate"] = shipping_amount
|
||||
shipping_charge["description"] = shipping_rule.label
|
||||
self.append("other_charges", shipping_charge)
|
||||
|
||||
self.calculate_taxes_and_totals()
|
||||
|
||||
def remove_shipping_charge(self):
|
||||
if self.shipping_rule:
|
||||
shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)
|
||||
existing_shipping_charge = self.get("other_charges", {
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
"charge_type": "Actual",
|
||||
"account_head": shipping_rule.account,
|
||||
"cost_center": shipping_rule.cost_center
|
||||
})
|
||||
if existing_shipping_charge:
|
||||
self.get("other_charges").remove(existing_shipping_charge[-1])
|
||||
self.calculate_taxes_and_totals()
|
||||
|
||||
def set_total_in_words(self):
|
||||
from frappe.utils import money_in_words
|
||||
@ -242,6 +264,9 @@ class SellingController(StockController):
|
||||
self.precision("total_commission"))
|
||||
|
||||
def calculate_contribution(self):
|
||||
if not self.meta.get_field("sales_team"):
|
||||
return
|
||||
|
||||
total = 0.0
|
||||
sales_team = self.get("sales_team")
|
||||
for sales_person in sales_team:
|
||||
|
@ -716,7 +716,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
if(this.frm.doc.taxes_and_charges) {
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "get_other_charges",
|
||||
method: "set_other_charges",
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
me.calculate_taxes_and_totals();
|
||||
|
@ -1,26 +1,26 @@
|
||||
[
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"customer_group": "_Test Customer Group",
|
||||
"customer_name": "_Test Customer",
|
||||
"customer_type": "Individual",
|
||||
"doctype": "Customer",
|
||||
"company": "_Test Company",
|
||||
"customer_group": "_Test Customer Group",
|
||||
"customer_name": "_Test Customer",
|
||||
"customer_type": "Individual",
|
||||
"doctype": "Customer",
|
||||
"territory": "_Test Territory"
|
||||
},
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"customer_group": "_Test Customer Group",
|
||||
"customer_name": "_Test Customer 1",
|
||||
"customer_type": "Individual",
|
||||
"doctype": "Customer",
|
||||
"company": "_Test Company",
|
||||
"customer_group": "_Test Customer Group",
|
||||
"customer_name": "_Test Customer 1",
|
||||
"customer_type": "Individual",
|
||||
"doctype": "Customer",
|
||||
"territory": "_Test Territory"
|
||||
},
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"customer_group": "_Test Customer Group",
|
||||
"customer_name": "_Test Customer 2",
|
||||
"customer_type": "Individual",
|
||||
"doctype": "Customer",
|
||||
"company": "_Test Company",
|
||||
"customer_group": "_Test Customer Group",
|
||||
"customer_name": "_Test Customer 2",
|
||||
"customer_type": "Individual",
|
||||
"doctype": "Customer",
|
||||
"territory": "_Test Territory"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -33,6 +33,10 @@ class Lead(SellingController):
|
||||
if not validate_email_add(self.email_id):
|
||||
frappe.throw(_('{0} is not a valid email id').format(self.email_id))
|
||||
|
||||
if self.email_id == self.lead_owner:
|
||||
# Lead Owner cannot be same as the Lead
|
||||
self.lead_owner = None
|
||||
|
||||
def on_update(self):
|
||||
self.check_email_id_is_unique()
|
||||
self.add_calendar_event()
|
||||
|
@ -1,27 +1,27 @@
|
||||
[
|
||||
{
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead@example.com",
|
||||
"lead_name": "_Test Lead",
|
||||
"status": "Open",
|
||||
"territory": "_Test Territory"
|
||||
},
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead@example.com",
|
||||
"lead_name": "_Test Lead",
|
||||
"status": "Open",
|
||||
"territory": "_Test Territory Rest Of The World"
|
||||
},
|
||||
{
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead1@example.com",
|
||||
"lead_name": "_Test Lead 1",
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead1@example.com",
|
||||
"lead_name": "_Test Lead 1",
|
||||
"status": "Open"
|
||||
},
|
||||
},
|
||||
{
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead2@example.com",
|
||||
"lead_name": "_Test Lead 2",
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead2@example.com",
|
||||
"lead_name": "_Test Lead 2",
|
||||
"status": "Contacted"
|
||||
},
|
||||
},
|
||||
{
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead3@example.com",
|
||||
"lead_name": "_Test Lead 3",
|
||||
"doctype": "Lead",
|
||||
"email_id": "test_lead3@example.com",
|
||||
"lead_name": "_Test Lead 3",
|
||||
"status": "Converted"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -13,6 +13,14 @@ class Quotation(SellingController):
|
||||
tname = 'Quotation Item'
|
||||
fname = 'quotation_details'
|
||||
|
||||
def validate(self):
|
||||
super(Quotation, self).validate()
|
||||
self.set_status()
|
||||
self.validate_order_type()
|
||||
self.validate_for_items()
|
||||
self.validate_uom_is_integer("stock_uom", "qty")
|
||||
self.quotation_to = "Customer" if self.customer else "Lead"
|
||||
|
||||
def has_sales_order(self):
|
||||
return frappe.db.get_value("Sales Order Item", {"prevdoc_docname": self.name, "docstatus": 1})
|
||||
|
||||
@ -42,13 +50,6 @@ class Quotation(SellingController):
|
||||
if is_sales_item == 'No':
|
||||
frappe.throw(_("Item {0} must be Sales Item").format(d.item_code))
|
||||
|
||||
def validate(self):
|
||||
super(Quotation, self).validate()
|
||||
self.set_status()
|
||||
self.validate_order_type()
|
||||
self.validate_for_items()
|
||||
self.validate_uom_is_integer("stock_uom", "qty")
|
||||
|
||||
def update_opportunity(self):
|
||||
for opportunity in list(set([d.prevdoc_docname for d in self.get("quotation_details")])):
|
||||
if opportunity:
|
||||
|
@ -21,3 +21,4 @@ class Territory(NestedSet):
|
||||
def on_update(self):
|
||||
super(Territory, self).on_update()
|
||||
self.validate_one_root()
|
||||
|
||||
|
@ -1,248 +1,252 @@
|
||||
[
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item",
|
||||
"item_group": "_Test Item Group",
|
||||
"item_name": "_Test Item",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item",
|
||||
"item_group": "_Test Item Group",
|
||||
"item_name": "_Test Item",
|
||||
"item_reorder": [
|
||||
{
|
||||
"doctype": "Item Reorder",
|
||||
"material_request_type": "Purchase",
|
||||
"parentfield": "item_reorder",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"warehouse_reorder_level": 20,
|
||||
"doctype": "Item Reorder",
|
||||
"material_request_type": "Purchase",
|
||||
"parentfield": "item_reorder",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"warehouse_reorder_level": 20,
|
||||
"warehouse_reorder_qty": 20
|
||||
}
|
||||
],
|
||||
"selling_cost_center": "_Test Cost Center - _TC",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
],
|
||||
"selling_cost_center": "_Test Cost Center - _TC",
|
||||
"stock_uom": "_Test UOM",
|
||||
"show_in_website": 1,
|
||||
"website_warehouse": "_Test Warehouse - _TC"
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item 2",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item 2",
|
||||
"item_group": "_Test Item Group",
|
||||
"item_name": "_Test Item 2",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item 2",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item 2",
|
||||
"item_group": "_Test Item Group",
|
||||
"item_name": "_Test Item 2",
|
||||
"stock_uom": "_Test UOM",
|
||||
"show_in_website": 1,
|
||||
"website_warehouse": "_Test Warehouse - _TC"
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item Home Desktop 100",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_manufactured_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop 100",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item Home Desktop 100",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_manufactured_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop 100",
|
||||
"item_tax": [
|
||||
{
|
||||
"doctype": "Item Tax",
|
||||
"parentfield": "item_tax",
|
||||
"tax_rate": 10,
|
||||
"doctype": "Item Tax",
|
||||
"parentfield": "item_tax",
|
||||
"tax_rate": 10,
|
||||
"tax_type": "_Test Account Excise Duty - _TC"
|
||||
}
|
||||
],
|
||||
],
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item Home Desktop 200",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_manufactured_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item Home Desktop 200",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop 200",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item Home Desktop 200",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_manufactured_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item Home Desktop 200",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop 200",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "_Test Sales BOM Item",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "No",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Sales BOM Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Sales BOM Item",
|
||||
"description": "_Test Sales BOM Item",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "No",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Sales BOM Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Sales BOM Item",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test FG Item",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "Yes",
|
||||
"item_code": "_Test FG Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test FG Item",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test FG Item",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "Yes",
|
||||
"item_code": "_Test FG Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test FG Item",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "_Test Non Stock Item",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "No",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Non Stock Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Non Stock Item",
|
||||
"description": "_Test Non Stock Item",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "No",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Non Stock Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Non Stock Item",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Serialized Item",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "Yes",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Serialized Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Serialized Item",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Serialized Item",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "Yes",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Serialized Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Serialized Item",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Serialized Item",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "Yes",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Serialized Item With Series",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Serialized Item With Series",
|
||||
"serial_no_series": "ABCD.#####",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Serialized Item",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "Yes",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Serialized Item With Series",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Serialized Item With Series",
|
||||
"serial_no_series": "ABCD.#####",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item Home Desktop Manufactured",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_manufactured_item": "Yes",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item Home Desktop Manufactured",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop Manufactured",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Item Home Desktop Manufactured",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_manufactured_item": "Yes",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"item_code": "_Test Item Home Desktop Manufactured",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop Manufactured",
|
||||
"stock_uom": "_Test UOM"
|
||||
},
|
||||
},
|
||||
{
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test FG Item 2",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "Yes",
|
||||
"item_code": "_Test FG Item 2",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test FG Item 2",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test FG Item 2",
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "Yes",
|
||||
"item_code": "_Test FG Item 2",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test FG Item 2",
|
||||
"stock_uom": "_Test UOM"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -1,8 +1,20 @@
|
||||
[
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item",
|
||||
"price_list": "_Test Price List",
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item",
|
||||
"price_list": "_Test Price List",
|
||||
"price_list_rate": 100
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item",
|
||||
"price_list": "_Test Price List Rest of the World",
|
||||
"price_list_rate": 10
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item 2",
|
||||
"price_list": "_Test Price List Rest of the World",
|
||||
"price_list_rate": 20
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -73,3 +73,18 @@ def get_address_display(address_dict):
|
||||
|
||||
return display.strip()
|
||||
|
||||
def get_territory_from_address(address):
|
||||
"""Tries to match city, state and country of address to existing territory"""
|
||||
if not address:
|
||||
return
|
||||
|
||||
if isinstance(address, basestring):
|
||||
address = frappe.get_doc("Address", address)
|
||||
|
||||
territory = None
|
||||
for fieldname in ("city", "state", "country"):
|
||||
territory = frappe.db.get_value("Territory", address.get(fieldname))
|
||||
if territory:
|
||||
break
|
||||
|
||||
return territory
|
||||
|
Loading…
Reference in New Issue
Block a user