You are directly making the changes in the Core ERPNext file. Instead you can do it in customised file as well.
In your customised file for Sales Invoice.js write the below code
On change of weight -
weight : function(frm,cdt,cdn){
d = locals[cdt][cdn]
amt = d.rate * d.weight
frappe.model.set_value(cdt, cdn, “amount”,amt);
}
Similary, on change of rate as well and set the qty field to be 1 by default and make it readonly. So that user is not allowed to enter the Qty.
UOM conversation wouldn’t work as the stock is maintained in Number but sold in Kg.
This scenario is applicable to all live stock e.g. Poultry/Goat/Pig/Beef farming.
As per knowledge, ERPNext couldn’t handle this scenario although you can do it using custom application.
Hey I have one solution. You wont have to do any customization. Use Batch system.
Each Batch with represent individual item with same name where each item can has its own weight.
Let me try to explain:
you have two type of animals: Goat, Sheep
at the time of receiving:
add goat item multiple times(total goats) and in qty add weight of each goat
same for sheep
Goat qty 25kg rate = 100/kg amount = 2500
Goat qty 24.5kg rate = 100/kg amount= 2450
Goat qty 30kg
Sheep qty 40kg
Sheep qty 35kg
and so on
on creating purchase receipt it assign batch numbers for each. you can set the series as per your requirement in the item
for example:
Goat-.YYYY.MM.DD- (please verify the format if incorrect)
Sheet-.YYYY.MM.DD-
you can track batch number and its respective remaining qty
benifit: now when you sell, you can select batch and put qty or u may not choose to select batch and erp will automatically pick the batch with qty !=0 automatically
@Kartive_lfc did you resolve that amount issue?
i have the similar issue need to change the amount on a particular check box(condition=if it checked the 2% of amount should be add in amount itself)…
please guide me if you solve it earlier.
Thanks in Advance