How Supplier VAT Number can be reflected in every supplier related document?

Hi!
I love erpnext.
Beginner question here.

I was trying out custom fields.
I created a VAT “data” field under DocType Supplier where I store VAT Numbers.

Now I wish to see the VAT number in other DocTypes related to supplier, e.g
Supplier Quotation, Purchase Order, etc.

My problem is:
Our Supplier Quotation, PO, Receipts, need to reflect the VAT number of supplier.

When I try to create a field in Supplier Quotation and link it to Supplier-vat in options it says Invalid DocType.

PS. Anyplace where I can learn about custom form/fields/scripts and how to create & interlink data within doctypes

Hello

Uncheck “print hide” for the custom field which you have created under supplier DocType.

Sunil
Nescode (http://nescode.com)
Partner for ERPNext

“print hide” is already unchecked.

Nothing about custom field is shown in Supplier Quotation, PO, etc.

Custom Field for Supplier Quotation:

Fieldtype: Read Only
Options: supplier.vat_number

Assuming fieldname for VAT Number in Supplier form is “vat_number”

Supplier Form:

  • Label: VAT Number
  • Fieldname: vat_number
  • Fieldtype: Data
  • Nothing is checked

Supplier Quotation Form:

  • Label: VAT Number
  • Fieldname: vat_number
  • Fieldtype: Read Only
  • Options: supplier.vat_number
  • Nothing is checked

I’ve entered VAT Number for a Supplier, It shows in Supplier.
There is a new field for VAT Number shown in Supplier Quotation. However for the same supplier it is blank.

It will only fetch in new forms. For the old forms you might have to write an update.

How to write update for old forms? any links to refer?

I need Supplier’s VAT number reflected in supplier related documents.
any other solution for same?

just write an SQL UPDATE query in your MySQL. You can login to your mysql via

bench frappe --mysql

Thanks for reply.

:frowning:
I don’t know SQL commands.

I tried to read about MariaDB update statement and example but I can’t figure out that.

Can anyone help me with syntax?

vat_number from tabSupplier should be reflected in vat_number of tabSupplier Quotation

Thanks!

update `tabSupplier Quotation` sq set vat_number = (select vat_number from `tabSupplier` where name = sq.supplier);
1 Like

Thank you guys!

Answer in Brief: Applies to Showing VAT Number of Supplier in Purchase Order

Create Custom field in Document “Supplier” to input Supplier’s VAT Number,

  • label: VAT Number
  • fieldname: vat_number
  • fieldtype: data

Create Custom field in Document “Purchase Order”,

  • label: VAT Number
  • fieldtype: read only
  • options: supplier.vat_number

Log in to mysql/mariadb

bench frappe --mysql

and write update :wink:

update `tabPurchase Order` sq set vat_number = (select vat_number from tabSupplier where name = sq.supplier);

Supplier’s VAT Number input is shown in Purchase Order.

Also add Custom Script

  • DocType “Purchase Order”
  • Script: cur_frm.add_fetch(‘supplier’,‘vat_number’,‘vat_number’)
3 Likes