How to get custom field value of product in client or server script?

Hello community!
I have alcohol products, so it has units such as %, ml and so on.
I need help understanding how to include a special tax, for the moment I can’t find a way of doing it with the system.

Brief summary: In our country El Salvador, alcoholic beverages are subject to 2 specific taxes:

1)Alcoholic specific content tax (Alicuota) :** It’s a specific amount (not percentage) charged per each 1% of alcohol content per liter of alcoholic beverage. Each type of liquor has a particular tax amount per % of alcohol per litre of product.

One bottle of 750 ml Gin 40% alc/vol is subject to:
[Alcohol %] x [Alicuota] x [volumen in liters]
40 x 0.16 x 0.75 = $4.80

I have set 4.80 to custom field named “Impuesto Especifico” in product.
So what I want is, I would like to set this value in to “Sales Taxes and Charges” table when creating a new order with alcohol products.
Only alcohol products have this concept.
[Alcohol %] x [Alicuota] x [volumen in liters]

Please let me know, thanks.

Hello?

Hi,
Did you check Item taxes (https://docs.erpnext.com/docs/user/manual/en/item-tax-template) ?
It seems it can do the jobs with correct setting

Yes, but it seems like there is only percentage tax setting.
Can I know whether you understand what I want or not?

Hello @FHenry
Thank you for your kind reply.
Can we talk now if possible? So I can share my screen and explain what I want.
Please let me know, thanks.

Thank you in advance.

Hi @S_L

I’v try with standard feature call Tax Rule and it seems to work as you want

Tax Rule

Sales Tax Template


May be here, the wanted feature is to add in “Sales Taxes and Charges” table a row with type “Actual”, because type “On Item Qty” only allow you to set up % and not amount

Result In Quotation

In this test, I’ve also added a Item tax at 20 % (French VAT).
Is your " Alcoholic specific content tax (Alicuota)" tax have to be taken account after in other tax calculation ?

1 Like

Hello @FHenry .
Thank you for your solution.
But what the problem is, when I add a few products in one invoice, they have different Actual amount each other, so I can’t apply same Sales Taxes template.

For example, I have 2 different alcohol products.
First product has $4.8 as an Actual, and second product has $3.9.
They should be merged, but as you know, only 1 Sales taxes template can be applied when creating a Sales Invoice.
This is the problem.

Do you understand?
Please help me.
Thank you so much.

Hi,

That’s true, with core feature one Tax Rule with “Sales Taxes and Charges” type Actual can be apply on financial document (Quotation/Order/invoice).

What I guess is that you need is a Sales Taxes and Charges Template with a “Sales Taxes and Charges” as type On Item Quantity but with amount and not rate. It’s exactly what you ask for, I’m just redo the match openly, sorry.

One way can be with custom client/server script that allow you to do that, but it will be tricky, as you have to override a lot’s of core control around Taxes and Charges management.
It’s not impossible, but I can only advise you to ask for people (why not some frappe partners) that have skills to do that, if yourself aren’t able to write the require code.
If I have to do it, it will take at between 2 or 3 days of work, at least, (that I don’t have available actually), not to code the feature, but to be sure that all sides effects on other part of ERPNext are managed, for example when you’ll do a return invoice (Credit Note), be sure the general ledger is OK what ever you do, etc…

Hi @FHenry .
Thank you for your assistance.
I will create my script, yes, there is no way to do this with standard features.
Thank you so much!