Redirect on price_documents
This commit is contained in:
parent
c42a3909ee
commit
2bf2efc6a6
@ -106,9 +106,11 @@ class Admin::PProductRefsController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
if @p_product_ref.update_attributes(params.require(:p_product_ref).permit!)
|
if @p_product_ref.update_attributes(params.require(:p_product_ref).permit!)
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
render action: "edit"
|
|
||||||
|
render action: "edit"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ class Admin::PriceDocumentsController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@price_document = PriceDocument.find(params[:id])
|
@price_document = PriceDocument.find(params[:id])
|
||||||
|
@facture_achat_childrens = PriceDocument.where(doc_ref_id: @price_document.id, price_document_type: PriceDocumentType.find_by_label("Facture achat"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@ -322,7 +322,11 @@ class Admin::PriceDocumentsController < ApplicationController
|
|||||||
@price_document.date = Date.today
|
@price_document.date = Date.today
|
||||||
@avoir = true if @price_document.label == "Avoir"
|
@avoir = true if @price_document.label == "Avoir"
|
||||||
if @price_document.save
|
if @price_document.save
|
||||||
redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id)
|
if @price_document.cc_label == "Demande prix"
|
||||||
|
render action: :show
|
||||||
|
else
|
||||||
|
redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
render action: "new"
|
render action: "new"
|
||||||
|
|
||||||
@ -343,7 +347,11 @@ class Admin::PriceDocumentsController < ApplicationController
|
|||||||
|
|
||||||
#@price_document.unarchive_now
|
#@price_document.unarchive_now
|
||||||
#@price_document.archive_now
|
#@price_document.archive_now
|
||||||
if @price_document.ref_element
|
if @price_document.cc_label = "Facture achat"
|
||||||
|
redirect_to [:admin, @price_document]
|
||||||
|
elsif @price_document.doc_ref_id
|
||||||
|
redirect_to [:admin, PriceDocument.find(@price_document.doc_ref_id)]
|
||||||
|
elsif @price_document.ref_element
|
||||||
redirect_to [:admin, @price_document.ref_element]
|
redirect_to [:admin, @price_document.ref_element]
|
||||||
else
|
else
|
||||||
redirect_to [:admin, @price_document]
|
redirect_to [:admin, @price_document]
|
||||||
@ -653,7 +661,7 @@ class Admin::PriceDocumentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@final_consult = PriceDocument.where(price_document_type: PriceDocumentType.find_by_label("Consultation fournisseur")).last
|
@final_consult = PriceDocument.where(price_document_type: PriceDocumentType.find_by_label("Consultation fournisseur")).last
|
||||||
redirect_to :analyse_reponses_admin_price_document
|
redirect_to admin_price_document_path(@price_document_demand, anchor: "consult")
|
||||||
end
|
end
|
||||||
|
|
||||||
def buy_order_create
|
def buy_order_create
|
||||||
|
@ -52,7 +52,7 @@ class PriceLine < ApplicationRecord
|
|||||||
|
|
||||||
BON_DE_LIVRAISON_TO_RESET = %w(block_type weight_tot tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc)
|
BON_DE_LIVRAISON_TO_RESET = %w(block_type weight_tot tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc)
|
||||||
|
|
||||||
FACTURE_DACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
|
FACTURE_ACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
|
||||||
|
|
||||||
BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
|
BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ class PriceLineBlock < ApplicationRecord
|
|||||||
|
|
||||||
BON_DE_LIVRAISON_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
|
BON_DE_LIVRAISON_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
|
||||||
|
|
||||||
FACTURE_DACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
|
FACTURE_ACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
|
||||||
|
|
||||||
BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
|
BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
|
||||||
|
|
||||||
|
106
app/views/admin/price_line_blocks/_form_commande_achat.html.haml
Normal file
106
app/views/admin/price_line_blocks/_form_commande_achat.html.haml
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
|
||||||
|
=f.inputs do
|
||||||
|
|
||||||
|
|
||||||
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
|
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
||||||
|
= f.input :p_commercial_id, :label => "Commercial :", :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name if f.object.id
|
||||||
|
|
||||||
|
|
||||||
|
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||||
|
|
||||||
|
.p_customer_sheet_customer
|
||||||
|
|
||||||
|
|
||||||
|
-if f.object.p_customer and f.object.p_customer.particular
|
||||||
|
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||||
|
|
||||||
|
.addresses.row
|
||||||
|
.columns.span_6
|
||||||
|
%h3 Adresse de facturation
|
||||||
|
|
||||||
|
-if f.object.p_customer
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
||||||
|
-else
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||||
|
|
||||||
|
.columns.span_6
|
||||||
|
%h3 Adresse de livraison
|
||||||
|
|
||||||
|
-if f.object.p_customer
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
|
||||||
|
-else
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||||
|
|
||||||
|
.clear
|
||||||
|
|
||||||
|
|
||||||
|
%table{:style => "width:100%;"}
|
||||||
|
%tr
|
||||||
|
%td{:style => "width:50%;"}
|
||||||
|
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||||
|
|
||||||
|
%td{:style => "width:50%;"}
|
||||||
|
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :customer_ref, :label => "Référence commande client :"
|
||||||
|
-if current_admin.has_permission?("customer-sheets-bl")
|
||||||
|
= f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
|
||||||
|
|
||||||
|
-if @p_customer_sheet and @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.p_customer_sheet_note?
|
||||||
|
%div
|
||||||
|
%strong Notes pour les demandes de commandes pour ce client :
|
||||||
|
=simple_format @p_customer_sheet.p_customer.p_customer_sheet_note
|
||||||
|
%br
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.price_lines_form
|
||||||
|
=f.semantic_fields_for :price_lines do |f|
|
||||||
|
=render :partial => "admin/price_lines/form_bon_de_reception_achat", :locals => {:form => f}
|
||||||
|
|
||||||
|
%p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
|
||||||
|
|
||||||
|
|
||||||
|
-if current_admin.has_permission?("payments")
|
||||||
|
.qi_pannel.qi_plain.padding.price_line_block_footer{:style => "margin:20px 0;"}
|
||||||
|
|
||||||
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
|
-if !@avoir
|
||||||
|
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :", :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||||
|
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
|
||||||
|
|
||||||
|
-if !@avoir
|
||||||
|
-if current_admin.has_permission?("customer-sheets-bl")
|
||||||
|
= f.input :ct_nbr_ship, :label => "Nombre de colis :"
|
||||||
|
|
||||||
|
-if current_admin.has_permission?("payments")
|
||||||
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
|
- if f.object.id
|
||||||
|
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
||||||
|
%h4 Paiements
|
||||||
|
|
||||||
|
= f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
|
||||||
|
|
||||||
|
-if false
|
||||||
|
= f.input :ct_acompte, :label => "Acompte nécessaire ?"
|
||||||
|
= f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
|
||||||
|
|
||||||
|
= f.input :ct_payment_delais, :label => "Délais jour de paiement :"
|
||||||
|
|
||||||
|
-if false
|
||||||
|
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
106
app/views/admin/price_line_blocks/_form_facture_achat.html.haml
Normal file
106
app/views/admin/price_line_blocks/_form_facture_achat.html.haml
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
|
||||||
|
=f.inputs do
|
||||||
|
|
||||||
|
|
||||||
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
|
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
||||||
|
= f.input :p_commercial_id, :label => "Commercial :", :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name if f.object.id
|
||||||
|
|
||||||
|
|
||||||
|
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||||
|
|
||||||
|
.p_customer_sheet_customer
|
||||||
|
|
||||||
|
|
||||||
|
-if f.object.p_customer and f.object.p_customer.particular
|
||||||
|
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||||
|
|
||||||
|
.addresses.row
|
||||||
|
.columns.span_6
|
||||||
|
%h3 Adresse de facturation
|
||||||
|
|
||||||
|
-if f.object.p_customer
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
||||||
|
-else
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||||
|
|
||||||
|
.columns.span_6
|
||||||
|
%h3 Adresse de livraison
|
||||||
|
|
||||||
|
-if f.object.p_customer
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
|
||||||
|
-else
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||||
|
|
||||||
|
.clear
|
||||||
|
|
||||||
|
|
||||||
|
%table{:style => "width:100%;"}
|
||||||
|
%tr
|
||||||
|
%td{:style => "width:50%;"}
|
||||||
|
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||||
|
|
||||||
|
%td{:style => "width:50%;"}
|
||||||
|
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :customer_ref, :label => "Référence commande client :"
|
||||||
|
-if current_admin.has_permission?("customer-sheets-bl")
|
||||||
|
= f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
|
||||||
|
|
||||||
|
-if @p_customer_sheet and @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.p_customer_sheet_note?
|
||||||
|
%div
|
||||||
|
%strong Notes pour les demandes de commandes pour ce client :
|
||||||
|
=simple_format @p_customer_sheet.p_customer.p_customer_sheet_note
|
||||||
|
%br
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.price_lines_form
|
||||||
|
=f.semantic_fields_for :price_lines do |f|
|
||||||
|
=render :partial => "admin/price_lines/form_bon_de_reception_achat", :locals => {:form => f}
|
||||||
|
|
||||||
|
%p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
|
||||||
|
|
||||||
|
|
||||||
|
-if current_admin.has_permission?("payments")
|
||||||
|
.qi_pannel.qi_plain.padding.price_line_block_footer{:style => "margin:20px 0;"}
|
||||||
|
|
||||||
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
|
-if !@avoir
|
||||||
|
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :", :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||||
|
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
|
||||||
|
|
||||||
|
-if !@avoir
|
||||||
|
-if current_admin.has_permission?("customer-sheets-bl")
|
||||||
|
= f.input :ct_nbr_ship, :label => "Nombre de colis :"
|
||||||
|
|
||||||
|
-if current_admin.has_permission?("payments")
|
||||||
|
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||||
|
- if f.object.id
|
||||||
|
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
||||||
|
%h4 Paiements
|
||||||
|
|
||||||
|
= f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
|
||||||
|
|
||||||
|
-if false
|
||||||
|
= f.input :ct_acompte, :label => "Acompte nécessaire ?"
|
||||||
|
= f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
|
||||||
|
|
||||||
|
= f.input :ct_payment_delais, :label => "Délais jour de paiement :"
|
||||||
|
|
||||||
|
-if false
|
||||||
|
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user