Browse Source
Merge pull request #16748 from nabinhait/multi-company-serial-invoicing
fix: Validate serial no usage in invoice considering multi company transaction
develop
Saurabh
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
3 deletions
-
erpnext/accounts/doctype/sales_invoice/sales_invoice.py
|
|
@ -1012,9 +1012,10 @@ class SalesInvoice(SellingController): |
|
|
|
for serial_no in item.serial_no.split("\n"): |
|
|
|
sales_invoice = frappe.db.get_value("Serial No", serial_no, "sales_invoice") |
|
|
|
if sales_invoice and self.name != sales_invoice: |
|
|
|
frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}".format( |
|
|
|
serial_no, sales_invoice |
|
|
|
))) |
|
|
|
sales_invoice_company = frappe.db.get_value("Sales Invoice", sales_invoice, "company") |
|
|
|
if sales_invoice_company == self.company: |
|
|
|
frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}" |
|
|
|
.format(serial_no, sales_invoice))) |
|
|
|
|
|
|
|
def update_project(self): |
|
|
|
if self.project: |
|
|
|