Change doctype programmatically

I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/c9a453a1-aa95-4ac7-afd5-bec658fea0b7%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


On 16-Sep-2014, at 4:33 pm, Luis Fernandes <lu...@gmail.com> wrote:

I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

Add your field as a "Custom Field" and set it as a fixture (will be installed / updated with the app)

https://github.com/frappe/frappe_io/blob/master/frappe_io/hooks.py#L20

Run frappe --export_fixtures to build them


I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/c9a453a1-aa95-4ac7-afd5-bec658fea0b7%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/FD708CC4-5386-4A67-B94E-DC8CE973D3A3%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Thanks i will try.

Terça-feira, 16 de Setembro de 2014 12:03:29 UTC+1, Luis Fernandes escreveu:
I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/4b33573f-de20-4e47-a115-2bd46a97ebd6%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
rushabh. This is not what i want.

What i want is add one field to Company, field with this name: vat_check_vies, type check and label VIES VAT Check. Like we do in custom field. But i want to do it programmatically. 

Your solution is almost there. But in your solution i get all the fields and values. When i install my app it will install the fields and the data and that is what i don't want.

I want to make an app that make possible to insert VAT numbers for different countries. This is an app based in openerp base_vat module and i want to adapted to erpnext. Then i want to distribute to community and when other programmers install this app they get in Company doctype one filed called vat_check_vies with type check and label VIES VAT Check and nothing more. Then when they check this field my module do the real check against EU's VIES service.

Is this possible and how?


Thanks.

Terça-feira, 16 de Setembro de 2014 12:03:29 UTC+1, Luis Fernandes escreveu:
I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1e1fe73d-bcae-4f92-a3ab-0397518c1a78%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
I already teste what do you said in every possible way. I'm doing some thing wrong. 

you said -> Add your field as a "Custom Field": it is easy and it's done. The field is named NIF, type check and field name is nif.

you said -> and set it as a fixture... What do you mean by that? I made like the example and i put in the hooks.py of my application:

fixtures = [
"Customer"
]

and it work. It exports a file called customers in fixtures folder with my new file (nif):

Name:","name","customer_name","customer_type","customer_group","territory","company","lead_name","nif","customer_details","default_currency","default_price_list","default_taxes_and_charges","credit_days","credit_limit","website","default_sales_partner","default_commission_rate","~","name","sales_person","sales_designation","allocated_percentage","allocated_amount","incentives","~","name","sent_or_received","subject","content","category","next_communication_date","action","recipients","sender","communication_medium","phone_no","user","communication_date"
"Mandatory:","Yes","Yes","Yes","Yes","Yes","Yes","No","No","No","No","No","No","No","No","No","No","No","","Yes","Yes","No","No","No","No","","Yes","Yes","Yes","No","No","No","No","No","No","No","No","No","No"

and with all my customers data...

When i install my app in my site2.local (i made all that in site1.local) my app install but the field no.

Can you help me to achieve my objective as mention in my second post?

Thanks.

Terça-feira, 16 de Setembro de 2014 12:33:51 UTC+1, rushabh escreveu:


On 16-Sep-2014, at 4:33 pm, Luis Fernandes <lu...@gmail.com> wrote:

I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

Add your field as a "Custom Field" and set it as a fixture (will be installed / updated with the app)


Run frappe --export_fixtures to build them


I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/c9a453a1-aa95-4ac7-afd5-bec658fea0b7%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6f955034-a129-4937-b116-90438301c296%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


On 17-Sep-2014, at 1:20 am, Luis Fernandes <lu...@gmail.com> wrote:

I already teste what do you said in every possible way. I'm doing some thing wrong. 

you said -> Add your field as a "Custom Field": it is easy and it's done. The field is named NIF, type check and field name is nif.

you said -> and set it as a fixture... What do you mean by that? I made like the example and i put in the hooks.py of my application:

fixtures = [
"Customer"
]

Create a fixture for "Custom Field" :)


and it work. It exports a file called customers in fixtures folder with my new file (nif):

Name:","name","customer_name","customer_type","customer_group","territory","company","lead_name","nif","customer_details","default_currency","default_price_list","default_taxes_and_charges","credit_days","credit_limit","website","default_sales_partner","default_commission_rate","~","name","sales_person","sales_designation","allocated_percentage","allocated_amount","incentives","~","name","sent_or_received","subject","content","category","next_communication_date","action","recipients","sender","communication_medium","phone_no","user","communication_date"
"Mandatory:","Yes","Yes","Yes","Yes","Yes","Yes","No","No","No","No","No","No","No","No","No","No","No","","Yes","Yes","No","No","No","No","","Yes","Yes","Yes","No","No","No","No","No","No","No","No","No","No"

and with all my customers data...

When i install my app in my site2.local (i made all that in site1.local) my app install but the field no.

Can you help me to achieve my objective as mention in my second post?

Thanks.

Terça-feira, 16 de Setembro de 2014 12:33:51 UTC+1, rushabh escreveu:


On 16-Sep-2014, at 4:33 pm, Luis Fernandes <luisfmf...@gmail.com> wrote:

I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

Add your field as a "Custom Field" and set it as a fixture (will be installed / updated with the app)


Run frappe --export_fixtures to build them


I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.

-- 
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email toerpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/c9a453a1-aa95-4ac7-afd5-bec658fea0b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6f955034-a129-4937-b116-90438301c296%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/402583B1-B96D-4824-8282-AFCCC0D8951E%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Know i understand!!! You mean create a fixture for a "Custom Field" you mean Literally!!!!


Thanks, i will try.

Terça-feira, 16 de Setembro de 2014 12:03:29 UTC+1, Luis Fernandes escreveu:
I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/fc68212f-7f43-4b06-8fdd-7c3632b07622%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
After you done., can you share your working code, then we can learn the knowleadge... thanks very much.

在 2014年9月17日星期三UTC+8下午3时50分32秒,Luis Fernandes写道:
Know i understand!!! You mean create a fixture for a "Custom Field" you mean Literally!!!!


Thanks, i will try.

Terça-feira, 16 de Setembro de 2014 12:03:29 UTC+1, Luis Fernandes escreveu:
I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/d5abce08-ae30-4797-a6dd-eeca6b894f65%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Of course. As soon as i make my module i will tell you.

Quarta-feira, 17 de Setembro de 2014 8:51:49 UTC+1, Y Y escreveu:
After you done., can you share your working code, then we can learn the knowleadge... thanks very much.

在 2014年9月17日星期三UTC+8下午3时50分32秒,Luis Fernandes写道:
Know i understand!!! You mean create a fixture for a "Custom Field" you mean Literally!!!!


Thanks, i will try.

Terça-feira, 16 de Setembro de 2014 12:03:29 UTC+1, Luis Fernandes escreveu:
I. 

I need to change doctype company and add one field, but i want to do the changes programmatically in my module. 
The ideia is, if my module is installed then the new field show in company, if not... you guess!!!

I that possible? If it is point me out the outlines that i do the rest.

I know that i must put a hook to company "get" or some thing like that but i don't see how.


Thanks.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/cc18e3c0-4d1c-4dd0-a366-3901c90e433d%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.