I need to create a new app for this?, I mean the file hooks.py that he’s making reference to is the hooks.py of the new app? or is the hooks.py from
/frappe-bench/apps/erpnext/erpnext?
in the line:
“validate”: “sf_custom_changes.sf_acc.purchase.validate_bill_no”
what’s the format to call the function validate_bill_no?
If I need create the app for this where I should place the file purchase.py?
There is a check box in the Account settings which when checked will check for supplier invoice number uniqueness. Please refer the screenshot attached.
And to avoid merge conflicts with update changes to frappe and erpnext, put your custom code in your own app module. (At this point I am not sure that applies for client-side code but definately server-side changes.)
Before you go too far the superb docs will help keep you out of trouble
it sound like a bug …it should check supplier and invoice number so if u have invoice number 123 for 2 different suppliers it should work …can u double check if supplier has another invoice number 123?
frappe.db.sql('''select name from `tabPurchase Invoice`
where
bill_no = %(bill_no)s
and name != %(name)s
and docstatus < 2
and posting_date between %(year_start_date)s and %(year_end_date)s''', {
"bill_no": self.bill_no,
"name": self.name,
"year_start_date": fiscal_year.year_start_date,
"year_end_date": fiscal_year.year_end_date
})
it seems supplier id is not in the query …probably it should be kind of:
frappe.db.sql('''select name from `tabPurchase Invoice`
where
bill_no = %(bill_no)s
and supplier = %(supplier)s
and name != %(name)s
and docstatus < 2
and posting_date between %(year_start_date)s and %(year_end_date)s''', {
"bill_no": self.bill_no,
"supplier": self.supplier,
"name": self.name,
"year_start_date": fiscal_year.year_start_date,
"year_end_date": fiscal_year.year_end_date
})
that’s right… the supplier is not in the query, I check the file and the supplier is missing… What do you recommend? should I modify this file by myself? or there is any specific procedure to do this.?