I wanted to add a “Bill To” address to Purchase Order. When customizing the PO form a came across this field company which does not show on the PO. Can any one clarify why is it not seen in the PO ?
Also, I believe I can add an additional field here which can be populated with one of the company address which will act as billing address. Is this the correct way of doing it ?
Also, a comment on ERPNext PO design, the shipping address is so filtered in ERPNext to be populated only with ones company’s addresses. That should actually be billing address. The shipping address should be left free, One may always desire to get the items on site or at sub-contractors site.
Step 2:
If Preferred Billing Address is marked, the same will be populated by default for billing address.
If Preferred Shipping Address is marked, the same will be populated by default for shipping address.
Well I did add the additional fields. Used the standard process of adding custom fields to a form
Added two new fields
Select To Ship Address
To Ship Address (Read Only)
The first item is a link and works just fine
The second item (small text) does not auto-populate like other address in the Purchase Order
I believe we need to fill the “Fetch from” field of that item. However, the address is multi line. How can I fetch the multi line address from “Select To Ship Address” link ?
However I need help to fetch address using a custom script. I have gone through several links where different answers to this question have been posted but they have not seemed to work for me.
I need an answer to the the same question asked here but the answer seems outdated,
Also, a variant of that is present here.
I have so far not been able to pull the complete address when the address name is selected. A simple fetch will not work because the address is made up of multiple lines.
Look forward to this and I see that this is such a typical question that its answer should go in the custom script examples.
This is what was wrong in it. I had already used a code in the fetch “fetch from” area of customise form and used the word address in it. Since the address doc type does not have anything called address that was the cause of error.
However fixing it did not achieve for me what I wanted. Instead I get an message
I got the solution. The following is the code that worked.
Note that erpnext.utilities.doctype.address.address.get_address_display
seen in answers till v8 is replaced by frappe.contacts.doctype.address.address.get_address_display
@pkrulz , a better solution now is v13 for new POs. However, it has a minor bug when generating a PO from a SO, which can be solved using a client side script, described in this github issue.