Readonly receive input if GroupOrderArticle result has manually been changed
Conflicts: app/helpers/orders_helper.rb app/views/orders/_edit_amount.html.haml
This commit is contained in:
parent
7aae7f4d55
commit
98f59a3de3
7 changed files with 43 additions and 9 deletions
|
|
@ -171,11 +171,13 @@ class OrdersController < ApplicationController
|
|||
# update attributes; don't use update_attribute because it calls save
|
||||
# which makes received_changed? not work anymore
|
||||
oa.attributes = oa_params
|
||||
counts[0] += 1 if oa.units_received_changed?
|
||||
unless oa.units_received.blank?
|
||||
cunits[0] += oa.units_received * oa.article.unit_quantity
|
||||
oacounts = oa.redistribute oa.units_received * oa.price.unit_quantity, rest_to
|
||||
oacounts.each_with_index {|c,i| cunits[i+1]+=c; counts[i+1]+=1 if c>0 }
|
||||
if oa.units_received_changed?
|
||||
counts[0] += 1
|
||||
unless oa.units_received.blank?
|
||||
cunits[0] += oa.units_received * oa.article.unit_quantity
|
||||
oacounts = oa.redistribute oa.units_received * oa.price.unit_quantity, rest_to
|
||||
oacounts.each_with_index {|c,i| cunits[i+1]+=c; counts[i+1]+=1 if c>0 }
|
||||
end
|
||||
end
|
||||
oa.save!
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue