From 80f333950b001efe72408fd0917d90e0f47ac601 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Mon, 16 Oct 2017 11:27:22 +0530 Subject: [PATCH 01/11] [minor] fixed AttributeError: 'GrossProfitGenerator' object has no attribute 'grouped_data' (#11195) --- erpnext/accounts/report/gross_profit/gross_profit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 07f6979c40..78e3faab4e 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -107,6 +107,8 @@ class GrossProfitGenerator(object): def process(self): self.grouped = {} + self.grouped_data = [] + for row in self.si_list: if self.skip_row(row, self.product_bundles): continue @@ -150,7 +152,6 @@ class GrossProfitGenerator(object): def get_average_rate_based_on_group_by(self): # sum buying / selling totals for group - self.grouped_data = [] for key in self.grouped.keys(): if self.filters.get("group_by") != "Invoice": for i, row in enumerate(self.grouped[key]): From 45a640df086b1a847217aa3946f31374a6459172 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 16 Oct 2017 12:58:32 +0530 Subject: [PATCH 02/11] Update payment_entry_reference.json --- .../payment_entry_reference/payment_entry_reference.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json index da17bb3fc8..03341da658 100644 --- a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json +++ b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json @@ -296,7 +296,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-09-04 17:37:01.192312", + "modified": "2017-10-16 17:37:01.192312", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Entry Reference", @@ -311,4 +311,4 @@ "sort_order": "DESC", "track_changes": 1, "track_seen": 0 -} \ No newline at end of file +} From a3fe5b85283f3e943967aef54533759be1dd3ba4 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 18 Oct 2017 10:53:34 +0530 Subject: [PATCH 03/11] [Fix] Disable desk access view to supplier (#11234) --- .../request_for_quotation.json | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json index 44068ce81d..50d6abdd8f 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json @@ -816,7 +816,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-07-21 14:06:46.309322", + "modified": "2017-10-17 17:27:06.281494", "modified_by": "Administrator", "module": "Buying", "name": "Request for Quotation", @@ -903,26 +903,6 @@ "submit": 0, "write": 0 }, - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Supplier", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 - }, { "amend": 0, "apply_user_permissions": 0, From a516856c3278ba4e5c97e8c9b9cd190ed3f26f30 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 18 Oct 2017 11:05:10 +0530 Subject: [PATCH 04/11] [Fix] Getting an error duplicate name while making an invoice in draft mode (#11230) --- erpnext/accounts/doctype/sales_invoice/pos.py | 16 ++++--- .../sales_invoice/test_sales_invoice.py | 45 ++++++++++++++++++- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index ccf8a84021..04f7e1be4f 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -486,17 +486,21 @@ def submit_invoice(si_doc, name, doc, name_list): if frappe.message_log: frappe.message_log.pop() frappe.db.rollback() frappe.log_error(frappe.get_traceback()) - name_list = save_invoice(e, si_doc, name, name_list) + name_list = save_invoice(doc, name, name_list) return name_list -def save_invoice(e, si_doc, name, name_list): +def save_invoice(doc, name, name_list): try: if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}): - si_doc.docstatus = 0 - si_doc.flags.ignore_mandatory = True - si_doc.due_date = si_doc.posting_date - si_doc.insert() + si = frappe.new_doc('Sales Invoice') + si.update(doc) + si.set_posting_time = 1 + si.customer = get_customer_id(doc) + si.due_date = doc.get('posting_date') + si.flags.ignore_mandatory = True + si.insert(ignore_permissions=True) + frappe.db.commit() name_list.append(name) except Exception: frappe.log_error(frappe.get_traceback()) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 900a6e9d95..264f027486 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -3,8 +3,8 @@ from __future__ import unicode_literals import frappe -import unittest, copy -from frappe.utils import nowdate, add_days, flt +import unittest, copy, time +from frappe.utils import nowdate, add_days, flt, cint from frappe.model.dynamic_links import get_dynamic_link_map from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice @@ -665,6 +665,47 @@ class TestSalesInvoice(unittest.TestCase): self.pos_gl_entry(si, pos, 330) + def test_make_pos_invoice_in_draft(self): + from erpnext.accounts.doctype.sales_invoice.pos import make_invoice + from erpnext.stock.doctype.item.test_item import make_item + + set_perpetual_inventory() + + allow_negative_stock = frappe.db.get_single_value('Stock Settings', 'allow_negative_stock') + if allow_negative_stock: + frappe.db.set_value('Stock Settings', None, 'allow_negative_stock', 0) + + make_pos_profile() + timestamp = cint(time.time()) + + item = make_item("_Test POS Item") + pos = copy.deepcopy(test_records[1]) + pos['items'][0]['item_code'] = item.name + pos["is_pos"] = 1 + pos["offline_pos_name"] = timestamp + pos["update_stock"] = 1 + pos["payments"] = [{'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 300}, + {'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': 330}] + + invoice_data = [{timestamp: pos}] + si = make_invoice(invoice_data).get('invoice') + self.assertEquals(si[0], timestamp) + + sales_invoice = frappe.get_all('Sales Invoice', fields =["*"], filters = {'offline_pos_name': timestamp}) + self.assertEquals(sales_invoice[0].docstatus, 0) + + timestamp = cint(time.time()) + pos["offline_pos_name"] = timestamp + invoice_data = [{timestamp: pos}] + si1 = make_invoice(invoice_data).get('invoice') + self.assertEquals(si1[0], timestamp) + + sales_invoice1 = frappe.get_all('Sales Invoice', fields =["*"], filters = {'offline_pos_name': timestamp}) + self.assertEquals(sales_invoice1[0].docstatus, 0) + + if allow_negative_stock: + frappe.db.set_value('Stock Settings', None, 'allow_negative_stock', 1) + def pos_gl_entry(self, si, pos, cash_amount): # check stock ledger entries sle = frappe.db.sql("""select * from `tabStock Ledger Entry` From 5ab6ff24703e2a42aa9e8044bbcdf6a33b55805a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Oct 2017 11:09:11 +0530 Subject: [PATCH 05/11] [fix] Fetch raw material rate based on last purchase rate (#11205) * [fix] Fetch raw material rate based on last purchase rate * Don't fetch sub-assembly item rate from BOM if not mentioned by the user --- erpnext/manufacturing/doctype/bom/bom.py | 36 ++++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index ead5d331dc..b140bf591e 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -147,22 +147,28 @@ class BOM(WebsiteGenerator): if arg.get('scrap_items'): rate = self.get_valuation_rate(arg) elif arg: - if self.rm_cost_as_per == 'Valuation Rate': - rate = self.get_valuation_rate(arg) - elif self.rm_cost_as_per == 'Last Purchase Rate': - rate = arg['last_purchase_rate'] \ - or frappe.db.get_value("Item", arg['item_code'], "last_purchase_rate") - elif self.rm_cost_as_per == "Price List": - if not self.buying_price_list: - frappe.throw(_("Please select Price List")) - rate = frappe.db.get_value("Item Price", - {"price_list": self.buying_price_list, "item_code": arg["item_code"]}, "price_list_rate") - price_list_currency = frappe.db.get_value("Price List", self.buying_price_list, "currency") - if price_list_currency != self.company_currency(): - rate = flt(rate * self.conversion_rate) - - if arg['bom_no'] and (not rate or self.set_rate_of_sub_assembly_item_based_on_bom): + if arg.get('bom_no') and self.set_rate_of_sub_assembly_item_based_on_bom: rate = self.get_bom_unitcost(arg['bom_no']) + else: + if self.rm_cost_as_per == 'Valuation Rate': + rate = self.get_valuation_rate(arg) + elif self.rm_cost_as_per == 'Last Purchase Rate': + rate = arg.get('last_purchase_rate') \ + or frappe.db.get_value("Item", arg['item_code'], "last_purchase_rate") + elif self.rm_cost_as_per == "Price List": + if not self.buying_price_list: + frappe.throw(_("Please select Price List")) + rate = frappe.db.get_value("Item Price", {"price_list": self.buying_price_list, + "item_code": arg["item_code"]}, "price_list_rate") + + price_list_currency = frappe.db.get_value("Price List", + self.buying_price_list, "currency") + if price_list_currency != self.company_currency(): + rate = flt(rate * self.conversion_rate) + + if not rate: + frappe.msgprint(_("{0} not found for Item {1}") + .format(self.rm_cost_as_per, arg["item_code"])) return flt(rate) From 3e4ca4219f9871b812c66b8e5ce381a92444f6db Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 18 Oct 2017 11:16:47 +0530 Subject: [PATCH 06/11] [hotfix] fixed 'ValueError: Unknown string format' error if the from_time value is null (#11162) --- erpnext/projects/doctype/timesheet/timesheet.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index ba1414cf2a..1ea5962911 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -159,9 +159,14 @@ frappe.ui.form.on("Timesheet Detail", { }); var calculate_end_time = function(frm, cdt, cdn) { - var child = locals[cdt][cdn]; + let child = locals[cdt][cdn]; - var d = moment(child.from_time); + if(!child.from_time) { + // if from_time value is not available then set the current datetime + frappe.model.set_value(cdt, cdn, "from_time", frappe.datetime.get_datetime_as_string()); + } + + let d = moment(child.from_time); if(child.hours) { d.add(child.hours, "hours"); frm._setting_hours = true; From 7624e7bf85912e9f0a2b8af093e80e4059a66f53 Mon Sep 17 00:00:00 2001 From: Ranjith Kurungadam Date: Wed, 18 Oct 2017 15:48:12 +0530 Subject: [PATCH 07/11] [hot-fix] sql getting translated (#11243) * fix remove _ in frappe.sql * use %s replacement for sql --- erpnext/healthcare/doctype/consultation/consultation.py | 2 +- erpnext/healthcare/doctype/lab_test/lab_test.py | 4 ++-- erpnext/healthcare/doctype/patient/patient.py | 4 ++-- .../doctype/patient_appointment/patient_appointment.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/healthcare/doctype/consultation/consultation.py b/erpnext/healthcare/doctype/consultation/consultation.py index b8155b9b49..e16c22176c 100755 --- a/erpnext/healthcare/doctype/consultation/consultation.py +++ b/erpnext/healthcare/doctype/consultation/consultation.py @@ -78,7 +78,7 @@ def create_invoice(company, patient, physician, consultation_id): create_invoice_items(physician, sales_invoice, company) sales_invoice.save(ignore_permissions=True) - frappe.db.sql(_("""update tabConsultation set invoice='{0}' where name='{1}'""").format(sales_invoice.name, consultation_id)) + frappe.db.sql("""update tabConsultation set invoice=%s where name=%s""", (sales_invoice.name, consultation_id)) appointment = frappe.db.get_value("Consultation", consultation_id, "appointment") if appointment: frappe.db.set_value("Patient Appointment", appointment, "sales_invoice", sales_invoice.name) diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py index 0daf9cba73..6fd9535ecc 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.py +++ b/erpnext/healthcare/doctype/lab_test/lab_test.py @@ -291,5 +291,5 @@ def create_invoice(company, patient, lab_tests, prescriptions): @frappe.whitelist() def get_lab_test_prescribed(patient): - return frappe.db.sql(_("""select cp.name, cp.test_code, cp.parent, cp.invoice, ct.physician, ct.consultation_date from tabConsultation ct, - `tabLab Prescription` cp where ct.patient='{0}' and cp.parent=ct.name and cp.test_created=0""").format(patient)) + return frappe.db.sql("""select cp.name, cp.test_code, cp.parent, cp.invoice, ct.physician, ct.consultation_date from tabConsultation ct, + `tabLab Prescription` cp where ct.patient=%s and cp.parent=ct.name and cp.test_created=0""", (patient)) diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py index 98526cc027..f4d9a43ea3 100644 --- a/erpnext/healthcare/doctype/patient/patient.py +++ b/erpnext/healthcare/doctype/patient/patient.py @@ -111,10 +111,10 @@ def make_invoice(patient, company): @frappe.whitelist() def get_patient_detail(patient, company=None): - patient_dict = frappe.db.sql(_("""select * from tabPatient where name='{0}'""").format(patient), as_dict=1) + patient_dict = frappe.db.sql("""select * from tabPatient where name=%s""", (patient), as_dict=1) if not patient_dict: frappe.throw("Patient not found") - vital_sign = frappe.db.sql(_("""select * from `tabVital Signs` where patient='{0}' order by signs_date desc limit 1""").format(patient), as_dict=1) + vital_sign = frappe.db.sql("""select * from `tabVital Signs` where patient=%s order by signs_date desc limit 1""", (patient), as_dict=1) details = patient_dict[0] if vital_sign: diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py index eab2f2d004..2647034f78 100755 --- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py +++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py @@ -125,7 +125,7 @@ def create_invoice(company, physician, patient, appointment_id, appointment_date create_invoice_items(appointment_id, physician, company, sales_invoice) sales_invoice.save(ignore_permissions=True) - frappe.db.sql(_("""update `tabPatient Appointment` set sales_invoice='{0}' where name='{1}'""").format(sales_invoice.name, appointment_id)) + frappe.db.sql("""update `tabPatient Appointment` set sales_invoice=%s where name=%s""", (sales_invoice.name, appointment_id)) frappe.db.set_value("Fee Validity", fee_validity.name, "ref_invoice", sales_invoice.name) consultation = frappe.db.exists({ "doctype": "Consultation", From a7d5f94d4a8aee612b611dcbb5d9e9b6c002eb84 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 18 Oct 2017 16:02:08 +0530 Subject: [PATCH 08/11] [fix] Do not append description to variant if description already exists (#11204) --- erpnext/controllers/item_variant.py | 7 +-- erpnext/patches.txt | 1 + .../v9_0/set_variant_item_description.py | 47 +++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 erpnext/patches/v9_0/set_variant_item_description.py diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 513b97f53a..8ca4f7096c 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -205,9 +205,10 @@ def copy_attributes_to_variant(item, variant): if item.variant_based_on=='Item Attribute': if variant.attributes: - variant.description += "\n" - for d in variant.attributes: - variant.description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" + if not variant.description: + variant.description += "\n" + for d in variant.attributes: + variant.description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" def make_variant_item_code(template_item_code, template_item_name, variant): """Uses template's item code and abbreviations to make variant's item code""" diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0b9e8264ee..e7c0614b7a 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -450,3 +450,4 @@ erpnext.patches.v8_9.set_default_fields_in_variant_settings erpnext.patches.v8_9.update_billing_gstin_for_indian_account erpnext.patches.v9_0.fix_subscription_next_date erpnext.patches.v9_0.add_healthcare_domain +erpnext.patches.v9_0.set_variant_item_description diff --git a/erpnext/patches/v9_0/set_variant_item_description.py b/erpnext/patches/v9_0/set_variant_item_description.py new file mode 100644 index 0000000000..8093b04e2f --- /dev/null +++ b/erpnext/patches/v9_0/set_variant_item_description.py @@ -0,0 +1,47 @@ +import frappe +from frappe.utils import cstr + +def execute(): + ''' + Issue: + While copying data from template item to variant item, + the system appending description multiple times to the respective variant. + + Purpose: + Check variant description, + if variant have user defined description remove all system appended descriptions + else replace multiple system generated descriptions with single description + + Steps: + 1. Get all variant items + 2. Create system generated variant description + 3. If variant have user defined description, remove all system generated descriptions + 4. If variant description only contains system generated description, + replace multiple descriptions by new description. + ''' + for item in frappe.db.sql(""" select name from tabItem + where ifnull(variant_of, '') != '' """,as_dict=1): + variant = frappe.get_doc("Item", item.name) + temp_variant_description = '\n' + + if variant.attributes: + for d in variant.attributes: + temp_variant_description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" + + variant_description = variant.description.replace(temp_variant_description, '').rstrip() + if variant_description: + splitted_desc = variant.description.strip().split(temp_variant_description) + + if len(splitted_desc) > 2: + if splitted_desc[0] == '': + variant_description = temp_variant_description + variant_description + elif splitted_desc[1] == '' or splitted_desc[1] == '\n': + variant_description += temp_variant_description + + variant.db_set('description', variant_description, update_modified=False) + + else: + variant.db_set('description', temp_variant_description, update_modified=False) + + variant.flags.ignore_permissions=True + variant.save() \ No newline at end of file From 8227422124dd2622474010d296881be9fbeec609 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 18 Oct 2017 16:03:26 +0530 Subject: [PATCH 09/11] [fix] remove explicit variant save --- erpnext/patches/v9_0/set_variant_item_description.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/patches/v9_0/set_variant_item_description.py b/erpnext/patches/v9_0/set_variant_item_description.py index 8093b04e2f..fdc4fc781a 100644 --- a/erpnext/patches/v9_0/set_variant_item_description.py +++ b/erpnext/patches/v9_0/set_variant_item_description.py @@ -41,7 +41,4 @@ def execute(): variant.db_set('description', variant_description, update_modified=False) else: - variant.db_set('description', temp_variant_description, update_modified=False) - - variant.flags.ignore_permissions=True - variant.save() \ No newline at end of file + variant.db_set('description', temp_variant_description, update_modified=False) \ No newline at end of file From 3173be9b1791626e403a13e4988964f5d4ca6246 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 18 Oct 2017 16:14:11 +0530 Subject: [PATCH 10/11] [minor-fix] patch fix --- erpnext/patches/v9_0/set_variant_item_description.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v9_0/set_variant_item_description.py b/erpnext/patches/v9_0/set_variant_item_description.py index fdc4fc781a..c844571506 100644 --- a/erpnext/patches/v9_0/set_variant_item_description.py +++ b/erpnext/patches/v9_0/set_variant_item_description.py @@ -27,7 +27,7 @@ def execute(): if variant.attributes: for d in variant.attributes: temp_variant_description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" - + variant_description = variant.description.replace(temp_variant_description, '').rstrip() if variant_description: splitted_desc = variant.description.strip().split(temp_variant_description) @@ -37,8 +37,9 @@ def execute(): variant_description = temp_variant_description + variant_description elif splitted_desc[1] == '' or splitted_desc[1] == '\n': variant_description += temp_variant_description - - variant.db_set('description', variant_description, update_modified=False) + variant.db_set('description', variant_description, update_modified=False) + else: + variant.db_set('description', variant_description, update_modified=False) else: variant.db_set('description', temp_variant_description, update_modified=False) \ No newline at end of file From 47e405516b7e10980efe6366efcb0681f93df7c8 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 18 Oct 2017 16:53:43 +0600 Subject: [PATCH 11/11] bumped to version 9.1.6 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1a9883516c..42f538df66 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.1.5' +__version__ = '9.1.6' def get_default_company(user=None): '''Get default company for user'''