'SalesInvoice' Save error

Hi,
In the latest build when we are trying to save a Sales Invoice we are getting an error
AttributeError: ‘SalesInvoice’ object has no attribute ‘inter_company_invoice_reference’

Full stack trace is as follows:

Something went wrong
Did not save
Server Error: Please check your server logs or contact tech support.
Traceback (most recent call last):
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 283, in _save
self.insert()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 222, in insert
self.run_before_save_methods()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 869, in run_before_save_methods
self.run_method(“validate”)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 765, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 1040, in composer
return composed(self, method, *args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 1023, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 759, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 76, in validate
validate_inter_company_party(self.doctype, self.customer, self.company, self.inter_company_invoice_reference)
AttributeError: ‘SalesInvoice’ object has no attribute ‘inter_company_invoice_reference’

Traceback (most recent call last):
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.handler.handle()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/init.py”, line 942, in call
return fn(*args, **newargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in save
return self._save(*args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 283, in _save
self.insert()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 222, in insert
self.run_before_save_methods()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 869, in run_before_save_methods
self.run_method(“validate”)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 765, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 1040, in composer
return composed(self, method, *args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 1023, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 759, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 76, in validate
validate_inter_company_party(self.doctype, self.customer, self.company, self.inter_company_invoice_reference)
AttributeError: ‘SalesInvoice’ object has no attribute ‘inter_company_invoice_reference’

-Amit

Hi @Amit_Saxena,

Please try a bench migrate and let us know if the error still persists.

@shreya115 Thanks for the quick reply. Unfortunately it didnot help.

-Amit

@Amit_Saxena, Please try bench update --reset, it will fix it.

@shreya115 Even that doesnot help.

-Amit

There are a lot of tables we are facing problem. It seems that the patches during last update for us did not apply. Is there any way to run those patches again?

-Amit

Have you done any changes in codebase or skipped any patch?

@ManasSolanki. Nope Have not made any changes to the code base and have just run bench update.

Where are you using the ERPNext?

Hi @Amit_Saxena

try to use

bench switch-to-master

@ManasSolanki It is installed in google cloud.
@vinhnguyent090 wont the master and develop have a lot of difference? Is it safe to do switch-to-master currently?

@Amit_Saxena Don’t switch to the master
This error shouldn’t be coming if the bench is updated properly.

1 Like

@ManasSolanki yes I think something has gone wrong during update although there was no error. Is it possible to run the patches manually to correct it?

-Amit

Hi @Amit_Saxena

I think master branch code is better than develop branch, just try If can’t run this branch move to run another branch or different version,

@Amit_Saxena

Can you change modified date in the sales_invoice.json file(set today’s date) and run bench migrate again

Facing same problem

@rohit_w’s solution worked for me.

-Amit

1 Like

What you done exactly
Can you tell me in detail

goto frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_invoice. open sales_invoice.json change date modified to today. make sure the time is current. Save it and goto frappe-bench. Run bench migrate.

1 Like