diff --git a/app/models/p_document.rb b/app/models/p_document.rb index 9315115..ff080de 100644 --- a/app/models/p_document.rb +++ b/app/models/p_document.rb @@ -21,6 +21,7 @@ class PDocument < ActiveRecord::Base if self.element and self.element_type == "PCustomerSheet" and !self.id + self.cust_ref = self.element.cust_ref self.comptant = self.element.comptant diff --git a/app/views/admin/p_customer_sheets/_form.html.haml b/app/views/admin/p_customer_sheets/_form.html.haml index c3792ce..61fe388 100755 --- a/app/views/admin/p_customer_sheets/_form.html.haml +++ b/app/views/admin/p_customer_sheets/_form.html.haml @@ -185,6 +185,8 @@ .clear + = form.input :cust_ref, :label => "Référence commande client :" + -if false %h3 Dates de livraison %table{:style => "width:100%;"} diff --git a/app/views/admin/p_documents/_general.html.haml b/app/views/admin/p_documents/_general.html.haml index 3c0ac71..930d3c2 100644 --- a/app/views/admin/p_documents/_general.html.haml +++ b/app/views/admin/p_documents/_general.html.haml @@ -84,6 +84,8 @@ %th N° Client %th Type %th Référence doc. + -if @p_document.cust_ref? + %th Réf. com. client %tr @@ -100,6 +102,9 @@ %td{:style => "width:90px"} =@p_document.d_number + -if @p_document.cust_ref? + %td{:style => "width:90px"} + =@p_document.cust_ref %br diff --git a/db/migrate/20190210113008_add_cust_ref_to_p_customer_sheets.rb b/db/migrate/20190210113008_add_cust_ref_to_p_customer_sheets.rb new file mode 100644 index 0000000..865428b --- /dev/null +++ b/db/migrate/20190210113008_add_cust_ref_to_p_customer_sheets.rb @@ -0,0 +1,6 @@ +class AddCustRefToPCustomerSheets < ActiveRecord::Migration + def change + add_column :p_customer_sheets, :cust_ref, :string + add_column :p_documents, :cust_ref, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 3d66d59..c13c018 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20190203134413) do +ActiveRecord::Schema.define(version: 20190210113008) do create_table "admin_admin_roles", force: :cascade do |t| t.integer "admin_id", limit: 4 @@ -799,6 +799,7 @@ ActiveRecord::Schema.define(version: 20190203134413) do t.datetime "paid_at" t.integer "p_price_cat_id", limit: 4 t.decimal "fdp_force_price", precision: 10, scale: 2 + t.string "cust_ref", limit: 255 end add_index "p_customer_sheets", ["p_payment_type_id"], name: "index_p_customer_sheets_on_p_payment_type_id", using: :btree @@ -924,6 +925,7 @@ ActiveRecord::Schema.define(version: 20190203134413) do t.integer "payment_delais", limit: 4 t.boolean "payment_fin_de_mois", default: false t.integer "p_payment_type_id", limit: 4 + t.string "cust_ref", limit: 255 end create_table "p_eps", force: :cascade do |t|