Rename Delivery.delivered_on to date
This aligns it with column names of StockTaking and us to use inheritance in a next step to share common code between the entities.
This commit is contained in:
parent
7b2072251e
commit
a5582e9542
18 changed files with 35 additions and 30 deletions
|
@ -4,7 +4,7 @@ class DeliveriesController < ApplicationController
|
|||
before_action :find_supplier, :exclude => :fill_new_stock_article_form
|
||||
|
||||
def index
|
||||
@deliveries = @supplier.deliveries.order('delivered_on DESC')
|
||||
@deliveries = @supplier.deliveries.order('date DESC')
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -13,7 +13,7 @@ class DeliveriesController < ApplicationController
|
|||
|
||||
def new
|
||||
@delivery = @supplier.deliveries.build
|
||||
@delivery.delivered_on = Date.today #TODO: move to model/database
|
||||
@delivery.date = Date.today #TODO: move to model/database
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -32,7 +32,7 @@ class Finance::InvoicesController < ApplicationController
|
|||
end
|
||||
|
||||
def fill_deliveries_and_orders_collection(invoice_id, supplier_id)
|
||||
@deliveries_collection = Delivery.where('invoice_id = ? OR (invoice_id IS NULL AND supplier_id = ?)', invoice_id, supplier_id).order(:delivered_on)
|
||||
@deliveries_collection = Delivery.where('invoice_id = ? OR (invoice_id IS NULL AND supplier_id = ?)', invoice_id, supplier_id).order(:date)
|
||||
@orders_collection = Order.where('invoice_id = ? OR (invoice_id IS NULL AND supplier_id = ? AND state = ?)', invoice_id, supplier_id, 'finished').order(:ends)
|
||||
end
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class OrderFax < OrderPdf
|
|||
text Date.today.strftime(I18n.t('date.formats.default')), align: :right
|
||||
|
||||
move_down 10
|
||||
text "#{Delivery.human_attribute_name :delivered_on}:"
|
||||
text "#{Delivery.human_attribute_name :date}:"
|
||||
move_down 10
|
||||
unless order.supplier.try(:contact_person).blank?
|
||||
text "#{Supplier.human_attribute_name :contact_person}: #{order.supplier[:contact_person]}"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Finance::InvoicesHelper
|
||||
def format_delivery_item delivery
|
||||
format_date(delivery.delivered_on)
|
||||
format_date(delivery.date)
|
||||
end
|
||||
def format_order_item order
|
||||
"#{format_date(order.ends)} (#{number_to_currency(order.sum)})"
|
||||
|
|
|
@ -6,7 +6,7 @@ class Delivery < ApplicationRecord
|
|||
|
||||
scope :recent, -> { order('created_at DESC').limit(10) }
|
||||
|
||||
validates_presence_of :supplier_id, :delivered_on
|
||||
validates_presence_of :supplier_id, :date
|
||||
validate :stock_articles_must_be_unique
|
||||
|
||||
accepts_nested_attributes_for :stock_changes, :allow_destroy => :true
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
= render :partial => 'stock_change_fields', :locals => {:f => stock_change_form}
|
||||
|
||||
%h2= t '.title_finish_delivery'
|
||||
= f.input :delivered_on, as: :date_picker
|
||||
= f.input :date, as: :date_picker
|
||||
= f.input :note, input_html: {size: '35x4'}
|
||||
.form-actions
|
||||
= f.submit class: 'btn btn-primary'
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper Delivery, :delivered_on
|
||||
%th= heading_helper Delivery, :date
|
||||
%th.numeric= t 'deliveries.invoice_amount'
|
||||
%th= heading_helper Delivery, :note
|
||||
%tbody
|
||||
- for delivery in @deliveries
|
||||
%tr
|
||||
%td=h delivery.delivered_on
|
||||
%td=h delivery.date
|
||||
%td.numeric= link_to_invoice(delivery)
|
||||
%td= truncate delivery.note
|
||||
%td
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
%dl
|
||||
%dt= heading_helper Delivery, :supplier
|
||||
%dd= @delivery.supplier.name
|
||||
%dt= heading_helper Delivery, :delivered_on
|
||||
%dd= @delivery.delivered_on
|
||||
%dt= heading_helper Delivery, :date
|
||||
%dd= @delivery.date
|
||||
%dt= t 'deliveries.invoice_amount'
|
||||
%dd= link_to_invoice(@delivery)
|
||||
- if @delivery.invoice
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
%td><
|
||||
- invoice.deliveries.each_with_index do |delivery, index|
|
||||
= ', ' if index > 0
|
||||
= link_to format_date(delivery.delivered_on), [delivery.supplier,delivery]
|
||||
= link_to format_date(delivery.date), [delivery.supplier,delivery]
|
||||
%td><
|
||||
- invoice.orders.each_with_index do |order, index|
|
||||
= ', ' if index > 0
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
%p
|
||||
%b= heading_helper(Invoice, :deliveries) + ':'
|
||||
%span><
|
||||
- @invoice.deliveries.order(:delivered_on).each_with_index do |delivery, index|
|
||||
- @invoice.deliveries.order(:date).each_with_index do |delivery, index|
|
||||
- sum = delivery.sum
|
||||
- total += sum
|
||||
= ', ' if index > 0
|
||||
= link_to format_date(delivery.delivered_on), [delivery.supplier,delivery]
|
||||
= link_to format_date(delivery.date), [delivery.supplier, delivery]
|
||||
= ' (' + number_to_currency(sum) + ')'
|
||||
- if @invoice.orders.any?
|
||||
%p
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
%tbody
|
||||
- for delivery in @deliveries
|
||||
%tr
|
||||
%td= link_to delivery.delivered_on, [@supplier, delivery]
|
||||
%td= link_to delivery.date, [@supplier, delivery]
|
||||
%td= link_to_invoice(delivery)
|
||||
|
||||
- if @orders.any?
|
||||
|
|
|
@ -47,7 +47,7 @@ de:
|
|||
reference: Zahlungsreferenz
|
||||
text: Beschreibung
|
||||
delivery:
|
||||
delivered_on: Lieferdatum
|
||||
date: Lieferdatum
|
||||
note: Notiz
|
||||
supplier: Lieferantin
|
||||
document:
|
||||
|
|
|
@ -47,7 +47,7 @@ en:
|
|||
reference: Referenz
|
||||
text: Description
|
||||
delivery:
|
||||
delivered_on: Delivery date
|
||||
date: Delivery date
|
||||
note: Note
|
||||
supplier: Supplier
|
||||
document:
|
||||
|
|
|
@ -47,7 +47,7 @@ es:
|
|||
reference: Referencia
|
||||
text: Descripción
|
||||
delivery:
|
||||
delivered_on: Fecha entrega
|
||||
date: Fecha entrega
|
||||
note: Nota
|
||||
supplier: Proveedor
|
||||
document:
|
||||
|
|
|
@ -33,7 +33,7 @@ fr:
|
|||
tax: TVA
|
||||
unit_quantity: Unités par lot
|
||||
delivery:
|
||||
delivered_on: Date de réapprovisionnement
|
||||
date: Date de réapprovisionnement
|
||||
supplier: Fournisseur-e
|
||||
document:
|
||||
created_at: Créé le
|
||||
|
|
|
@ -47,7 +47,7 @@ nl:
|
|||
reference: Referentie
|
||||
text: Omschrijving
|
||||
delivery:
|
||||
delivered_on: Leverdatum
|
||||
date: Leverdatum
|
||||
note: Notitie
|
||||
supplier: Leverancier
|
||||
document:
|
||||
|
|
5
db/migrate/20181204060000_change_delivered_on_to_date.rb
Normal file
5
db/migrate/20181204060000_change_delivered_on_to_date.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class ChangeDeliveredOnToDate < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :deliveries, :delivered_on, :date
|
||||
end
|
||||
end
|
|
@ -92,7 +92,7 @@ ActiveRecord::Schema.define(version: 20181205010000) do
|
|||
|
||||
create_table "deliveries", force: :cascade do |t|
|
||||
t.integer "supplier_id", limit: 4
|
||||
t.date "delivered_on"
|
||||
t.date "date"
|
||||
t.datetime "created_at"
|
||||
t.text "note", limit: 65535
|
||||
t.integer "invoice_id", limit: 4
|
||||
|
|
Loading…
Reference in a new issue