From cb88543c4174b97c27b4f18143aacf02d0fcc5c8 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Mon, 30 Aug 2021 22:03:29 +0200 Subject: [PATCH] =?UTF-8?q?Probl=C3=A8me=20stocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/line_stock.rb | 4 ++-- app/views/admin/stock_movement_lines/_form_cred.html.haml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/line_stock.rb b/app/models/line_stock.rb index 06e170d..ab34132 100644 --- a/app/models/line_stock.rb +++ b/app/models/line_stock.rb @@ -99,7 +99,7 @@ class LineStock < ApplicationRecord end def ca_price_u_kg_ht - if self.qte_kg_per_unit != 0.0 + if self.qte_kg_per_unit.to_f != 0.0 (self.price_u_ht.to_f / self.qte_kg_per_unit).round(2) else 0.0 @@ -116,7 +116,7 @@ class LineStock < ApplicationRecord end def ca_qte_kg - self.qte * self.qte_kg_per_unit + self.qte.to_f * self.qte_kg_per_unit.to_f end diff --git a/app/views/admin/stock_movement_lines/_form_cred.html.haml b/app/views/admin/stock_movement_lines/_form_cred.html.haml index 75c4daf..3e2afcf 100644 --- a/app/views/admin/stock_movement_lines/_form_cred.html.haml +++ b/app/views/admin/stock_movement_lines/_form_cred.html.haml @@ -91,6 +91,7 @@ %td = form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"} - %td - = form.input :dluo, :label => "DLUO :", :input_html => {:class => ""}, :as => :date + -if false + %td + = form.input :dluo, :label => "DLUO :", :input_html => {:class => ""}, :as => :date