The end action auto_close_and_send_min_quantity for orders uses currently the gross value of the order sum to compare it with the minimum order quantity of the supplier:
|
send_to_supplier!(created_by) if sum >= supplier.min_order_quantity.to_r |
We have a supplier in our foodcoop with mainly articles with deposits and a minimum order quantity. This minimum order quantity is defined by the supplier without deposit, but sum without argument calculates the gross sum including the deposit:
|
def sum(type = :gross) |
|
total = 0 |
|
if %i[net gross fc].include?(type) |
|
for oa in order_articles.ordered.includes(:article_version) |
|
quantity = oa.units * oa.article_version.convert_quantity(1, oa.article_version.supplier_order_unit, |
|
oa.article_version.group_order_unit) |
|
case type |
|
when :net |
|
total += quantity * oa.article_version.group_order_price |
|
when :gross |
|
total += quantity * oa.article_version.gross_group_order_price |
|
def gross_price |
|
add_percent(price + deposit, tax) |
|
end |
I would like to change the sum to sum(:net) so that the deposit is excluded. I think it is a small drawback to set a net minimum order quantity if the article prices are without tax in comparison to not being able to use the feature because of the deposit.
An alternative without this small drawback would be to add a "gross price without deposit" sum and use it for the order-send-to-supplier decision.
The end action
auto_close_and_send_min_quantityfor orders uses currently the gross value of the order sum to compare it with the minimum order quantity of the supplier:foodsoft/app/models/order.rb
Line 355 in 26b05c2
We have a supplier in our foodcoop with mainly articles with deposits and a minimum order quantity. This minimum order quantity is defined by the supplier without deposit, but
sumwithout argument calculates the gross sum including the deposit:foodsoft/app/models/order.rb
Lines 214 to 224 in 26b05c2
foodsoft/app/models/concerns/price_calculation.rb
Lines 21 to 23 in 26b05c2
I would like to change the
sumtosum(:net)so that the deposit is excluded. I think it is a small drawback to set a net minimum order quantity if the article prices are without tax in comparison to not being able to use the feature because of the deposit.An alternative without this small drawback would be to add a "gross price without deposit" sum and use it for the order-send-to-supplier decision.