Custom Script to auto add record

Hello all!

I need to develop a custom script to include a product item automatically in Sales Order, the instant she is saved.

I looked at these examples [1], but all are based on items that already exist, I want to create a new item.

I'm using the item for sale as an example, but understand this, help me at various stages, especially:

- Taxes and Fees
 - Under specific conditions of sales order, there are different tax
- Percentage of commissions
 - **In my structure, I have**
 - 1 Sales Person
 - 1 Sales Manager
 - 0 or 1 Partner Sale
 - 0 or more contributor Sale
     

Based on the net amount of the sale, you must set the value of commission of each of these participants.

The value is given by the Commission thereof a series of tracks commissions.

Finally, understand this example, I will give the possibility to incorporate more specific details of my business rule.

[1] https://github.com/webnotes/wnframework/wiki/Client-side-scripting

PS: I am try to add this question on StackoverFlow but:

Oops! Your question couldn't be submitted because:

  • users with less than 1500 reputation can't create new tags. The tag 'erpnext' is new. Try using an existing tag instead.



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

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/h94L-JRE3aEJ.

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

 

 

Hi Maxwell,

Not sure I understand what you are trying to do. Why do you want to add this item? Can you not accomplish this by a custom field?

Adding an item by script may not be that easy as you will have to get price list and other validations too (for example is it in stock?) etc.

Can you explain your business rules more clearly? I understand you want to have multiple commissions. The way to do this would be to add custom fields for each of your commission and write a simple script to calculate this commission.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

On 16-Jan-2013, at 8:53 PM, Maxwell <ma...@gmail.com> wrote:

Hello all!

I need to develop a custom script to include a product item automatically in Sales Order, the instant she is saved.

I looked at these examples [1], but all are based on items that already exist, I want to create a new item.

I'm using the item for sale as an example, but understand this, help me at various stages, especially:

- Taxes and Fees
 - Under specific conditions of sales order, there are different tax
- Percentage of commissions
 - **In my structure, I have**
 - 1 Sales Person
 - 1 Sales Manager
 - 0 or 1 Partner Sale
 - 0 or more contributor Sale
     

Based on the net amount of the sale, you must set the value of commission of each of these participants.

The value is given by the Commission thereof a series of tracks commissions.

Finally, understand this example, I will give the possibility to incorporate more specific details of my business rule.


PS: I am try to add this question on StackoverFlow but:

Oops! Your question couldn't be submitted because:

  • users with less than 1500 reputation can't create new tags. The tag 'erpnext' is new. Try using an existing tag instead.



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

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/h94L-JRE3aEJ.

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

 

 




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

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

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

 

 

Dear, Rushabh.

Forget the product item, I will explain my business rule for determining commissions.

In the process of a sale I have the following teams:

Sales staff who are responsible for determining the weights and opportunities.
Managers who are responsible for employee collaboration teams.

Sellers who are responsible for quotations and sales orders.
Sales managers, who are responsible for managing teams of salespeople.

All pictured receive commissions on each sale, but there are margins according to the net value of each sale.


Eg
For a sale of $ 0.01 - $ 25,000.00 profit margins are:
- Developer: 1.83%
- Manager of collaboration: 1.05%
- Seller: 5.0%
- Sales Manager: 2.36%

For a sale of $ 25,000.01 - $ 75,000.00 profit margins are:
- Developer: 2.63%
- Manager of collaboration: 3.6%
- Vendor: 6.83%
- Sales Manager: 3.14%

However, some factors can modify these margins or participants:
- If the customer is making a new purchase, collaboration margins are reduced by 50%;
- If the source is the lead customer for the inclusion of 1.5% margin, for a new entrant, the client indicated that the new lead. This policy is part of the loyalty system, where each customer has the opportunity to accumulate points, for a period of indefinite time, and use them as they see fit.
- There are also channels of partnership, such as Groupon and others, these channels are also figured as a new participant, considering that I must pay a fee previously established by contract, for every sale that he would provide.

Eg:
Sales for delivery within 90 days (immediate sale) - follow the rules
Sales entrga after 90 days, there is what we call deflation, in which possibly there will be a reduction in the net value of sales, due to financial factors, and there will be financial charges and storage, where it will be necessary to include fees.

There are more factors and participants who currently do not remember completely, these participants are that I need to include every issue of a new sales order.

These rules are some of the factors that determine the fees ultimately do not know if I was clear enough, but this is the reality of commissioning.



2013/1/17 Rushabh Mehta <rm...@gmail.com>
Hi Maxwell,

Not sure I understand what you are trying to do. Why do you want to add this item? Can you not accomplish this by a custom field?

Adding an item by script may not be that easy as you will have to get price list and other validations too (for example is it in stock?) etc.

Can you explain your business rules more clearly? I understand you want to have multiple commissions. The way to do this would be to add custom fields for each of your commission and write a simple script to calculate this commission.

best,
Rushabh

On 16-Jan-2013, at 8:53 PM, Maxwell <ma...@gmail.com> wrote:

Hello all!

I need to develop a custom script to include a product item automatically in Sales Order, the instant she is saved.

I looked at these examples [1], but all are based on items that already exist, I want to create a new item.

