add DEE to p_product_ref

This commit is contained in:
Barnabé 2021-09-17 14:12:23 +02:00
parent d6640ded5a
commit 210ac20718
3 changed files with 20 additions and 2 deletions

View File

@ -48,7 +48,7 @@ class PProductRef < ApplicationRecord
:actions => {:name => "Actions", :reorder => false} :actions => {:name => "Actions", :reorder => false}
} }
acts_as_caching :fields => [:sorecop] acts_as_caching :fields => [:sorecop, :dee]
def not_imported? def not_imported?
if !self.p_product or !self.p_product.imported if !self.p_product or !self.p_product.imported
@ -159,4 +159,12 @@ class PProductRef < ApplicationRecord
end end
end end
def ca_dee
if self.cc_dee
return self.cc_dee
else
"TODO Calcul DEE"
end
end
end end

View File

@ -0,0 +1,7 @@
class AddDeeToPProductRefs < ActiveRecord::Migration[6.0]
def change
add_column :p_product_refs, :ca_dee, :decimal
add_column :p_product_refs, :cc_dee, :decimal
add_column :p_product_refs, :ct_dee, :decimal
end
end

View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_09_17_115613) do ActiveRecord::Schema.define(version: 2021_09_17_121011) do
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "name" t.string "name"
@ -1796,6 +1796,9 @@ ActiveRecord::Schema.define(version: 2021_09_17_115613) do
t.decimal "ca_sorecop", precision: 10 t.decimal "ca_sorecop", precision: 10
t.decimal "cc_sorecop", precision: 10 t.decimal "cc_sorecop", precision: 10
t.decimal "ct_sorecop", precision: 10 t.decimal "ct_sorecop", precision: 10
t.decimal "ca_dee", precision: 10
t.decimal "cc_dee", precision: 10
t.decimal "ct_dee", precision: 10
end end
create_table "p_product_specs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| create_table "p_product_specs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|