I'm using the item for sale as an example, but understand this, help me at various stages, especially:

- Taxes and Fees
- Under specific conditions of sales order, there are different tax
- Percentage of commissions
- **In my structure, I have**
- 1 Sales Person
- 1 Sales Manager
- 0 or 1 Partner Sale
- 0 or more contributor Sale

Based on the net amount of the sale, you must set the value of commission of each of these participants.

The value is given by the Commission thereof a series of tracks commissions.

Finally, understand this example, I will give the possibility to incorporate more specific details of my business rule.


PS: I am try to add this question on StackoverFlow but:

Oops! Your question couldn't be submitted because:

  • users with less than 1500 reputation can't create new tags. The tag 'erpnext' is new. Try using an existing tag instead.



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

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/h94L-JRE3aEJ.

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







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

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

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







--


Maxwell Morais

(+55 11) 3931-1412 Ramal 31
www.realizemodulados.com.br



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

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

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

 

 

Max,

You will have to write a Custom Script as seen here [1] to calculate these values and use Custom Fields in the sales cycle where applicable to capture the additional info you need to calculate this.

If your rules are too complex, the I would suggest to simplify those rules!

best,
Rushabh

W: https://erpnext.com
T: @rushabh_mehta

On 18-Jan-2013, at 3:21 PM, Maxwell Morais <ma...@gmail.com> wrote:

Dear, Rushabh.

Forget the product item, I will explain my business rule for determining commissions.

In the process of a sale I have the following teams:

Sales staff who are responsible for determining the weights and opportunities.
Managers who are responsible for employee collaboration teams.

Sellers who are responsible for quotations and sales orders.
Sales managers, who are responsible for managing teams of salespeople.

All pictured receive commissions on each sale, but there are margins according to the net value of each sale.


Eg
For a sale of $ 0.01 - $ 25,000.00 profit margins are:
 - Developer: 1.83%
 - Manager of collaboration: 1.05%
 - Seller: 5.0%
 - Sales Manager: 2.36%

For a sale of $ 25,000.01 - $ 75,000.00 profit margins are:
 - Developer: 2.63%
 - Manager of collaboration: 3.6%
 - Vendor: 6.83%
 - Sales Manager: 3.14%

However, some factors can modify these margins or participants:
    - If the customer is making a new purchase, collaboration margins are reduced by 50%;
    - If the source is the lead customer for the inclusion of 1.5% margin, for a new entrant, the client indicated that the new lead. This policy is part of the loyalty system, where each customer has the opportunity to accumulate points, for a period of indefinite time, and use them as they see fit.
    - There are also channels of partnership, such as Groupon and others, these channels are also figured as a new participant, considering that I must pay a fee previously established by contract, for every sale that he would provide.

Eg:
Sales for delivery within 90 days (immediate sale) - follow the rules
Sales entrga after 90 days, there is what we call deflation, in which possibly there will be a reduction in the net value of sales, due to financial factors, and there will be financial charges and storage, where it will be necessary to include fees.

There are more factors and participants who currently do not remember completely, these participants are that I need to include every issue of a new sales order.

These rules are some of the factors that determine the fees ultimately do not know if I was clear enough, but this is the reality of commissioning.



2013/1/17 Rushabh Mehta <rm...@gmail.com>
Hi Maxwell,

Not sure I understand what you are trying to do. Why do you want to add this item? Can you not accomplish this by a custom field?

Adding an item by script may not be that easy as you will have to get price list and other validations too (for example is it in stock?) etc.

Can you explain your business rules more clearly? I understand you want to have multiple commissions. The way to do this would be to add custom fields for each of your commission and write a simple script to calculate this commission.

best,
Rushabh

On 16-Jan-2013, at 8:53 PM, Maxwell <ma...@gmail.com> wrote:

Hello all!

I need to develop a custom script to include a product item automatically in Sales Order, the instant she is saved.

I looked at these examples [1], but all are based on items that already exist, I want to create a new item.

I'm using the item for sale as an example, but understand this, help me at various stages, especially:

- Taxes and Fees
 - Under specific conditions of sales order, there are different tax
- Percentage of commissions
 - **In my structure, I have**
 - 1 Sales Person
 - 1 Sales Manager
 - 0 or 1 Partner Sale
 - 0 or more contributor Sale
     

Based on the net amount of the sale, you must set the value of commission of each of these participants.

The value is given by the Commission thereof a series of tracks commissions.

Finally, understand this example, I will give the possibility to incorporate more specific details of my business rule.


PS: I am try to add this question on StackoverFlow but:

Oops! Your question couldn’t be submitted because:

  • users with less than 1500 reputation can't create new tags. The tag 'erpnext' is new. Try using an existing tag instead.



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

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/h94L-JRE3aEJ.

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

 

 





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

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

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

 

 




--


Maxwell Morais

(+55 11) 3931-1412 Ramal 31
 www.realizemodulados.com.br




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

To post to this group, send email to er…@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un…@googlegroups.com.

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

 

 




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

To post to this group, send email to er...@googlegroups.com.

To unsubscribe from this group, send email to erpnext-developer-forum+un...@googlegroups.com.

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