diff --git a/Gemfile b/Gemfile index e84fcaf3dc..4d04459909 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'rubyzip', :require=>'zip/zip' gem 'will_paginate', '~> 3.0' gem "exception_notification" gem 'state_machine' -gem 'combo_box' #, :path=>'../combo_box' +gem 'combo_box', :path=>'../combo_box' gem 'formize' #, :path=>'../formize' gem 'spreet' gem 'prawn', '>= 0.10.0' diff --git a/Gemfile.lock b/Gemfile.lock index 45dabfd081..46cb036a56 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +PATH + remote: ../combo_box + specs: + combo_box (0.0.7) + jquery-rails + rails (~> 3) + GEM remote: https://rubygems.org/ specs: @@ -40,9 +47,6 @@ GEM coffee-script-source execjs coffee-script-source (1.2.0) - combo_box (0.0.7) - jquery-rails - rails (~> 3) erubis (2.7.0) exception_notification (2.5.2) actionmailer (>= 3.0.4) @@ -140,7 +144,7 @@ DEPENDENCIES acts_as_list acts_as_tree coffee-rails (~> 3.2.1) - combo_box + combo_box! exception_notification fastercsv formize diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 81690bb70a..a3bbc78723 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -151,7 +151,8 @@ def render_restfully_form(options={}) end - def find_and_check(model, id=nil, options={}) + def find_and_check(model=nil, id=nil, options={}) + model ||= self.controller_name model, record, klass = model.to_s, nil, nil id ||= params[:id] begin @@ -204,9 +205,10 @@ def save_and_redirect(record, options={}, &block) def t3e(*args) @title ||= {} for arg in args + arg = arg.attributes if arg.respond_to?(:attributes) raise ArgumentError.new("Hash expected, got #{arg.class.name}:#{arg.inspect}") unless arg.is_a? Hash arg.each do |k,v| - @title[k.to_sym] = if [Date, DateTime, Time].include? v.class + @title[k.to_sym] = if v.respond_to?(:strftime) or v.is_a?(Numeric) ::I18n.localize(v) else v.to_s diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index cac97d79ff..24b880e2b3 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -18,7 +18,7 @@ # class AssetsController < ApplicationController - manage_restfully + manage_restfully :currency=>'@current_company.default_currency', :depreciation_method=>"'linear'" list(:conditions=>{:company_id=>['@current_company.id']}) do |t| t.column :name, :url=>true diff --git a/app/controllers/bank_statements_controller.rb b/app/controllers/bank_statements_controller.rb index b7ff9bdf2e..e1488711fa 100644 --- a/app/controllers/bank_statements_controller.rb +++ b/app/controllers/bank_statements_controller.rb @@ -25,8 +25,8 @@ class BankStatementsController < ApplicationController t.column :number, :url=>true t.column :started_on t.column :stopped_on - t.column :debit - t.column :credit + t.column :debit, :currency=>"RECORD.cash.currency" + t.column :credit, :currency=>"RECORD.cash.currency" t.action :point t.action :edit t.action :destroy, :method=>:delete, :confirm=>:are_you_sure_you_want_to_delete diff --git a/app/controllers/cash_transfers_controller.rb b/app/controllers/cash_transfers_controller.rb index f7ed92be2e..edf6a91172 100644 --- a/app/controllers/cash_transfers_controller.rb +++ b/app/controllers/cash_transfers_controller.rb @@ -22,11 +22,9 @@ class CashTransfersController < ApplicationController list(:conditions=>["#{CashTransfer.table_name}.company_id = ? ", ['@current_company.id']]) do |t| t.column :number, :url=>true - t.column :emitter_amount - t.column :name, :through=>:emitter_currency + t.column :emitter_amount, :currency=>"RECORD.emitter_cash.currency" t.column :name, :through=>:emitter_cash, :url=>true - t.column :receiver_amount - t.column :name, :through=>:receiver_currency + t.column :receiver_amount, :currency=>"RECORD.receiver_cash.currency" t.column :name, :through=>:receiver_cash, :url=>true t.column :created_on t.column :comment diff --git a/app/controllers/cashes_controller.rb b/app/controllers/cashes_controller.rb index 8fea136a77..4f395bc40b 100644 --- a/app/controllers/cashes_controller.rb +++ b/app/controllers/cashes_controller.rb @@ -22,7 +22,8 @@ class CashesController < ApplicationController list(:conditions=>{:company_id=>['@current_company.id']}, :order=>:name) do |t| t.column :name, :url=>true t.column :nature_label - t.column :name, :through=>:currency + t.column :currency + t.column :country t.column :number, :through=>:account, :url=>true t.column :name, :through=>:journal, :url=>true t.action :edit @@ -63,7 +64,7 @@ def new render :partial=>'accountancy_form', :locals=>{:nature=>params[:nature]} return end - @cash = Cash.new(:mode=>"bban", :nature=>"bank_account", :entity_id=>params[:entity_id]||@current_company.entity_id) + @cash = Cash.new(:mode=>"bban", :currency=>@current_company.default_currency, :nature=>"bank_account", :entity_id=>params[:entity_id]||@current_company.entity_id) render_restfully_form end diff --git a/app/controllers/deposits_controller.rb b/app/controllers/deposits_controller.rb index 3bef664a34..8808d0511e 100644 --- a/app/controllers/deposits_controller.rb +++ b/app/controllers/deposits_controller.rb @@ -21,11 +21,12 @@ class DepositsController < ApplicationController list(:conditions=>{:company_id=>['@current_company.id']}, :order=>"created_at DESC") do |t| t.column :number, :url=>true - t.column :amount, :url=>true + t.column :amount, :currency=>"RECORD.cash.currency", :url=>true t.column :payments_count t.column :name, :through=>:cash, :url=>true t.column :label, :through=>:responsible t.column :created_on + t.column :comment t.action :show, :url=>{:format=>:pdf}, :image=>:print t.action :edit, :if=>'RECORD.locked == false' t.action :destroy, :method=>:delete, :confirm=>:are_you_sure_you_want_to_delete, :if=>'RECORD.locked == false' @@ -44,7 +45,7 @@ def index t.column :account_number t.column :check_number t.column :paid_on - t.column :amount, :url=>true + t.column :amount, :currency=>"RECORD.mode.cash.currency", :url=>true end # Displays details of one deposit selected with +params[:id]+ @@ -68,7 +69,7 @@ def show t.column :check_number t.column :paid_on t.column :label, :through=>:responsible - t.column :amount + t.column :amount, :currency=>"RECORD.mode.cash.currency" t.check_box :to_deposit, :value=>'(RECORD.to_bank_on<=Date.today and (session[:deposit_id].nil? ? (RECORD.responsible.nil? or RECORD.responsible_id==@current_user.id) : (RECORD.deposit_id==session[:deposit_id])))', :label=>tc(:to_deposit) end diff --git a/app/controllers/financial_years_controller.rb b/app/controllers/financial_years_controller.rb index ae56249935..a9749f3c85 100644 --- a/app/controllers/financial_years_controller.rb +++ b/app/controllers/financial_years_controller.rb @@ -25,6 +25,7 @@ class FinancialYearsController < ApplicationController t.column :started_on, :url=>true t.column :stopped_on, :url=>true t.column :currency + t.column :currency_precision t.action :close, :if => '!RECORD.closed and RECORD.closable?' t.action :edit, :if => '!RECORD.closed' t.action :destroy, :method=>:delete, :confirm=>:are_you_sure_you_want_to_delete, :if => '!RECORD.closed' diff --git a/app/controllers/incoming_payment_modes_controller.rb b/app/controllers/incoming_payment_modes_controller.rb index 657e0c7ad3..e8c152cec1 100644 --- a/app/controllers/incoming_payment_modes_controller.rb +++ b/app/controllers/incoming_payment_modes_controller.rb @@ -23,10 +23,11 @@ class IncomingPaymentModesController < ApplicationController list(:conditions=>{:company_id=>['@current_company.id']}, :order=>:position) do |t| t.column :name - t.column :with_accounting t.column :name, :through=>:cash, :url=>true + t.column :with_accounting t.column :with_deposit t.column :label, :through=>:depositables_account, :url=>true + t.column :name, :through=>:depositables_journal, :url=>true t.column :with_commission t.action :up, :method=>:post, :if=>"!RECORD.first\?" t.action :down, :method=>:post, :if=>"!RECORD.last\?" diff --git a/app/controllers/incoming_payments_controller.rb b/app/controllers/incoming_payments_controller.rb index 660784f72b..a16e988813 100644 --- a/app/controllers/incoming_payments_controller.rb +++ b/app/controllers/incoming_payments_controller.rb @@ -42,8 +42,8 @@ def self.incoming_payments_conditions(options={}) t.column :number, :url=>true t.column :full_name, :through=>:payer, :url=>true t.column :paid_on - t.column :amount, :url=>true - t.column :used_amount + t.column :amount, :currency=>"RECORD.mode.cash.currency", :url=>true + t.column :used_amount, :currency=>"RECORD.mode.cash.currency" t.column :name, :through=>:mode t.column :check_number t.column :to_bank_on diff --git a/app/controllers/interfacers_controller.rb b/app/controllers/interfacers_controller.rb index 32605bc206..70572445e1 100644 --- a/app/controllers/interfacers_controller.rb +++ b/app/controllers/interfacers_controller.rb @@ -73,19 +73,18 @@ def product_units search_for(:account, :columns=>["number:X%", :name], :conditions =>{:company_id=>['@current_company.id']}) search_for(:all_contacts, :contacts, :columns=>[:address], :conditions =>["company_id = ? AND deleted_at IS NULL", ['@current_company.id']]) search_for(:attorneys_accounts, :accounts, :columns=>[:number, :name], :conditions=>["company_id=? AND number LIKE ?", ["@current_company.id"], ["@current_company.preferred_third_attorneys_accounts.to_s+'%'"]]) - # search_for(:available_prices, :prices, :columns=>["products.code", "products.name", "prices.pretax_amount", "prices.amount"], :joins=>"JOIN #{Product.table_name} AS products ON (product_id=products.id)", :conditions=>["prices.company_id=? AND prices.active=? AND products.active=?", ['@current_company.id'], true, true], :order=>"products.name, prices.amount") - search_for(:available_prices, :prices, :columns=>["product.code", "product.name", :pretax_amount, :amount], :joins=>[:product], :conditions=>["#{Price.table_name}.company_id=? AND #{Price.table_name}.active=? AND #{Product.table_name}.active=?", ['@current_company.id'], true, true], :order=>"products.name, prices.amount") + + + search_for(:available_prices, :prices, :columns=>["product.code", "product.name", {:name=>:pretax_amount, :code=>"I18n.localize(DATUM, :currency=>RECORD.currency)"}, {:name=>:amount, :code=>"I18n.localize(DATUM, :currency=>RECORD.currency)"}], :joins=>[:product], :conditions=>["#{Price.table_name}.company_id=? AND #{Price.table_name}.active=? AND #{Product.table_name}.active=?", ['@current_company.id'], true, true], :order=>"products.name, prices.amount") + # search_for(:available_prices, :prices, :columns=>["product.code", "product.name", :pretax_amount, :amount], :joins=>[:product], :conditions=>["#{Price.table_name}.company_id=? AND #{Price.table_name}.active=? AND #{Product.table_name}.active=?", ['@current_company.id'], true, true], :order=>"products.name, prices.amount") search_for(:clients_accounts, :accounts, :columns=>[:number, :name], :conditions=>["company_id=? AND number LIKE ?", ["@current_company.id"], ["@current_company.preferred_third_clients_accounts.to_s+'%'"]]) search_for(:client_contacts, :contacts, :columns=>[:address], :conditions=>["company_id = ? AND entity_id = ? AND deleted_at IS NULL", ['@current_company.id'], ['session[:current_entity_id]']]) search_for(:clients, :entities, :columns=>[:code, :full_name], :conditions => {:company_id=>['@current_company.id'], :client=>true}) search_for(:collected_account, :account, :columns=>["number:X%", :name], :conditions => {:company_id=>['@current_company.id']}) - # search_for(:contacts, :columns=>[:address], :conditions => { :company_id=>['@current_company.id'], :entity_id=>['@current_company.entity_id']}) search_for(:districts, :columns=>[:name, :code], :conditions=>{:company_id=>['@current_company.id']}) search_for(:entities, :columns=>[:code, :full_name], :conditions => {:company_id=>['@current_company.id']}) - # search_for(:incoming_delivery_contacts, :contact, :columns=>['entities.full_name', :address], :conditions =>["#{Contact.table_name}.company_id = ? AND #{Contact.table_name}.deleted_at IS NULL", ['@current_company.id']], :joins=>"JOIN #{Company.table_name} AS companies ON (companies.entity_id=#{Contact.table_name}.entity_id))") search_for(:incoming_delivery_contacts, :contact, :columns=>['entity.full_name', :address], :conditions =>["#{Contact.table_name}.company_id = ? AND #{Contact.table_name}.deleted_at IS NULL AND #{Contact.table_name}.entity_id = #{Company.table_name}.entity_id", ['@current_company.id']], :joins=>[:company]) search_for(:operation_products, :product, :columns=>[:code, :name], :conditions =>{:company_id=>['@current_company.id'], :active=>true}) - # search_for(:operation_out_products, :products, :columns=>[:code, :name], :conditions => {:company_id=>['@current_company.id'], :active=>true, :to_produce=>true}) search_for(:outgoing_deliveries, :columns=>[:planned_on, "contact.address"], :conditions=>["#{OutgoingDelivery.table_name}.company_id = ? AND transport_id IS NULL", ['@current_company.id']], :joins=>[:contact]) search_for(:outgoing_delivery_contacts, :contacts, :columns=>['entity.full_name', :address], :conditions=>["#{Contact.table_name}.company_id = ? AND #{Contact.table_name}.deleted_at IS NULL", ['@current_company.id']], :joins=>[:entity]) search_for(:paid_account, :account, :columns=>["number:X%", :name], :conditions => {:company_id=>['@current_company.id']}) diff --git a/app/controllers/journal_entries_controller.rb b/app/controllers/journal_entries_controller.rb index 586654644c..375b46c086 100644 --- a/app/controllers/journal_entries_controller.rb +++ b/app/controllers/journal_entries_controller.rb @@ -24,10 +24,10 @@ class JournalEntriesController < ApplicationController t.column :number, :through=>:account, :url=>true t.column :name, :through=>:account, :url=>true t.column :number, :through=>:bank_statement, :url=>true - t.column :original_debit - t.column :original_credit - t.column :debit - t.column :credit + t.column :original_debit, :currency=>"RECORD.entry.original_currency" + t.column :original_credit, :currency=>"RECORD.entry.original_currency" + t.column :debit, :currency=>"RECORD.entry.financial_year.currency" + t.column :credit, :currency=>"RECORD.entry.financial_year.currency" end diff --git a/app/controllers/outgoing_payment_modes_controller.rb b/app/controllers/outgoing_payment_modes_controller.rb index fe4346e182..7dfd353d5b 100644 --- a/app/controllers/outgoing_payment_modes_controller.rb +++ b/app/controllers/outgoing_payment_modes_controller.rb @@ -23,8 +23,8 @@ class OutgoingPaymentModesController < ApplicationController list(:conditions=>{:company_id=>['@current_company.id']}, :order=>:position) do |t| t.column :name - t.column :with_accounting t.column :name, :through=>:cash, :url=>true + t.column :with_accounting t.action :up, :method=>:post, :if=>"!RECORD.first\?" t.action :down, :method=>:post, :if=>"!RECORD.last\?" t.action :edit diff --git a/app/controllers/sale_natures_controller.rb b/app/controllers/sale_natures_controller.rb index 99c16d6843..8238c3b885 100644 --- a/app/controllers/sale_natures_controller.rb +++ b/app/controllers/sale_natures_controller.rb @@ -18,17 +18,20 @@ # class SaleNaturesController < ApplicationController - manage_restfully + manage_restfully :currency=>"@current_company.default_currency" list(:conditions=>{:company_id=>['@current_company.id']}) do |t| - t.column :name + t.column :name, :url=>true t.column :active - t.column :name, :through=>:expiration, :url=>true - t.column :name, :through=>:payment_delay, :url=>true + t.column :currency + # t.column :name, :through=>:expiration, :url=>true + # t.column :name, :through=>:payment_delay, :url=>true t.column :downpayment - t.column :downpayment_minimum - t.column :downpayment_rate - t.column :comment + # t.column :downpayment_minimum + # t.column :downpayment_rate + t.column :with_accounting + t.column :name, :through=>:journal, :url=>true + #t.column :comment t.action :edit t.action :destroy, :method=>:delete, :confirm=>:are_you_sure_you_want_to_delete end @@ -37,4 +40,9 @@ class SaleNaturesController < ApplicationController def index end + def show + @sale_nature = find_and_check + t3e @sale_nature + end + end diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb index 35a29f0857..5c818396c2 100644 --- a/app/controllers/sales_controller.rb +++ b/app/controllers/sales_controller.rb @@ -49,8 +49,8 @@ def self.sales_conditions t.column :label, :through=>:responsible t.column :comment t.column :state_label - t.column :paid_amount - t.column :amount + t.column :paid_amount, :currency=>true + t.column :amount, :currency=>true t.action :show, :url=>{:format=>:pdf}, :image=>:print t.action :edit, :if=>'RECORD.draft? ' t.action :cancel, :if=>'RECORD.cancelable? ' @@ -72,8 +72,8 @@ def index t.column :number, :url=>true, :children=>:designation t.column :full_name, :through=>:client, :children=>false t.column :created_on, :children=>false - t.column :pretax_amount - t.column :amount + t.column :pretax_amount, :currency=>true + t.column :amount, :currency=>true end list(:deliveries, :model=>:outgoing_deliveries, :children=>:lines, :conditions=>{:company_id=>['@current_company.id'], :sale_id=>['session[:current_sale_id]']}) do |t| @@ -131,9 +131,9 @@ def index t.column :serial, :through=>:tracking, :url=>true t.column :quantity t.column :label, :through=>:unit - t.column :pretax_amount, :through=>:price, :label=>"unit_price_amount" - t.column :pretax_amount - t.column :amount + t.column :pretax_amount, :through=>:price, :label=>"unit_price_amount", :currency=>true + t.column :pretax_amount, :currency=>"RECORD.sale.currency" + t.column :amount, :currency=>"RECORD.sale.currency" t.action :edit, :if=>'RECORD.sale.draft? and RECORD.reduction_origin_id.nil? ' t.action :destroy, :method=>:delete, :confirm=>:are_you_sure_you_want_to_delete, :if=>'RECORD.sale.draft? and RECORD.reduction_origin_id.nil? ' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9be49726a9..1a6c2a1ef1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -135,6 +135,13 @@ def number_to_management(value) number_to_currency(number, :precision=>2, :format=>'%n', :delimiter=>' ', :separator=>',') end + # Take an extra argument which will translate + def number_to_money(amount, currency, options={}) + return unless amount and currency + return Numisma[currency].localize(amount, options) + end + + def preference(name) # name = self.controller.controller_name.to_s << name.to_s if name.to_s.match(/^\./) @@ -258,7 +265,10 @@ def attribute_item(object, attribute, options={}) end if [TrueClass, FalseClass].include? value.class value = content_tag(:div, "", :class=>"checkbox-#{value}") - elsif ["Date", "Time", "DateTime"].include? value.class.name + elsif options[:currency] and value.is_a?(Numeric) + value = ::I18n.localize(value, :currency=>options[:currency]) + value = link_to(value.to_s, options[:url]) if options[:url] + elsif value.respond_to?(:strftime) or value.is_a?(Numeric) value = ::I18n.localize(value) value = link_to(value.to_s, options[:url]) if options[:url] elsif options[:duration] @@ -1447,64 +1457,5 @@ def condition_label(condition) - - # Take an extra argument which will translate - def number_to_money(amount, currency, options={}) - return unless amount and currency - - options.symbolize_keys! - - defaults = I18n.translate('number.format'.to_sym, :locale => options[:locale], :default => {}) - defaultt = I18n.translate('number.currency.format'.to_sym, :locale => options[:locale], :default => {}) - defaultt[:negative_format] ||= "-" + defaultt[:format] if defaultt[:format] - formatcy = I18n.translate("number.currency.formats.#{currency}".to_sym, :locale => options[:locale], :default => {}) - formatcy[:negative_format] ||= "-" + formatcy[:format] if formatcy[:format] - - prec = {} - prec[:separator] = formatcy[:separator] || defaultt[:separator] || defaults[:separator] - prec[:delimiter] = formatcy[:delimiter] || defaultt[:delimiter] || defaults[:delimiter] - prec[:precision] = formatcy[:precision] || Numisma[currency].precision || defaultt[:precision] - format = formatcy[:format] || defaultt[:format] || defaults[:format] - negative_format = formatcy[:negative_format] || defaultt[:negative_format] || defaults[:negative_format] || "-" + format - unit = formatcy[:unit] || Numisma[currency].unit || currency - - # defaults = {}.merge(defaults).merge!(formatcy) - # defaults.merge!(defaultt) - # defaults.merge!(formatcy) - # defaults[:negative_format] = "-" + options[:format] if options[:format] - # options = defaults.merge!(options) - - # unit = formatcy[:unit] || Numisma[currency].unit || currency - # format = options.delete(:format) - - # options[:precision] ||= Numisma[currency].precision - - # raise [amount, currency, prec, unit, format, negative_format].inspect - - if amount.to_f < 0 - format = negative_format # options.delete(:negative_format) - amount = amount.respond_to?("abs") ? amount.abs : amount.sub(/^-/, '') - end - - #begin - # value = number_with_precision(amount, prec.merge(:raise => true)) - value = amount.to_s - integers, decimals = value.split(/\./) - # TODO: Find a better way to delimite thousands - decimals = decimals.gsub(/0+$/, '').ljust(prec[:precision], '0').reverse.split(/(?=\d{3})/).reverse.collect{|x| x.reverse}.join(prec[:delimiter]) - value = integers.gsub(/^0+[1-9]+/, '').gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{prec[:delimiter]}") - value += prec[:separator] + decimals unless decimals.blank? - format.gsub(/%n/, value).gsub(/%u/, unit).gsub(/%s/, ' ').html_safe - # rescue InvalidNumberError => e - # if options[:raise] - # raise - # else - # formatted_number = format.gsub(/%n/, e.number).gsub(/%u/, unit).gsub(/%s/, ' ') - # e.number.to_s.html_safe? ? formatted_number.html_safe : formatted_number - # end - # end - end - - end diff --git a/app/models/account.rb b/app/models/account.rb index 2a13cbfd01..23fc93074e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -73,7 +73,7 @@ class Account < CompanyRecord self.label = tc(:label, :number=>self.number.to_s, :name=>self.name.to_s) end - protect_on_destroy do + protect(:on => :destroy) do dependencies = 0 for k, v in self.class.reflections.select{|k, v| v.macro == :has_many} dependencies += self.send(k).size diff --git a/app/models/asset.rb b/app/models/asset.rb index 885d9f1924..faa0a1a9fe 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -50,7 +50,7 @@ # class Asset < CompanyRecord - DEPRECATION_METHODS = ['linear'] + DEPRECATION_METHODS = ['linear', 'graduated'] acts_as_numbered belongs_to :account belongs_to :journal diff --git a/app/models/bank_statement.rb b/app/models/bank_statement.rb index 8ec6ed9a3e..4a7f42e908 100644 --- a/app/models/bank_statement.rb +++ b/app/models/bank_statement.rb @@ -42,15 +42,13 @@ class BankStatement < CompanyRecord validates_length_of :number, :allow_nil => true, :maximum => 255 validates_presence_of :cash, :company, :credit, :debit, :number, :started_on, :stopped_on #]VALIDATORS] - attr_readonly :company_id belongs_to :cash - belongs_to :company has_many :lines, :dependent=>:nullify, :class_name=>"JournalEntryLine" before_validation do self.company_id = self.cash.company_id if self.cash - self.debit = self.lines.sum(:debit) - self.credit = self.lines.sum(:credit) + self.debit = self.lines.sum(:original_debit) + self.credit = self.lines.sum(:original_credit) end # A bank account statement has to contain all the planned records. diff --git a/app/models/cash.rb b/app/models/cash.rb index 75c3263e6e..9bd56242b6 100644 --- a/app/models/cash.rb +++ b/app/models/cash.rb @@ -28,6 +28,7 @@ # bic :string(16) # by_default :boolean not null # company_id :integer not null +# country :string(2) # created_at :datetime not null # creator_id :integer # currency :string(3) @@ -52,7 +53,7 @@ class Cash < CompanyRecord @@modes = ["iban", "bban"] @@bban_translations = {:fr=>["abcdefghijklmonpqrstuvwxyz", "12345678912345678923456789"]} - attr_readonly :company_id, :nature + attr_readonly :nature, :currency belongs_to :account belongs_to :company belongs_to :entity @@ -62,10 +63,8 @@ class Cash < CompanyRecord has_many :outgoing_payment_modes has_many :incoming_payment_modes has_one :last_bank_statement, :class_name=>"BankStatement", :order=>"stopped_on DESC" - validates_inclusion_of :mode, :in=>%w( iban bban ) - validates_uniqueness_of :account_id - # validates_presence_of :bank_name #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. + validates_length_of :country, :allow_nil => true, :maximum => 2 validates_length_of :currency, :allow_nil => true, :maximum => 3 validates_length_of :bic, :nature, :allow_nil => true, :maximum => 16 validates_length_of :iban, :allow_nil => true, :maximum => 34 @@ -75,10 +74,11 @@ class Cash < CompanyRecord validates_inclusion_of :by_default, :in => [true, false] validates_presence_of :account, :company, :journal, :mode, :name, :nature #]VALIDATORS] + # validates_presence_of :bank_name + validates_inclusion_of :mode, :in=>%w( iban bban ) + validates_uniqueness_of :account_id - COUNTRY_CODE_FR="FR" - # before create a bank account, this computes automatically code iban. before_validation do self.mode.lower! @@ -86,25 +86,28 @@ class Cash < CompanyRecord # raise Exception.new self.mode.inspect self.entity_id = self.company.entity_id if self.company self.currency ||= self.company.default_currency - if self.use_mode? + if self.iban_mode? self.iban = self.iban.to_s.upper.gsub(/[^A-Z0-9]/, '') - else - self.iban = self.class.generate_iban(COUNTRY_CODE_FR, self.bank_code+self.agency_code+self.number+self.key) + elsif self.bban_mode? + self.iban = self.class.generate_iban(self.country, self.bank_code+self.agency_code+self.number+self.key) end self.iban_label = self.iban.split(/(\w\w\w\w)/).delete_if{|k| k.empty?}.join(" ") end # IBAN have to be checked before saved. validate do + if self.journal + errors.add(:journal, :currency_does_not_match) unless self.currency == self.journal.currency + end if self.bank_account? - if self.use_mode?(:bban) - errors.add_to_base(:unvalid_bban) unless self.class.valid_bban?(COUNTRY_CODE_FR, self.attributes) + if self.bban_mode? + errors.add_to_base(:unvalid_bban) unless self.class.valid_bban?(self.country, self.attributes) end errors.add(:iban, :invalid) unless self.class.valid_iban?(self.iban) end end - protect_on_destroy do + protect(:on => :destroy) do self.deposits.size <= 0 and self.bank_statements.size <= 0 end @@ -113,8 +116,16 @@ def bank_account? self.nature.to_s == "bank_account" end - def use_mode?(value=:iban) - self.mode.to_s.lower == value.to_s.lower + def cash? + self.nature.to_s == "cash" + end + + def bban_mode? + self.mode.to_s.downcase == "bban" + end + + def iban_mode? + self.mode.to_s.downcase == "iban" end @@ -154,7 +165,7 @@ def self.valid_bban?(country_code, options={}) #this method generates the IBAN key. def self.generate_iban(country_code, bban) - iban=bban+country_code+"00" + iban = bban+country_code.upcase+"00" iban.each_char do |c| if c=~/\D/ iban.gsub!(c, c.to_i(36).to_s) diff --git a/app/models/cash_transfer.rb b/app/models/cash_transfer.rb index 6d61e7ca77..f3fbb9f63d 100644 --- a/app/models/cash_transfer.rb +++ b/app/models/cash_transfer.rb @@ -26,19 +26,15 @@ # created_at :datetime not null # created_on :date # creator_id :integer -# currency :string(3) +# currency_rate :decimal(19, 10) default(1.0), not null # emitter_amount :decimal(19, 4) default(0.0), not null # emitter_cash_id :integer not null -# emitter_currency :string(3) -# emitter_currency_rate :decimal(19, 10) default(1.0), not null # emitter_journal_entry_id :integer # id :integer not null, primary key # lock_version :integer default(0), not null # number :string(255) not null # receiver_amount :decimal(19, 4) default(0.0), not null # receiver_cash_id :integer not null -# receiver_currency :string(3) -# receiver_currency_rate :decimal(19, 10) # receiver_journal_entry_id :integer # updated_at :datetime not null # updater_id :integer @@ -54,10 +50,9 @@ class CashTransfer < CompanyRecord belongs_to :receiver_cash, :class_name=>"Cash" belongs_to :receiver_journal_entry, :class_name=>"JournalEntry" #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. - validates_numericality_of :emitter_amount, :emitter_currency_rate, :receiver_amount, :receiver_currency_rate, :allow_nil => true - validates_length_of :currency, :emitter_currency, :receiver_currency, :allow_nil => true, :maximum => 3 + validates_numericality_of :currency_rate, :emitter_amount, :receiver_amount, :allow_nil => true validates_length_of :number, :allow_nil => true, :maximum => 255 - validates_presence_of :company, :emitter_amount, :emitter_cash, :emitter_currency_rate, :number, :receiver_amount, :receiver_cash + validates_presence_of :company, :currency_rate, :emitter_amount, :emitter_cash, :number, :receiver_amount, :receiver_cash #]VALIDATORS] validates_numericality_of :emitter_amount, :receiver_amount, :greater_than=>0.0 validates_presence_of :created_on @@ -68,14 +63,14 @@ class CashTransfer < CompanyRecord if self.currency == self.company.default_currency if self.emitter_cash - self.emitter_currency ||= self.emitter_cash.currency + self.emitter_currency = self.emitter_cash.currency # TODO: Find a way to specify currency rates - self.emitter_currency_rate ||= self.emitter_currency.rate + self.emitter_currency_rate ||= rand # self.emitter_currency.rate end if self.receiver_cash - self.receiver_currency ||= self.receiver_cash.currency + self.receiver_currency = self.receiver_cash.currency # TODO: Find a way to specify currency rates - self.receiver_currency_rate ||= self.receiver_currency.rate + self.receiver_currency_rate ||= rand # self.receiver_currency.rate end end diff --git a/app/models/custom_field_choice.rb b/app/models/custom_field_choice.rb index 41b83ba710..874f95dc93 100644 --- a/app/models/custom_field_choice.rb +++ b/app/models/custom_field_choice.rb @@ -48,7 +48,7 @@ class CustomFieldChoice < CompanyRecord self.value = self.name.to_s.codeize if self.value.blank? end - protect_on_destroy do + protect(:on => :destroy) do return self.data.count.zero? end diff --git a/app/models/delay.rb b/app/models/delay.rb index c576d3d98c..e8d1bfd83c 100644 --- a/app/models/delay.rb +++ b/app/models/delay.rb @@ -37,16 +37,16 @@ class Delay < CompanyRecord - #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. - validates_length_of :expression, :name, :allow_nil => true, :maximum => 255 - validates_inclusion_of :active, :in => [true, false] - validates_presence_of :company, :expression, :name - #]VALIDATORS] attr_readonly :company_id belongs_to :company has_many :entities has_many :sales has_many :sale_natures + #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. + validates_length_of :expression, :name, :allow_nil => true, :maximum => 255 + validates_inclusion_of :active, :in => [true, false] + validates_presence_of :company, :expression, :name + #]VALIDATORS] validates_uniqueness_of :name, :scope=>:company_id DELAY_SEPARATOR = ', ' diff --git a/app/models/deposit.rb b/app/models/deposit.rb index bb146d2608..37c208ab2c 100644 --- a/app/models/deposit.rb +++ b/app/models/deposit.rb @@ -43,12 +43,6 @@ class Deposit < CompanyRecord - #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. - validates_numericality_of :amount, :allow_nil => true - validates_length_of :number, :allow_nil => true, :maximum => 255 - validates_inclusion_of :in_cash, :locked, :in => [true, false] - validates_presence_of :amount, :cash, :company, :created_on, :mode - #]VALIDATORS] acts_as_numbered attr_readonly :company_id belongs_to :cash @@ -59,8 +53,18 @@ class Deposit < CompanyRecord has_many :payments, :class_name=>"IncomingPayment", :dependent=>:nullify, :order=>"number" # has_many :journal_entries, :as=>:resource, :dependent=>:nullify, :order=>"created_at" + #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. + validates_numericality_of :amount, :allow_nil => true + validates_length_of :number, :allow_nil => true, :maximum => 255 + validates_inclusion_of :in_cash, :locked, :in => [true, false] + validates_presence_of :amount, :cash, :company, :created_on, :mode + #]VALIDATORS] validates_presence_of :responsible, :cash + before_validation do + self.cash = self.mode.cash if self.mode + end + before_validation(:on=>:update) do self.payments_count = self.payments.count self.amount = self.payments.sum(:amount) @@ -104,7 +108,7 @@ class Deposit < CompanyRecord end end - protect_on_destroy do + protect(:on => :destroy) do return !self.locked? end diff --git a/app/models/document.rb b/app/models/document.rb index f67fadebfe..d7d85453dc 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -25,18 +25,18 @@ # creator_id :integer # crypt_key :binary # crypt_mode :string(255) not null -# extension :string(255) +# extension :string(255) not null # filename :string(255) # filesize :integer # id :integer not null, primary key # lock_version :integer default(0), not null # nature_code :string(255) # original_name :string(255) not null -# owner_id :integer -# owner_type :string(255) +# owner_id :integer not null +# owner_type :string(255) not null # printed_at :datetime # sha256 :string(255) not null -# subdir :string(255) +# subdir :string(255) not null # template_id :integer # updated_at :datetime not null # updater_id :integer @@ -46,7 +46,7 @@ class Document < CompanyRecord #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. validates_numericality_of :filesize, :allow_nil => true, :only_integer => true validates_length_of :crypt_mode, :extension, :filename, :nature_code, :original_name, :owner_type, :sha256, :subdir, :allow_nil => true, :maximum => 255 - validates_presence_of :company, :crypt_mode, :original_name, :sha256 + validates_presence_of :company, :crypt_mode, :extension, :original_name, :owner, :owner_type, :sha256, :subdir #]VALIDATORS] belongs_to :company belongs_to :owner, :polymorphic=>true diff --git a/app/models/document_template.rb b/app/models/document_template.rb index b9e4ffc829..8460136ecf 100644 --- a/app/models/document_template.rb +++ b/app/models/document_template.rb @@ -116,7 +116,7 @@ def set_by_default# (by_default=nil) end end - protect_on_destroy do + protect(:on => :destroy) do self.documents.size <= 0 end diff --git a/app/models/entity.rb b/app/models/entity.rb index 67bdcafbfa..81da7c73ec 100644 --- a/app/models/entity.rb +++ b/app/models/entity.rb @@ -158,7 +158,7 @@ class Entity < CompanyRecord end end - protect_on_destroy do + protect(:on => :destroy) do #raise Exception.new("Can't delete entity of the company") if self.id == self.company.entity.id return false if self.id == self.company.entity.id or self.sales_invoices.size > 0 return true diff --git a/app/models/entity_category.rb b/app/models/entity_category.rb index a15455fc91..be13f957e8 100644 --- a/app/models/entity_category.rb +++ b/app/models/entity_category.rb @@ -54,7 +54,7 @@ class EntityCategory < CompanyRecord self.code = self.code[0..7] end - protect_on_destroy do + protect(:on => :destroy) do self.entities.size <= 0 and self.prices.size <= 0 end diff --git a/app/models/entity_link_nature.rb b/app/models/entity_link_nature.rb index 4bed9346a0..dbc7f7c39b 100644 --- a/app/models/entity_link_nature.rb +++ b/app/models/entity_link_nature.rb @@ -46,7 +46,7 @@ class EntityLinkNature < CompanyRecord belongs_to :company has_many :entity_links, :foreign_key=>:nature_id - protect_on_destroy do + protect(:on => :destroy) do self.entity_links.size <= 0 end diff --git a/app/models/entity_nature.rb b/app/models/entity_nature.rb index 64cfba713c..c420a03be1 100644 --- a/app/models/entity_nature.rb +++ b/app/models/entity_nature.rb @@ -57,7 +57,7 @@ class EntityNature < CompanyRecord end end - protect_on_destroy do + protect(:on => :destroy) do self.entities.size <= 0 end diff --git a/app/models/event_nature.rb b/app/models/event_nature.rb index 394928f0a4..1634b77125 100644 --- a/app/models/event_nature.rb +++ b/app/models/event_nature.rb @@ -46,7 +46,7 @@ class EventNature < CompanyRecord belongs_to :company has_many :events, :foreign_key=>:nature_id - protect_on_destroy do + protect(:on => :destroy) do self.events.size <= 0 end diff --git a/app/models/financial_year.rb b/app/models/financial_year.rb index a45c9f70d5..446a69c5dd 100644 --- a/app/models/financial_year.rb +++ b/app/models/financial_year.rb @@ -20,18 +20,19 @@ # # == Table: financial_years # -# closed :boolean not null -# code :string(12) not null -# company_id :integer not null -# created_at :datetime not null -# creator_id :integer -# currency :string(3) -# id :integer not null, primary key -# lock_version :integer default(0), not null -# started_on :date not null -# stopped_on :date not null -# updated_at :datetime not null -# updater_id :integer +# closed :boolean not null +# code :string(12) not null +# company_id :integer not null +# created_at :datetime not null +# creator_id :integer +# currency :string(3) +# currency_precision :integer +# id :integer not null, primary key +# lock_version :integer default(0), not null +# started_on :date not null +# stopped_on :date not null +# updated_at :datetime not null +# updater_id :integer # @@ -40,6 +41,7 @@ class FinancialYear < CompanyRecord belongs_to :company has_many :account_balances, :class_name=>"AccountBalance", :foreign_key=>:financial_year_id, :dependent=>:delete_all #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. + validates_numericality_of :currency_precision, :allow_nil => true, :only_integer => true validates_length_of :currency, :allow_nil => true, :maximum => 3 validates_length_of :code, :allow_nil => true, :maximum => 12 validates_inclusion_of :closed, :in => [true, false] diff --git a/app/models/incoming_payment.rb b/app/models/incoming_payment.rb index 2c58883600..c1a241471b 100644 --- a/app/models/incoming_payment.rb +++ b/app/models/incoming_payment.rb @@ -99,33 +99,33 @@ class IncomingPayment < CompanyRecord errors.add(:amount, :greater_than_or_equal_to, :count=>self.used_amount) if self.amount < self.used_amount end - protect_on_update do + protect(:on => :update) do self.deposit.nil? or not self.deposit.locked end # This method permits to add journal entries corresponding to the payment # It depends on the preference which permit to activate the "automatic bookkeeping" bookkeep do |b| - # attorney_amount = self.attorney_amount - client_amount = self.amount # - attorney_amount mode = self.mode label = tc(:bookkeep, :resource=>self.class.model_name.human, :number=>self.number, :payer=>self.payer.full_name, :mode=>mode.name, :expenses=>self.uses.collect{|p| p.expense.number}.to_sentence, :check_number=>self.check_number) - b.journal_entry(mode.cash.journal, :printed_on=>self.to_bank_on, :unless=>(!mode or !mode.with_accounting? or !self.received)) do |entry| - if mode.with_deposit? - entry.add_debit(label, mode.depositables_account_id, self.amount) - else - entry.add_debit(label, mode.cash.account_id, self.amount-self.commission_amount) - entry.add_debit(label, self.commission_account_id, self.commission_amount) if self.commission_amount > 0 + if mode.with_deposit? + b.journal_entry(mode.depositables_journal, :printed_on=>self.to_bank_on, :unless=>(!mode or !mode.with_accounting? or !self.received)) do |entry| + entry.add_debit(label, mode.depositables_account_id, self.amount-self.commission_amount) + entry.add_debit(label, self.commission_account_id, self.commission_amount) if self.commission_amount > 0 + entry.add_credit(label, self.payer.account(:client).id, self.amount) unless self.amount.zero? + end + else + b.journal_entry(mode.cash.journal, :printed_on=>self.to_bank_on, :unless=>(!mode or !mode.with_accounting? or !self.received)) do |entry| + entry.add_debit(label, mode.cash.account_id, self.amount-self.commission_amount) + entry.add_debit(label, self.commission_account_id, self.commission_amount) if self.commission_amount > 0 + entry.add_credit(label, self.payer.account(:client).id, self.amount) unless self.amount.zero? end - entry.add_credit(label, self.payer.account(:client).id, client_amount) unless client_amount.zero? - # entry.add_credit(label, self.payer.account(:attorney).id, attorney_amount) unless attorney_amount.zero? end - # self.uses.first.reconciliate if self.uses.first end def label - tc(:label, :amount=>self.amount.to_s, :date=>self.created_at.to_date, :mode=>self.mode.name, :usable_amount=>self.unused_amount.to_s, :payer=>self.payer.full_name, :number=>self.number, :currency=>self.company.default_currency.symbol) + tc(:label, :amount=>Numisma[self.mode.cash.currency].localize(self.amount), :date=>I18n.localize(self.to_bank_on), :mode=>self.mode.name, :usable_amount=>Numisma[self.mode.cash.currency].localize(self.unused_amount), :payer=>self.payer.full_name, :number=>self.number) end def unused_amount diff --git a/app/models/incoming_payment_mode.rb b/app/models/incoming_payment_mode.rb index 24ebbe1167..5575abb593 100644 --- a/app/models/incoming_payment_mode.rb +++ b/app/models/incoming_payment_mode.rb @@ -28,6 +28,7 @@ # created_at :datetime not null # creator_id :integer # depositables_account_id :integer +# depositables_journal_id :integer # id :integer not null, primary key # lock_version :integer default(0), not null # name :string(50) not null @@ -42,12 +43,13 @@ class IncomingPaymentMode < CompanyRecord + attr_readonly :cash_id acts_as_list :scope=>:company_id - attr_readonly :company_id belongs_to :cash belongs_to :company belongs_to :commission_account, :class_name=>"Account" belongs_to :depositables_account, :class_name=>"Account" + belongs_to :depositables_journal, :class_name=>"Journal" has_many :depositable_payments, :class_name=>"IncomingPayment", :foreign_key=>:mode_id, :conditions=>{:deposit_id=>nil} has_many :entities, :dependent=>:nullify, :foreign_key=>:payment_mode_id has_many :payments, :foreign_key=>:mode_id, :class_name=>"IncomingPayment" @@ -62,11 +64,18 @@ class IncomingPaymentMode < CompanyRecord validates_presence_of :cash_id before_validation do - self.depositables_account = nil unless self.with_deposit? + if self.cash.cash? + self.with_deposit = false + self.with_commission = false + end + unless self.with_deposit? + self.depositables_account = nil + self.depositables_journal = nil + end return true end - protect_on_destroy do + protect(:on => :destroy) do self.payments.size <= 0 end diff --git a/app/models/journal.rb b/app/models/journal.rb index 31918fc235..48a066a8c1 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -84,7 +84,7 @@ class Journal < CompanyRecord end end - protect_on_destroy do + protect(:on => :destroy) do self.entries.size <= 0 and self.entry_lines.size <= 0 and self.cashes.size <= 0 end diff --git a/app/models/journal_entry.rb b/app/models/journal_entry.rb index e37d473461..d1dd2effa1 100644 --- a/app/models/journal_entry.rb +++ b/app/models/journal_entry.rb @@ -176,11 +176,11 @@ def self.states JournalEntryLine.update_all({:state=>self.state}, ["entry_id = ? AND state != ? ", self.id, self.state]) end - protect_on_destroy do + protect(:on => :destroy) do self.printed_on > self.journal.closed_on and not self.closed? end - protect_on_update do + protect(:on => :update) do self.printed_on > self.journal.closed_on and not self.closed? end diff --git a/app/models/journal_entry_line.rb b/app/models/journal_entry_line.rb index 6c3cc299f1..b030c12fb7 100644 --- a/app/models/journal_entry_line.rb +++ b/app/models/journal_entry_line.rb @@ -115,11 +115,11 @@ class JournalEntryLine < CompanyRecord errors.add(:credit, :greater_or_equal_than, :count=>0) if self.credit<0 end - protect_on_update do + protect(:on => :update) do not self.closed? and self.entry and self.entry.updateable? end - protect_on_destroy do + protect(:on => :destroy) do !self.closed? end diff --git a/app/models/operation.rb b/app/models/operation.rb index 93da81d931..026b6312e5 100644 --- a/app/models/operation.rb +++ b/app/models/operation.rb @@ -144,7 +144,7 @@ def make(made_on) end end - protect_on_update do + protect(:on => :update) do self.production_chain_work_center.nil? end diff --git a/app/models/outgoing_delivery.rb b/app/models/outgoing_delivery.rb index 9fcf40b615..ae5ceb865c 100644 --- a/app/models/outgoing_delivery.rb +++ b/app/models/outgoing_delivery.rb @@ -76,7 +76,7 @@ class OutgoingDelivery < CompanyRecord return true end - protect_on_update do + protect(:on => :update) do return false unless self.moved_on.nil? return true end diff --git a/app/models/outgoing_payment.rb b/app/models/outgoing_payment.rb index e4694c634e..22a9912341 100644 --- a/app/models/outgoing_payment.rb +++ b/app/models/outgoing_payment.rb @@ -77,11 +77,11 @@ class OutgoingPayment < CompanyRecord errors.add(:amount, :greater_than_or_equal_to, :count=>self.used_amount) if self.amount < self.used_amount end - protect_on_update do + protect(:on => :update) do return (self.journal_entry ? !self.journal_entry.closed? : true) end - protect_on_destroy do + protect(:on => :destroy) do updateable? and self.used_amount.zero? end diff --git a/app/models/outgoing_payment_mode.rb b/app/models/outgoing_payment_mode.rb index deddfa6d86..d89fa49572 100644 --- a/app/models/outgoing_payment_mode.rb +++ b/app/models/outgoing_payment_mode.rb @@ -46,7 +46,7 @@ class OutgoingPaymentMode < CompanyRecord belongs_to :company has_many :payments, :class_name=>"OutgoingPayment", :foreign_key=>:mode_id - protect_on_destroy do + protect(:on => :destroy) do self.payments.size.zero? end diff --git a/app/models/purchase.rb b/app/models/purchase.rb index 4375faf76e..051ad1966e 100644 --- a/app/models/purchase.rb +++ b/app/models/purchase.rb @@ -112,11 +112,11 @@ class Purchase < CompanyRecord return true end - protect_on_destroy do + protect(:on => :destroy) do self.updateable? end - protect_on_update do + protect(:on => :update) do # return false if self.unpaid_amount.zero? and self.shipped return true end diff --git a/app/models/role.rb b/app/models/role.rb index 70a6ba118d..666f576a88 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -91,7 +91,7 @@ def rights_array=(array) self.rights = array.select{|x| User.rights_list.include?(x.to_sym)}.join(" ") end - protect_on_destroy do + protect(:on => :destroy) do self.users.size <= 0 end diff --git a/app/models/sale.rb b/app/models/sale.rb index bf96498335..3a72d2e32a 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -140,7 +140,7 @@ class Sale < CompanyRecord @@natures = [:estimate, :order, :invoice] before_validation do - self.currency ||= self.company.default_currency if self.currency.blank? + self.currency = self.nature.currency if self.nature self.paid_amount = self.payment_uses.sum(:amount)||0 self.paid_amount -= self.credits.sum(:amount)||0 @@ -305,7 +305,7 @@ def duplicate(attributes={}) def stats(options={}) array = [] array << [:client_balance, self.client.balance] if options[:with_balance] - array << [:total_amount, self.amount] + array << [:amount, self.amount] array << [:paid_amount, self.paid_amount] array << [:unpaid_amount, self.unpaid_amount] array diff --git a/app/models/sale_line.rb b/app/models/sale_line.rb index 65c0560086..131c978b5c 100644 --- a/app/models/sale_line.rb +++ b/app/models/sale_line.rb @@ -155,7 +155,7 @@ class SaleLine < CompanyRecord # TODO validates responsible can make reduction and reduction rate is convenient end - protect_on_update do + protect(:on => :update) do return self.sale.draft? end diff --git a/app/models/sale_nature.rb b/app/models/sale_nature.rb index 8cfb5083c9..e37ea506d7 100644 --- a/app/models/sale_nature.rb +++ b/app/models/sale_nature.rb @@ -25,11 +25,13 @@ # company_id :integer not null # created_at :datetime not null # creator_id :integer +# currency :string(3) # downpayment :boolean not null # downpayment_minimum :decimal(19, 4) default(0.0), not null # downpayment_rate :decimal(19, 10) default(0.0), not null # expiration_id :integer not null # id :integer not null, primary key +# journal_id :integer # lock_version :integer default(0), not null # name :string(255) not null # payment_delay_id :integer not null @@ -37,18 +39,38 @@ # payment_mode_id :integer # updated_at :datetime not null # updater_id :integer +# with_accounting :boolean not null # class SaleNature < CompanyRecord + acts_as_list :scope=>:company_id + belongs_to :journal + belongs_to :expiration, :class_name=>"Delay" + belongs_to :payment_delay, :class_name=>"Delay" + belongs_to :payment_mode, :class_name=>"IncomingPaymentMode" + has_many :sales #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. validates_numericality_of :downpayment_minimum, :downpayment_rate, :allow_nil => true + validates_length_of :currency, :allow_nil => true, :maximum => 3 validates_length_of :name, :allow_nil => true, :maximum => 255 - validates_inclusion_of :active, :downpayment, :in => [true, false] + validates_inclusion_of :active, :downpayment, :with_accounting, :in => [true, false] validates_presence_of :company, :downpayment_minimum, :downpayment_rate, :expiration, :name, :payment_delay #]VALIDATORS] - belongs_to :payment_delay, :class_name=>"Delay" - belongs_to :payment_mode, :class_name=>"IncomingPaymentMode" - belongs_to :expiration, :class_name=>"Delay" - has_many :sales + validates_presence_of :journal, :if=>Proc.new{|sn| sn.with_accounting?} + validates_uniqueness_of :name, :scope=>:company_id + + validate do + if self.journal + unless self.currency == self.journal.currency + errors.add(:journal, :currency_does_not_match) + end + end + if self.payment_mode + unless self.currency == self.payment_mode.cash.currency + errors.add(:payment_mode, :currency_does_not_match) + end + end + end + end diff --git a/app/models/sequence.rb b/app/models/sequence.rb index 7831099338..105691889e 100644 --- a/app/models/sequence.rb +++ b/app/models/sequence.rb @@ -59,7 +59,7 @@ class Sequence < CompanyRecord self.period ||= 'number' end - protect_on_destroy do + protect(:on=>:destroy) do self.preferences.size <= 0 end @@ -94,7 +94,8 @@ def next_value self.last_number = self.number_start if self.send('last_'+period) != today.send(period) or self.last_year != today.year end self.last_year, self.last_month, self.last_cweek = today.year, today.month, today.cweek - self.save! + raise [self.updateable?, self.destroyable?, self.errors.to_hash].inspect unless self.save + self.compute end diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 4dc6912207..8d9f143013 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -20,6 +20,7 @@ # # == Table: subscriptions # +# _activation :string(255) # comment :text # company_id :integer not null # contact_id :integer @@ -57,7 +58,7 @@ class Subscription < CompanyRecord #[VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. validates_numericality_of :first_number, :last_number, :allow_nil => true, :only_integer => true validates_numericality_of :quantity, :allow_nil => true - validates_length_of :number, :allow_nil => true, :maximum => 255 + validates_length_of :_activation, :number, :allow_nil => true, :maximum => 255 validates_inclusion_of :suspended, :in => [true, false] validates_presence_of :company #]VALIDATORS] diff --git a/app/models/subscription_nature.rb b/app/models/subscription_nature.rb index 53dcb2f16f..d687a74eaf 100644 --- a/app/models/subscription_nature.rb +++ b/app/models/subscription_nature.rb @@ -56,7 +56,7 @@ class SubscriptionNature < CompanyRecord self.reduction_rate ||= 0 end - protect_on_destroy do + protect(:on => :destroy) do self.subscriptions.size <= 0 and self.products.size <= 0 end diff --git a/app/models/tax.rb b/app/models/tax.rb index 3a44144651..ea1099b0fe 100644 --- a/app/models/tax.rb +++ b/app/models/tax.rb @@ -59,7 +59,7 @@ class Tax < CompanyRecord validates_numericality_of :amount, :in=>0..100, :if=>Proc.new{|x| x.percent?} - protect_on_destroy do + protect(:on => :destroy) do self.prices.size <= 0 and self.sale_lines.size <= 0 end diff --git a/app/models/transport.rb b/app/models/transport.rb index 908bc2c803..308355f35d 100644 --- a/app/models/transport.rb +++ b/app/models/transport.rb @@ -66,7 +66,7 @@ class Transport < CompanyRecord # end # end - protect_on_destroy do + protect(:on => :destroy) do return true end diff --git a/app/models/unit.rb b/app/models/unit.rb index 7937d6b915..ce7806a092 100644 --- a/app/models/unit.rb +++ b/app/models/unit.rb @@ -149,7 +149,7 @@ def convertible_to?(other_unit) return (self.base == other_unit.base ? true : false) end - protect_on_destroy do + protect(:on => :destroy) do return false end diff --git a/app/models/user.rb b/app/models/user.rb index f6f8a07db3..a4add552be 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -111,7 +111,7 @@ def useful_rights; @@useful_rights; end return true end - protect_on_destroy do + protect(:on => :destroy) do self.events.size <= 0 and self.sales.size <= 0 and self.operations.size <= 0 and self.transports.size <= 0 end @@ -196,7 +196,7 @@ def can?(right) self.admin? or self.rights.match(/(^|\s)#{right}(\s|$)/) end - protect_on_destroy do + protect(:on => :destroy) do self.company.users.count > 1 end diff --git a/app/models/warehouse.rb b/app/models/warehouse.rb index 0f933ccb85..80e73f67b5 100644 --- a/app/models/warehouse.rb +++ b/app/models/warehouse.rb @@ -91,7 +91,7 @@ def can_receive(product_id) self.can_receive?(product_id) end - protect_on_destroy do + protect(:on => :destroy) do dependencies = 0 for k, v in self.class.reflections.select{|k, v| v.macro == :has_many} dependencies += self.send(k).size diff --git a/app/views/assets/_form.html.haml b/app/views/assets/_form.html.haml index 8ab9dc5943..c9e4ad5dda 100644 --- a/app/views/assets/_form.html.haml +++ b/app/views/assets/_form.html.haml @@ -4,6 +4,7 @@ -f.field :asset, :description, :field=>:textarea -f.field :asset, :comment, :field=>:textarea -f.field :asset, :purchase_amount, (@asset.new_record? ? {"data-live-copy-to"=>"#asset_depreciable_amount"} : {}) + -f.field :asset, :currency, :choices=>currencies -f.field :asset, :purchased_on, (@asset.new_record? ? {"data-live-copy-to"=>"#depreciation_started_on"} : {}) =formalize do |f| @@ -11,9 +12,9 @@ -f.field :asset, :started_on, :id=>"depreciation_started_on" -f.field :asset, :stopped_on -f.field :asset, :depreciable_amount - -f.field :asset, :depreciation_method, :choices=>Asset.deprecation_methods + -f.field :asset, :depreciation_method, :choices=>Asset.deprecation_methods, :field=>:radio =formalize do |f| -f.title :accountancy - -f.field :asset, :journal_id, :choices=>{:reflection=>:journals} - -f.field :asset, :account_id, :choices=>:account + -f.field :asset, :journal_id, :choices=>{:reflection=>:journals}, :new=>true + -f.field :asset, :account_id, :choices=>:account, :new=>true diff --git a/app/views/cashes/_form.html.haml b/app/views/cashes/_form.html.haml index 0e03d9f389..74ec631dff 100644 --- a/app/views/cashes/_form.html.haml +++ b/app/views/cashes/_form.html.haml @@ -5,11 +5,12 @@ -f.error :cash -f.title :general -f.field :cash, :name - -f.field :cash, :currency_id, :choices=>{:reflection=>:currencies} - -if @cash.new_record? - -f.field :cash, :nature, :field=>:radio, :choices=>Cash.natures.collect{|n| [n[0], n[1], {"data-show"=>"##{n[1]}_options", "data-dependents"=>"#cash-accountancy", "data-parameter-name"=>"nature"}]} - -else + -if @cash.has_dependents? + -f.field :cash, :currency, :field=>:label -f.field :cash, :nature_label, :field=>:label + -else + -f.field :cash, :currency, :choices=>currencies + -f.field :cash, :nature, :field=>:radio, :choices=>Cash.natures.collect{|n| [n[0], n[1], {"data-show"=>"##{n[1]}_options", "data-dependents"=>"#cash-accountancy", "data-parameter-name"=>"nature"}]} -if @cash.new_record? or @cash.bank_account? #bank_account_options @@ -18,11 +19,13 @@ -f.field :cash, :bank_name -f.field :cash, :address, :field=>:textarea -f.field :cash, :mode, :field=>:radio, :choices=>Cash.modes.collect{|m| [m[0], m[1], {"data-show"=>"##{m[1]}_options"}]} - =formalize(:id=>:bban_options) do |f| - -f.field :cash, :bank_code, :size=>10 - -f.field :cash, :agency_code, :size=>10 - -f.field :cash, :number - -f.field :cash, :key, :size=>4 + #bban_options + =hidden_field_tag "cash[country]", "fr" + =formalize do |f| + -f.field :cash, :bank_code, :size=>10 + -f.field :cash, :agency_code, :size=>10 + -f.field :cash, :number + -f.field :cash, :key, :size=>4 =formalize(:id=>:iban_options) do |f| -f.field :cash, :iban, :size=>48 -f.field :cash, :bic diff --git a/app/views/cashes/show.html.haml b/app/views/cashes/show.html.haml index e3de3804da..f2b3efa948 100644 --- a/app/views/cashes/show.html.haml +++ b/app/views/cashes/show.html.haml @@ -11,16 +11,16 @@ -l.attribute :address -l.attribute :iban_label -l.attribute :bic - -if @cash.use_mode? :bban + -if @cash.bban_mode? -l.attribute :bank_code -l.attribute :agency_code -l.attribute :number -l.attribute :key -=tabbox(:cash) do |tb| - -tb.tab(:deposits) do - =list(:deposits) - -if @cash.bank_account? +-if @cash.bank_account? + =tabbox(:cash) do |tb| + -tb.tab(:deposits) do + =list(:deposits) -tb.tab(:bank_statements) do =toolbar do |t| -t.link(:new, :controller=>:bank_statements, :cash_id=>@cash.id) diff --git a/app/views/deposits/_form.html.haml b/app/views/deposits/_form.html.haml index 81a23b0dfc..8985094ba6 100644 --- a/app/views/deposits/_form.html.haml +++ b/app/views/deposits/_form.html.haml @@ -2,12 +2,12 @@ =subheading :new_deposit, :mode=>@deposit.mode.name, :count=>@deposit.mode.depositable_payments.size =formalize do |f| - - f.error :deposit - - f.title :infos - - f.field :deposit, :cash_id, :choices=>{:reflection=>:self_bank_accounts}, :new=>{:nature=>:bank_account} - - f.field :deposit, :responsible_id, :choices=>{:reflection=>:users} - - f.field :deposit, :created_on - - f.field :deposit, :comment + -f.error :deposit + -f.title :infos + -# f.field :deposit, :cash_id, :choices=>{:reflection=>:self_bank_accounts}, :new=>{:nature=>:bank_account} + -f.field :deposit, :responsible_id, :choices=>{:reflection=>:users} + -f.field :deposit, :created_on + -f.field :deposit, :comment =hidden_field_tag :mode_id, @deposit.mode_id diff --git a/app/views/deposits/show.html.haml b/app/views/deposits/show.html.haml index ff218daf27..412d96f930 100644 --- a/app/views/deposits/show.html.haml +++ b/app/views/deposits/show.html.haml @@ -20,4 +20,4 @@ %td=@deposit.payments_count %tr.total.important %th=tc(:total) - %td=@deposit.amount.to_s+" "+@deposit.cash.currency.code + %td=number_to_money(@deposit.amount, @deposit.cash.currency) diff --git a/app/views/incoming_payment_modes/_form.html.haml b/app/views/incoming_payment_modes/_form.html.haml index 9dd9877ef8..7ea5f346fa 100644 --- a/app/views/incoming_payment_modes/_form.html.haml +++ b/app/views/incoming_payment_modes/_form.html.haml @@ -2,23 +2,28 @@ -f.error :incoming_payment_mode -f.title :general -f.field :incoming_payment_mode, :name + -if @incoming_payment_mode.new_record? + -f.field :incoming_payment_mode, :cash_id, :choices=>{:reflection=>:cashes}, :new=>true + -else + -f.field IncomingPaymentMode.human_attribute_name(:cash), link_to(@incoming_payment_mode.cash.name, @incoming_payment_mode.cash), :field=>:label -f.field :incoming_payment_mode, :with_accounting, "data-show"=>"#accountancy" -#accountancy - =formalize do |f| - -f.title :accountancy - -f.field :incoming_payment_mode, :cash_id, :choices=>{:reflection=>:cashes}, :new=>true - -f.field :incoming_payment_mode, :with_deposit, "data-show"=>"#deposit" - -f.field :incoming_payment_mode, :with_commission, "data-show"=>"#commission" - - #deposit +-if @incoming_payment_mode.new_record? or (@incoming_payment_mode.cash and @incoming_payment_mode.cash.bank_account?) + #accountancy =formalize do |f| - -f.title :deposit - -f.field :incoming_payment_mode, :depositables_account_id, :choices=>{:reflection=>:payments_to_deposit_accounts}, :new=>{:number=>@current_company.preferred_financial_payments_to_deposit_accounts}, :resize=>true + -f.title :accountancy + -f.field :incoming_payment_mode, :with_deposit, "data-show"=>"#deposit" + -f.field :incoming_payment_mode, :with_commission, "data-show"=>"#commission" + + #deposit + =formalize do |f| + -f.title :deposit + -f.field :incoming_payment_mode, :depositables_account_id, :choices=>{:reflection=>:payments_to_deposit_accounts}, :new=>{:number=>@current_company.preferred_financial_payments_to_deposit_accounts}, :resize=>true + -f.field :incoming_payment_mode, :depositables_journal_id, :choices=>{:reflection=>:journals}, :new=>true, :resize=>true - #commission - =formalize do |f| - -f.title :commission - -f.field :incoming_payment_mode, :commission_base_amount - -f.field :incoming_payment_mode, :commission_percent - -f.field :incoming_payment_mode, :commission_account_id, :choices=>{:reflection=>:charges_accounts}, :new=>{:number=>@current_company.preferred_charges_accounts}, :resize=>true + #commission + =formalize do |f| + -f.title :commission + -f.field :incoming_payment_mode, :commission_base_amount + -f.field :incoming_payment_mode, :commission_percent + -f.field :incoming_payment_mode, :commission_account_id, :choices=>{:reflection=>:charges_accounts}, :new=>{:number=>@current_company.preferred_charges_accounts}, :resize=>true diff --git a/app/views/journal_entries/show.html.haml b/app/views/journal_entries/show.html.haml index c4e4024073..0d7815e1e8 100644 --- a/app/views/journal_entries/show.html.haml +++ b/app/views/journal_entries/show.html.haml @@ -9,8 +9,8 @@ -if @journal_entry.resource -l.attribute :resource, :url=>true -l.attribute :journal, :url=>true - -l.attribute :debit - -l.attribute :credit + -l.attribute :debit, :currency=>@journal_entry.financial_year.currency + -l.attribute :credit, :currency=>@journal_entry.financial_year.currency %h2=JournalEntry.human_attribute_name("lines") =list(:lines) diff --git a/app/views/sale_natures/_form.html.haml b/app/views/sale_natures/_form.html.haml index 366f96ebf1..300aa43330 100644 --- a/app/views/sale_natures/_form.html.haml +++ b/app/views/sale_natures/_form.html.haml @@ -1,17 +1,28 @@ -= formalize do |f| - - f.title :general - - f.field :sale_nature, :name - - f.field :sale_nature, :active - - f.field :sale_nature, :comment, :field=>:textarea - - f.title :incoming_payment_conditions - - f.field :sale_nature, :payment_mode_id, :choices=>{:reflection=>:incoming_payment_modes}, :new=>true - - f.field :sale_nature, :payment_mode_complement - - f.field :sale_nature, :expiration_id, :choices=>{:reflection=>:delays}, :new=>true - - f.field :sale_nature, :payment_delay_id, :choices=>{:reflection=>:delays}, :new=>true - - f.field :sale_nature, :downpayment - - f.field :sale_nature, :downpayment_minimum - - f.field :sale_nature, :downpayment_rate +=formalize do |f| + -f.title :general + -f.field :sale_nature, :name + -f.field :sale_nature, :active + -f.field :sale_nature, :currency, :choices=>currencies + -f.field :sale_nature, :downpayment, "data-show"=>"#downpayment" + -f.field :sale_nature, :with_accounting, "data-show"=>"#accountancy" + -f.field :sale_nature, :comment, :field=>:textarea + -f.title :incoming_payment_conditions + -f.field :sale_nature, :expiration_id, :choices=>{:reflection=>:delays}, :new=>true + -f.field :sale_nature, :payment_delay_id, :choices=>{:reflection=>:delays}, :new=>true + -f.field :sale_nature, :payment_mode_id, :choices=>{:reflection=>:incoming_payment_modes}, :new=>true + -f.field :sale_nature, :payment_mode_complement + +#downpayment + =formalize do |f| + -f.title :downpayment + -f.field :sale_nature, :downpayment_minimum + -f.field :sale_nature, :downpayment_rate + +#accountancy + =formalize do |f| + -f.title :accountancy + -f.field :sale_nature, :journal_id, :choices=>{:reflection=>:journals}, :new=>{:nature=>'sales'}, :resize=>true diff --git a/app/views/sale_natures/show.html.haml b/app/views/sale_natures/show.html.haml new file mode 100644 index 0000000000..012d7fa526 --- /dev/null +++ b/app/views/sale_natures/show.html.haml @@ -0,0 +1,16 @@ +=toolbar do |t| + -t.edit @sale_nature +=attributes_list(@sale_nature) do |l| + -l.attribute :name + -l.attribute :active + -l.attribute :currency + -l.attribute :expiration + -l.attribute :payment_delay + -l.attribute :downpayment + -if @sale_nature.downpayment? + -l.attribute :downpayment_minimum + -l.attribute :downpayment_rate + -l.attribute :with_accounting + -if @sale_nature.with_accounting? + -l.attribute :journal + -l.attribute :comment diff --git a/app/views/sales/_form.html.haml b/app/views/sales/_form.html.haml index 0bc099ae52..1c70038745 100644 --- a/app/views/sales/_form.html.haml +++ b/app/views/sales/_form.html.haml @@ -9,7 +9,6 @@ =formalize do |f| -f.title :sales_conditions -f.field :sale, :nature_id, :choices=>{:reflection=>:sale_natures}, :new=>true - -f.field :sale, :currency_id, :choices=>{:reflection=>:currencies} -f.field :sale, :responsible_id, :choices=>{:reflection=>:employees}, :new=>{:employed=>1} -f.field :sale, :transporter_id, :choices=>{:reflection=>:transporters, :include_blank=>""} -f.field :sale, :comment, :field=>:textarea diff --git a/app/views/sales/show.html.haml b/app/views/sales/show.html.haml index 1acdde6c77..7814a8b1f0 100644 --- a/app/views/sales/show.html.haml +++ b/app/views/sales/show.html.haml @@ -54,10 +54,10 @@ %table.list %tr.total %th=Sale.human_attribute_name(:pretax_amount) - %td=number_to_management(@sale.pretax_amount) + %td=number_to_money(@sale.pretax_amount, @sale.currency) %tr.important.total %th=Sale.human_attribute_name(:amount) - %td=number_to_management(@sale.amount) + %td=number_to_money(@sale.amount, @sale.currency) -if @sale.subscriptions.size>0 %h2=tl :x_subscriptions, :count=>@sale.subscriptions.size -if @sale.draft? @@ -95,5 +95,5 @@ -for k, v in @sale.stats(:with_balance=>true) %tr.total %th=tc(k) - %td=number_to_management(v) + %td=number_to_money(v, @sale.currency) diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 0766231abc..c0fd22e292 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -86,7 +86,6 @@ def self.valid_locales self.available_locales.select{|x| x.to_s.size == 3} end - def self.active_locales @@active_locales ||= self.valid_locales @@active_locales @@ -107,148 +106,125 @@ def self.locale_name(locale=nil) ::I18n.t("i18n.name") end + # Returns translation if found else nil def self.hardtranslate(*args) result = translate(*args) return (result.to_s.match(/(translation\ missing|\(\(\()/) ? nil : result) end -end - - -if Rails.version.match(/^2\.3/) - module ActiveRecord - class Errors - - # allow a proc as a user defined message - def add(attribute, message = nil, options = {}) - options[:message] = options.delete(:default) if options[:default].is_a?(Symbol) - error, message = message, nil if message.is_a?(Error) - raise ArgumentError.new("Symbol expected, #{message.inspect} received.") unless error or message.is_a?(Symbol) or options[:forced] - - @errors[attribute.to_s] ||= [] - @errors[attribute.to_s] << (error || Error.new(@base, attribute, message, options)) - end - - def add_to_base(msg, options = {}) - add(:base, msg, options) - end - - def add_from_record(record) - record.errors.each_error do |attribute, error| - @errors[attribute.to_s] ||= [] - @errors[attribute.to_s] << error + module Backend + module Base + + + def localize_with_numbers(locale, object, format = :default, options = {}) + options.symbolize_keys! + if object.respond_to?(:abs) + if currency = options[:currency] + return Numisma[currency].localize(object, :locale=>locale) + else + formatter = I18n.translate('number.format'.to_sym, :locale => locale, :default => {}) + if formatter.is_a?(Proc) + return formatter[object] + elsif formatter.is_a?(Hash) + formatter = {:format => "%n", :separator=>'.', :delimiter=>'', :precision=>3}.merge(formatter).merge(options) + format = formatter[:format] + negative_format = formatter[:negative_format] || "-" + format + + if object.to_f < 0 + format = negative_format + object = object.abs + end + + value = object.to_s.split(/\./) + integrals, decimals = value[0].to_s, value[1].to_s + decimals = decimals.gsub(/0+$/, '').ljust(formatter[:precision], '0').reverse.split(/(?=\d{3})/).reverse.collect{|x| x.reverse}.join(formatter[:delimiter]) + value = integrals.gsub(/^0+[1-9]+/, '').gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{formatter[:delimiter]}") + value += formatter[:separator] + decimals unless decimals.blank? + return format.gsub(/%n/, value).gsub(/%s/, "\u{00A0}").html_safe + end + end + elsif object.respond_to?(:strftime) + return localize_without_numbers(locale, object, format, options) + else + raise ArgumentError, "Object must be a Numeric, Date, DateTime or Time object. #{object.inspect} given." end end + alias_method_chain :localize, :numbers + + end + end - # Generate only full translated messages - def generate_message(attribute, message = :invalid, options = {}) - message, options[:default] = options[:default], message if options[:default].is_a?(Symbol) - - defaults = @base.class.self_and_descendants_from_active_record.map do |klass| - [ "models.#{klass.name.underscore}.attributes.#{attribute}.#{message}".to_sym, - "models.#{klass.name.underscore}.#{message}".to_sym ] - end - - defaults << options.delete(:default) - defaults = defaults.compact.flatten << "messages.#{message}".to_sym - - key = defaults.shift - value = @base.respond_to?(attribute) ? @base.send(attribute) : nil - - options = { :default => defaults, - :model => @base.class.human_name, - :attribute => @base.class.human_attribute_name(attribute.to_s), - :value => value, - :scope => [:activerecord, :errors] - }.merge(options) +end - I18n.translate(key, options) - end - def full_messages(options = {}) - full_messages = [] - - @errors.each_key do |attr| - @errors[attr].each do |message| - next unless message - full_messages << message - end - end - full_messages - end - end - end -else +module ActiveModel + class Errors - module ActiveModel - class Errors + # # allow a proc as a user defined message + # def add(attribute, message = nil, options = {}) + # message ||= :invalid + # raise options.inspect if options.frozen? + + # message = generate_message(attribute, message, options) # if message.is_a?(Symbol) + # self[attribute] ||= [] + # self[attribute] << message + # end + - # # allow a proc as a user defined message - # def add(attribute, message = nil, options = {}) - # message ||= :invalid - # raise options.inspect if options.frozen? + def add(attribute, message = nil, options = {}) + message ||= :invalid - # message = generate_message(attribute, message, options) # if message.is_a?(Symbol) - # self[attribute] ||= [] - # self[attribute] << message - # end + if message.is_a?(Symbol) + message = generate_message(attribute, message, options.except(*CALLBACKS_OPTIONS)) + elsif message.is_a?(Proc) + message = message.call + elsif !options.delete(:forced) + raise ArgumentError.new("Symbol or Proc expected, #{message.inspect} received.") + end + self[attribute] << message + end - def add(attribute, message = nil, options = {}) - message ||= :invalid - - if message.is_a?(Symbol) - message = generate_message(attribute, message, options.except(*CALLBACKS_OPTIONS)) - elsif message.is_a?(Proc) - message = message.call - elsif !options.delete(:forced) - raise ArgumentError.new("Symbol or Proc expected, #{message.inspect} received.") - end - - self[attribute] << message - end + def add_to_base(message, options = {}) + add(:id, message, options) + end - def add_to_base(message, options = {}) - add(:id, message, options) + def add_from_record(record) + record.errors.each do |attribute, message| + self[attribute] ||= [] + self[attribute] << message end + end - def add_from_record(record) - record.errors.each do |attribute, message| - self[attribute] ||= [] - self[attribute] << message - end + # Returns all the full error messages in an array. + # + # class Company + # validates_presence_of :name, :address, :email + # validates_length_of :name, :in => 5..30 + # end + # + # company = Company.create(:address => '123 First St.') + # company.errors.full_messages # => + # ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Address can't be blank"] + def full_messages(options = {}) + full_messages = [] + each do |attribute, messages| + messages = Array.wrap(messages) + full_messages += messages end + full_messages + end - # Returns all the full error messages in an array. - # - # class Company - # validates_presence_of :name, :address, :email - # validates_length_of :name, :in => 5..30 - # end - # - # company = Company.create(:address => '123 First St.') - # company.errors.full_messages # => - # ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Address can't be blank"] - def full_messages(options = {}) - full_messages = [] - each do |attribute, messages| - messages = Array.wrap(messages) - full_messages += messages - end - full_messages - end - - end end - end + ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| msg = instance.error_message error_class = 'invalid' diff --git a/config/locales/arb/action.yml b/config/locales/arb/action.yml index 60763b4b92..b1d65a3163 100644 --- a/config/locales/arb/action.yml +++ b/config/locales/arb/action.yml @@ -307,8 +307,8 @@ arb: production_chain_work_centers: # edit: 'Edit the work center: %{name}' # new: 'Add a new work center' - # play: 'Play work center: #{name}' - # show: 'Work center: #{name}' + # play: 'Play work center: %{name}' + # show: 'Work center: %{name}' production_chains: # edit: 'Edit production chain: %{name}' # index: 'Production chains' @@ -1276,6 +1276,7 @@ arb: # scheduled: 'Scheduled' search: 'البحث عن الشراء' # search_account: 'Search for accounts' + # search_for_available_prices: '%{code} - %{name}, %{pretax_amount}' search_go: 'بدء البحث' search_sales: 'البحث عن طلبات البيع' # second_contact: 'Second address' diff --git a/config/locales/arb/models.yml b/config/locales/arb/models.yml index e02aa17182..72f0e59fd8 100644 --- a/config/locales/arb/models.yml +++ b/config/locales/arb/models.yml @@ -529,6 +529,7 @@ arb: wrong_length: '%{attribute} الطول الخاطئ ( %{count} يجب ان يكون عدد الاحرف)' models: cash: + # currency_does_not_match: 'The currency of the %{journal} is different from that specified for the cash' unvalid_bban: '.مكون واحد أو اكثر من موجه قاعدة المعلومات غير صحيح' custom_field_datum: greater_than: '%{field} اكبر من (%{maximum} كحد اقصى)' @@ -694,7 +695,7 @@ arb: attributes: account: 'الحساب' account_balances: 'ارصدة الحسابات' - account_id: 'حساب' + account_id: 'حساب' #? account_number: 'رقم الحساب' accounted_at: 'تمت محاسبته يوم' accounts: 'الحسابات' @@ -712,7 +713,7 @@ arb: area_id: 'العنوان البريدي' #? area_measure: 'المساحة' area_unit: 'وحدة المساحة' - area_unit_id: 'وحدة مساحة' + area_unit_id: 'وحدة مساحة' #? areas: 'الرموز البريدية' arrived_on: 'وصل يوم' assimilated_taxes_amount: 'قيمة الضرائب المماثلة' @@ -745,14 +746,14 @@ arb: by_default: 'افتراضيا' cache: 'مخبأ' cash: 'الحسابات المصرفية المستخدمة' - cash_id: 'الحسابات المصرفية المستخدمة' + cash_id: 'الحسابات المصرفية المستخدمة' #? cash_journals: 'الدفاتر اليومية للصناديق النقدية' cashes: 'الحسابات المصرفية' cashes_accounts: 'حسابات الصندوق النقدي' catalog_description: 'مواصفات للدليل' catalog_name: 'اسم للدليل' category: 'الفئة' - category_id: 'الفئة' + category_id: 'الفئة' #? # ceded: 'Ceded' # ceded_on: 'Ceded on' changes_reflected: 'انعكاس التغييرات' @@ -771,7 +772,7 @@ arb: client_account: 'حساب مساعد العميل' client_account_id: 'حساب مساعد العميل' #? client_accounts: 'حسابات العملاء' - client_id: 'العميل' + client_id: 'العميل' #? clients: 'العملاء' closed: 'تم اغلاقه' closed_on: 'تاريخ الاغلاق' @@ -785,12 +786,12 @@ arb: comment: 'التعليق' commercial: 'نشاط تجاري' commission_account: 'حساب مستخدم للعمولة' - commission_account_id: 'الحساب المستخدم للعمولة' + commission_account_id: 'الحساب المستخدم للعمولة' #? commission_amount: 'القيمة الثابتة للعمولة' # commission_base_amount: 'Base amount of the commission' commission_percent: 'نسبة العمولة' company: 'الشركة' - company_id: 'شركة' + company_id: 'شركة' #? component: 'محتوى العبوة' component_id: 'محتوى العبوة' #? components: 'مكونات المنتج' @@ -803,7 +804,7 @@ arb: connected_at: 'سجل الدخول في' consumption: 'الاستهلاك' contact: 'العنوان' - contact_id: 'العنوان' + contact_id: 'العنوان' #? contacts: 'الاتصالات' counterpart: 'النسخة المطابقة' #? counterpart_id: 'النسخة المطالقة' #? @@ -811,7 +812,7 @@ arb: created_at: 'انشأت في' created_on: 'انشأ يوم' creator: 'المنتج' - creator_id: 'المنتج' + creator_id: 'المنتج' #? credit: 'الائتمان' credit_lines: 'اساليب الائتمانات' #? credited_quantity: 'كمية الائتمان ' @@ -826,7 +827,7 @@ arb: custom_field: 'حقول اضافية' custom_field_choices: 'اختيارات الحقول الاضافية' custom_field_data: 'تكملة بيانات الملف' - custom_field_id: 'حقول اضافية' + custom_field_id: 'حقول اضافية' #? custom_fields: 'الحقول الاضافية' data: 'بيانات اضافية' date_value: 'قيمة التاريخ' @@ -849,8 +850,8 @@ arb: deliveries_conditions: 'شروط التسليم' delivery: 'التسليم' delivery_contact: 'عنوان للتسليم' - delivery_contact_id: 'عنوان للتسليم' - delivery_id: 'تسليم' + delivery_contact_id: 'عنوان للتسليم' #? + delivery_id: 'تسليم' #? delivery_lines: 'طرق التسليم' delivery_modes: 'اسلوب التسليم' #? density_label: 'الكثافة' @@ -859,7 +860,7 @@ arb: department_id: 'مبنى' #? departments: 'الخدمات' deposit: 'الاقتطاع المصرفي' - deposit_id: 'اقتطاع مرفي' + deposit_id: 'اقتطاع مرفي' #? depositable_payments: 'تسديد الدفعات نقدا' depositables_account: 'حساب معلق للدفعات النقدية' depositables_account_id: 'الحساب المعلق اادفعات النقدية' #? @@ -896,6 +897,7 @@ arb: ean13: 'Ean13' email: 'عنوان البريد الالكتروني' # emitter_amount: 'Emitted amount' + # emitter_cash: 'Emitter cash' # emitter_currency: 'Emitter currency' # emitter_currency_rate: 'Emitted currency rate' employed: 'وظف من قبل الشركة' @@ -908,7 +910,7 @@ arb: entity_2: 'الملف الثاني' entity_2_id: 'الملف الثاني' #? entity_categories: 'فئة الفرد' - entity_id: 'الفرد' + entity_id: 'الفرد' #? entity_link_nature: 'نوع رابط تمديد الاشتراك' entity_link_nature_id: 'نوع الرابط لتمديد الاشتراك' #? entity_link_natures: 'طبيعة الرابط بين الافراد' @@ -919,17 +921,17 @@ arb: entry: 'سجل المحاسبة' entry_id: 'سجا المحاسبة' #? establishment: 'المؤسسة' - establishment_id: 'مؤسسة' + establishment_id: 'مؤسسة' #? establishments: 'المؤسسات' event_natures: 'نوع الحدث' events: 'الاحداث' # examinated_at: 'Examinated at' excise: 'عدد رسوم الدفع' expense: 'التكلفة' - expense_id: 'انفاق' + expense_id: 'انفاق' #? expense_type: 'نوع التكلفة' expiration: 'تأخير المهلة' - expiration_id: 'تأخير مهلة' + expiration_id: 'تأخير مهلة' #? expired_on: 'انتهى يوم' exportable: 'قبل للتصدير' expression: 'اسلوب للتعبير' @@ -940,7 +942,7 @@ arb: filename: 'الملف' filesize: 'حجم الملف' financial_year: 'السنوات المالية' - financial_year_id: 'مهنة' + financial_year_id: 'مهنة' #? financial_years: 'المهن' finish: 'النهاية' first_met_on: 'تاريخ اول مقابلة' @@ -977,6 +979,7 @@ arb: incoming_payments: 'الدفعات' indirect_links: 'روابط مباشرة' # initial_number: 'Initial number' + # input_conveyors: 'Input conveyors' integer_value: 'قيمة العدد الصحيح' introduction: 'المقدمة' inventories: 'عمليات الجرد' @@ -999,9 +1002,9 @@ arb: journal: 'الدفتر اليومي' journal_entries: 'سجلات المحاسبة' journal_entry: 'سجل المحاسبة' - journal_entry_id: 'سجل المحاسبة' + journal_entry_id: 'سجل المحاسبة' #? journal_entry_lines: 'المدخلات' - journal_id: 'الدفتر اليومي' + journal_id: 'الدفتر اليومي' #? journals: 'الدفاتر اليومية' key: 'المفتاح' label: 'الملصق' @@ -1049,14 +1052,14 @@ arb: min_duration: '(دقيقة (دقائق' mobile: 'الهاتف النقال' mode: 'نمط الدفعة' - mode_id: 'طريقة تسديد دفعة' + mode_id: 'طريقة تسديد دفعة' #? moved_on: 'انجز يوم' name: 'الاسم' name_1_to_2: 'الملف الاول الى الثاني' name_2_to_1: 'الملف الثاني الى الاول' nature: 'طبيعة' nature_code: 'الرمز' - nature_id: 'نوع' + nature_id: 'نوع' #? nature_label: 'طبيعة الملصق' # net_weight: 'Net weight (kg)' nic: 'واجهة بطاقة الشبكة' @@ -1071,7 +1074,7 @@ arb: office: 'المكتب/الاستديو' old_password: 'كلمة المرور الحالية' operation: 'العمل' - operation_id: 'عمل' + operation_id: 'عمل' #? operation_lines: 'الواردات/الصادرات' operation_natures: 'انواع العمل' operation_uses: 'استخدامات الاداة' @@ -1082,13 +1085,15 @@ arb: order_line_id: 'طريقة البيع' #? organization: 'المنظمة' origin: 'المنشأ' - origin_id: 'المنشأ' + origin_id: 'المنشأ' #? origin_type: 'نوع المنشأ' original_credit: 'الائتمان' # original_currency: 'Original currency' # original_currency_rate: 'Original currency rate' original_debit: 'الدين المطلوب' original_name: 'الاسم الاصلي' + # outgoing_deliveries: 'Outgoing deliveries' + # outgoing_delivery_lines: 'Outgoing delivery lines' outgoing_payment_modes: 'اساليب المصروفات' outgoing_payment_uses: 'ازاء المصروفات' outgoing_payments: 'المصروفات' @@ -1101,7 +1106,7 @@ arb: paid_amount: 'خصمة من قيمة الضريبة الاضافية' paid_on: 'سددت يوم' parent: 'النسب' - parent_id: 'نسب' + parent_id: 'نسب' #? parts: 'الاجزاء' #? parts_amount: 'القيمة المستخدمة' #? password: 'كلمة المرور' @@ -1112,11 +1117,11 @@ arb: payer_id: 'دافع القيمة' #? payment: 'الدفعة' payment_delay: 'تأجيل الدفعة' - payment_delay_id: 'تأجيل دفعة' - payment_id: 'دفعة' + payment_delay_id: 'تأجيل دفعة' #? + payment_id: 'دفعة' #? payment_mode: 'اسلوب تسديد الدفعة' payment_mode_complement: 'معلومات اضافية عن نمط الدفعة' - payment_mode_id: 'نمط دفعة' + payment_mode_id: 'نمط دفعة' #? payment_modes: 'طريقة تسديد الدفعة' #? payment_on: 'تسدد في مدة لا تتجاوز' payment_uses: 'اجزاء الدفعات' @@ -1138,7 +1143,7 @@ arb: # pretax_amount: 'Pre-tax amount' price: 'سعر الكلفة' price_amount: 'القيمة دون الضرائب' - price_id: 'سعر الوحدة' + price_id: 'سعر الوحدة' #? prices: 'الاسعار' printed_at: 'طبعت في' printed_on: 'طبع يوم' @@ -1149,9 +1154,9 @@ arb: product_category: 'الفئة' #? product_category_id: 'فئة' #? product_components: 'مكونات المنتج' - product_id: 'المنتج' + product_id: 'المنتج' #? productable_products: 'المنتجات الممكن انتاجها' - # production_chain_id: 'Production chain' + # production_chain: 'Production chain' products: 'المنتجات' products_accounts: 'حسابات المنتجات' profession: 'المهنة' @@ -1162,8 +1167,8 @@ arb: proposer_id: 'الكفيل' #? prospect: 'الراعي' published: 'تم نشره' + # purchase: 'Purchase' # purchase_amount: 'Purchase amount' - # purchase_id: 'Purchase' # purchase_line: 'Purchase line' purchase_lines: 'طرق طلب الشراء' # purchased_on: 'Purchased on' @@ -1180,8 +1185,10 @@ arb: receipt: 'استلام الكتروني' received: 'مستلم' # receiver_amount: 'Received amount' + # receiver_cash: 'Receiver cash' # receiver_currency: 'Receiver currency' # receiver_currency_rate: 'Received currency rate' + # receiver_journal_entry: 'Receiver journal entry' # reconcilable: 'Reconcilable' record_value: 'التسجيل' record_value_id: 'تسجيل' #? @@ -1196,6 +1203,7 @@ arb: reductions: 'طرق الخصومات' # reference_number: 'Reference number' reflation_submissive: 'خاضع لانعاش اقتصادي' + # reflections: 'Reflections' # relative_humidity: 'Relative humidity' remaining_duration: '(مدة الاستخدام المتبقي (ساعات ' required: 'الزامي' @@ -1204,7 +1212,7 @@ arb: resource_id: 'المصدر الاصلي' #? resource_type: 'نوع المصدر' responsible: 'المسؤول' - responsible_id: 'المسؤول' + responsible_id: 'المسؤول' #? rights: 'الحقوق' role: 'الدور الاساسي' role_id: 'الدور الاساسي' #? @@ -1213,8 +1221,9 @@ arb: root_model: 'الجذر' root_model_name: 'جذر' sale: 'طلب البيع' - sale_id: 'طلب بيع' - sale_line_id: 'طرق طلب البيع' + sale_id: 'طلب بيع' #? + # sale_line: 'Sale line' + sale_line_id: 'طرق طلب البيع' #? sale_lines: 'طرق طلب البيع' sale_natures: 'انواع البيع' sales: 'المبيعات' @@ -1255,7 +1264,7 @@ arb: state_label: 'حالة النص' stock: 'انتاج السهم' stock_id: 'انتاج سهم' #? - # stock_move_id: 'Stock move' + # stock_move: 'Stock move' stock_moves: 'حركات الاسهم' stock_transfers: 'تحويل او ضياع السهم' stockable: 'ادارة الاسهم' @@ -1280,19 +1289,19 @@ arb: supplier_account: 'حساب مساعد الممول' supplier_account_id: 'حساب مساعد الممول' #? supplier_accounts: 'حسابات المموليين' - supplier_id: 'ممول' + supplier_id: 'ممول' #? suppliers: 'الممولين' surface_units: 'وحدات المظهر الخارجي' suspended: 'معطل' symbol: 'نموذج' #? symmetric: 'متساو' target: 'الهدف' - target_id: 'الهدف' + target_id: 'الهدف' #? # target_quantity: 'Target quantity' target_type: 'نوع الهدف' tax: 'الضريبة' tax_declarations: 'الاعلان عن الضرائب' - tax_id: 'الضريبة' + tax_id: 'الضريبة' #? taxes: 'الضرائب' # temperature: 'Temperature' template: 'نموذج' @@ -1304,14 +1313,15 @@ arb: to: 'ل' to_archive: 'وثائق للارشفة' to_bank_on: 'يسدد يوم' + # to_deposit: 'To deposit' tool: 'الاداة' - tool_id: 'اداة' + tool_id: 'اداة' #? tools: 'الادوات' tools_list: 'معدات' # total_weight: 'Total weight (kg)' # trackable: 'Trackable' tracking: 'الحصة' - tracking_id: 'الحصة' + tracking_id: 'الحصة' #? tracking_serial: 'رقم الحصة' trackings: 'الحصص' transfers: 'التحويلات' @@ -1319,20 +1329,20 @@ arb: transport_id: 'وسيلة النقل' #? transport_on: 'نقل يوم' transporter: 'الناقلة' - transporter_id: 'ناقل' + transporter_id: 'ناقل' #? transporters: 'ناقلات الشحن' transports: 'وسائل النقل' type: 'النوع' #? undelivered_quantity: 'يبقى للتسليم' # unique_tracking: 'Unique tracking' unit: 'الوحدة' - unit_id: 'وحدة' + unit_id: 'وحدة' #? unit_quantity: 'وحدة مساحة الكمية' units: 'الوحدات' unquantifiable: 'غير قابل للقياس' updated_at: 'تم تحديثه في' updater: 'التحديث' - updater_id: 'التحديث' + updater_id: 'التحديث' #? usable_incoming_payments: 'دفعات ممكن استخدامها' usable_outgoing_payments: 'مصروفات ممكن استخدامها' usage: 'الاستخدام' @@ -1350,7 +1360,7 @@ arb: virtual: 'عملي' virtual_quantity: 'الاسهم العملية' warehouse: 'موقع التخزين' - warehouse_id: 'موقع التخزين' + warehouse_id: 'موقع التخزين' #? warehouses: 'مواقع التخزين' webpass: 'كلمة مرور الموقع الااكتروني' website: 'الموقع الالكتروني' diff --git a/config/locales/arb/rights.yml b/config/locales/arb/rights.yml index f40011fc5d..b126397e34 100644 --- a/config/locales/arb/rights.yml +++ b/config/locales/arb/rights.yml @@ -25,6 +25,7 @@ arb: mail_to_listings: 'ادارة ارسال رسائل البريد الالكتروني بواسطة الاستخراج' manage_accounts: 'ادارة الحسابات' manage_areas: 'ادارة المناطق' + # manage_assets: 'Manage assets' manage_bank_statements: 'كشوفات البيانات الحسابية' # manage_cash_transfers: 'Manage cash transfers' manage_cashes: 'ادارة حسابات الخزينة' diff --git a/config/locales/eng/action.yml b/config/locales/eng/action.yml index 276996a6be..5f4be0081b 100644 --- a/config/locales/eng/action.yml +++ b/config/locales/eng/action.yml @@ -303,6 +303,7 @@ eng: edit: 'Edit the sale type: %{name}' index: 'Sale types' new: 'Add a new type of sale' + show: 'Sale type: %{name}' sales: abort: 'Abort sale' cancel: 'Cancel sales invoice %{number}' @@ -1014,6 +1015,7 @@ eng: scheduled: 'Scheduled' search: 'Search' search_account: 'Search for accounts' + search_for_available_prices: '%{code} - %{name}, %{pretax_amount}' search_go: 'Search!' search_sales: 'Search sales' second_contact: 'Second address' diff --git a/config/locales/eng/models.yml b/config/locales/eng/models.yml index 7b6472fb42..0628b61364 100644 --- a/config/locales/eng/models.yml +++ b/config/locales/eng/models.yml @@ -141,6 +141,7 @@ eng: wrong_length: '%{attribute} is the wrong length (should be %{count} characters)' models: cash: + currency_does_not_match: 'The currency of the %{journal} is different from that specified for the cash' unvalid_bban: 'Unvalid BBAN. One or more elements are incorrect.' custom_field_datum: greater_than: '%{field} is greater than %{maximum}' @@ -295,16 +296,15 @@ eng: user: 'User' warehouse: 'Warehouse' attributes: - # _activation: ' activation' account: 'Account' account_balances: 'Account balances' - account_id: 'Account' account_number: 'Account number' # accountable: 'Accountable' accounted_at: 'Accounted at' accounts: 'Accounts' acquisition_amount: 'Acquisition amount' active: 'Active' + # active_prices: 'Active prices' activity_code: 'Activity code' actual_number: 'Actual number' address: 'Address' @@ -315,18 +315,22 @@ eng: area: 'Area' area_measure: 'Area measure' area_unit: 'Area unit' - area_unit_id: 'Area unit' areas: 'Areas' arrived_on: 'Arrived on' + # asset: 'Asset' + # asset_depreciations: 'Asset depreciations' + # assets: 'Assets' assimilated_taxes_amount: 'Assimilated taxes amount' atmospheric_pressure: 'Atmospheric pressure' attorney: 'Attorney' attorney_account: 'Attorney account' attorney_accounts: 'Attorney accounts' + # attorneys: 'Attorneys' attribute_name: 'Attribute name' authorized_payments_count: 'Authorized payments count' available_prices: 'Available prices' available_products: 'Available products' + # available_stocks: 'Available stocks' balance: 'Balance' balance_amount: 'Balance amount' balances: 'Balances' @@ -343,24 +347,27 @@ eng: boolean_value: 'Boolean value' born_on: 'Born on' building: 'Building' + # buildings: 'Buildings' by_default: 'By default' cache: 'Cache' cash: 'Cash' - cash_id: 'Cash' cash_journals: 'Cash journals' + # cash_transfers: 'Cash transfers' cashes: 'Bank accounts' cashes_accounts: 'Cashes accounts' catalog_description: 'Catalog description' catalog_name: 'Catalog name' category: 'Category' - category_id: 'Category' ceded: 'Ceded' ceded_on: 'Ceded on' changes_reflected: 'Changes reflected' charges_accounts: 'Charges accounts' check_number: 'Check number' check_state: 'Check state' + # child_kinships: 'Child kinships' + # child_land_parcel: 'Child land parcel' children: 'Children' + # choice_custom_fields: 'Choice custom fields' choice_value: 'Choice value' choices: 'Choices' choices_count: 'Choices count' @@ -369,7 +376,6 @@ eng: client: 'Client' client_account: 'Client account' client_accounts: 'Client accounts' - client_id: 'Client' clients: 'Clients' closed: 'Closed' closed_on: 'Closed on' @@ -378,16 +384,17 @@ eng: coefficient: 'Coefficient' collected_account: 'Account collected' collected_amount: 'Collected amount' + # collected_taxes: 'Collected taxes' color: 'Color' + # columns: 'Columns' comment: 'Comment' commercial: 'Commercial' commission_account: 'Commission account' - commission_account_id: 'Commission account' commission_amount: 'Commission amount' commission_base_amount: 'Base amount of the commission' commission_percent: 'Commission percent' + # commissioned_incoming_payment_modes: 'Commissioned incoming payment modes' company: 'Company' - company_id: 'Company' component: 'Component' components: 'Components' compute: 'Compute' @@ -399,25 +406,26 @@ eng: connected_at: 'Connected at' consumption: 'Consumption' contact: 'Contact' - contact_id: 'Contact' contacts: 'Contacts' + # conveyors: 'Conveyors' country: 'Country' created_at: 'Created at' created_on: 'Created on' creator: 'Creator' - creator_id: 'Creator' credit: 'Credit' credited_quantity: 'Credited quantity' credits: 'Credits' critic_quantity_min: 'Critic quantity min' + # critic_stocks: 'Critic stocks' crypt_key: 'Crypt key' crypt_mode: 'Crypt mode' currency: 'Currency' + # currency_precision: 'Currency precision' + # currency_rate: 'Currency rate' current_financial_year: 'Current financial year' custom_field: 'Custom field' custom_field_choices: 'Custom field choices' custom_field_data: 'Custom field data' - custom_field_id: 'Custom field' custom_fields: 'Custom fields' data: 'Data' date_value: 'Date value' @@ -430,6 +438,7 @@ eng: declared_on: 'Declared on' default_contact: 'Default contact' default_currency: 'Default currency' + # default_stock: 'Default stock' deferred_payment: 'Deferred payment' delays: 'Delays' deleted_at: 'Deleted at' @@ -439,22 +448,22 @@ eng: deliveries_conditions: 'Deliveries conditions' delivery: 'Delivery' delivery_contact: 'Delivery contact' - delivery_contact_id: 'Delivery contact' - delivery_id: 'Delivery' delivery_lines: 'Delivery lines' density_label: 'Density label' departed_on: 'Departed on' department: 'Department' departments: 'Departments' deposit: 'Deposit' - deposit_id: 'Deposit' depositable_payments: 'Embankable payments' depositables_account: 'Embankables account' + # depositables_incoming_payment_modes: 'Depositables incoming payment modes' + # depositables_journal: 'Depositables journal' deposits: 'Deposits' deprecated_amount: 'Deprecated amount' depreciable_amount: 'Depreciable amount' depreciation: 'Depreciation' depreciation_method: 'Depreciation method' + # depreciations: 'Depreciations' description: 'Description' diff_less: 'Diff less' diff_more: 'Diff more' @@ -475,17 +484,18 @@ eng: ean13: 'Ean13' email: 'Email' emitter_amount: 'Emitted amount' - emitter_currency: 'Emitter currency' - emitter_currency_rate: 'Emitted currency rate' + emitter_cash: 'Emitter cash' + emitter_currency: 'Emitter currency' #? + emitter_currency_rate: 'Emitted currency rate' #? + # emitter_journal_entry: 'Emitter journal entry' employed: 'Employed' employees: 'Employees' employment: 'Employment' entities: 'People' - entity: 'Person' + entity: 'Entity' entity_1: 'Person 1' entity_2: 'Person 2' entity_categories: 'Person categories' - entity_id: 'Entity' entity_link_nature: 'Person link type' entity_link_natures: 'Person link types' entity_links: 'Person links' @@ -493,20 +503,20 @@ eng: entity_natures: 'Person types' entries: 'Entries' entry: 'Entry' + # entry_lines: 'Entry lines' establishment: 'Establishment' - establishment_id: 'Establishment' establishments: 'Establishments' event_natures: 'Event types' events: 'Events' examinated_at: 'Examinated at' excise: 'Excise' expense: 'Expense' - expense_id: 'Expense' expense_type: 'Expense type' + # expenses: 'Expenses' expiration: 'Expiration' - expiration_id: 'Expiration' expired_on: 'Expired on' exportable: 'Exportable' + # exportable_columns: 'Exportable columns' expression: 'Expression' extension: 'Extension' family: 'Family' @@ -514,8 +524,8 @@ eng: fax: 'Fax' filename: 'Filename' filesize: 'Filesize' + # filtered_columns: 'Filtered columns' financial_year: 'Financial year' - financial_year_id: 'Financial year' financial_years: 'Financial years' finish: 'Finish' first_met_on: 'First met on' @@ -535,21 +545,28 @@ eng: global_count: 'Global count' global_credit: 'Global credit' global_debit: 'Global debit' + # godchildren: 'Godchildren' + # group: 'Group' has_downpayment: 'Has downpayment' hashed_password: 'Hashed password' hour_duration: 'Hour duration' iban: 'IBAN' iban_label: 'IBAN' id: 'ID' + # immobilizations_products: 'Immobilizations products' importance: 'Importance' in_cash: 'In cash' in_name: 'In name' included: 'Included' + # incoming_deliveries: 'Incoming deliveries' + # incoming_delivery_lines: 'Incoming delivery lines' + # incoming_delivery_modes: 'Incoming delivery modes' incoming_payment_modes: 'Incoming payment modes' incoming_payment_uses: 'Incoming payment parts' incoming_payments: 'Incoming payments' indirect_links: 'Indirect links' initial_number: 'Initial number' + input_conveyors: 'Input conveyors' integer_value: 'Integer value' introduction: 'Introduction' inventories: 'Inventories' @@ -567,12 +584,12 @@ eng: journal: 'Journal' journal_entries: 'Journal entries' journal_entry: 'Journal entry' - journal_entry_id: 'Journal entry' journal_entry_lines: 'Journal entry lines' - journal_id: 'Journal' journals: 'Journals' key: 'Key' label: 'Label' + # land_parcel_groups: 'Land parcel groups' + # land_parcel_kinships: 'Land parcel kinships' land_parcels: 'Land parcels' language: 'Language' last_bank_statement: 'Last bank statement' @@ -609,19 +626,19 @@ eng: lost: 'Lost' luminance: 'Luminance' mail: 'Mail' + # mail_columns: 'Mail columns' major_accounts: 'Major accounts' mandates: 'Mandates' min_duration: 'Min duration' mobile: 'Mobile' mode: 'Mode' - mode_id: 'Mode' moved_on: 'Moved on' + # moves: 'Moves' name: 'Name' name_1_to_2: 'Name 1 to 2' name_2_to_1: 'Name 2 to 1' - nature: 'Type' + nature: 'Nature' nature_code: 'Type code' - nature_id: 'Nature' nature_label: 'Type label' net_weight: 'Net weight (kg)' nic: 'Nic' @@ -635,41 +652,43 @@ eng: office: 'Office' old_password: 'Old password' operation: 'Operation' - operation_id: 'Operation' operation_lines: 'Operation lines' + # operation_nature: 'Operation nature' operation_natures: 'Operation types' operation_uses: 'Tool uses' operations: 'Operations' organization: 'Organization' origin: 'Origin' - origin_id: 'Origin' origin_type: 'Origin type' original_credit: 'Original credit' original_currency: 'Original currency' original_currency_rate: 'Original currency rate' original_debit: 'Original debit' original_name: 'Original name' + outgoing_deliveries: 'Outgoing deliveries' + outgoing_delivery_lines: 'Outgoing delivery lines' + # outgoing_delivery_modes: 'Outgoing delivery modes' outgoing_payment_modes: 'Disbursement modes' outgoing_payment_uses: 'Disbursement parts' outgoing_payments: 'Disbursements' + # output_conveyors: 'Output conveyors' owner: 'Owner' owner_type: 'Owner type' paid_account: 'Account paid' paid_amount: 'Paid amount' paid_on: 'Paid on' + # paid_taxes: 'Paid taxes' parent: 'Parent' - parent_id: 'Parent' + # parent_kinships: 'Parent kinships' + # parent_land_parcel: 'Parent land parcel' password: 'Password' password_confirmation: 'Confirmation of password' payee: 'Payee' payer: 'Payer' payment: 'Payment' payment_delay: 'Payment delay' - payment_delay_id: 'Payment delay' - payment_id: 'Payment' payment_mode: 'Payment mode' payment_mode_complement: 'Payment mode complement' - payment_mode_id: 'Payment mode' payment_on: 'Payment on' payment_uses: 'Payment parts' payment_way: 'Payment way' @@ -689,7 +708,6 @@ eng: pretax_amount: 'Pre-tax amount' price: 'Price' price_amount: 'Price amount' - price_id: 'Price' prices: 'Prices' printed_at: 'Printed at' printed_on: 'Printed on' @@ -697,9 +715,13 @@ eng: product: 'Product' product_categories: 'Product categories' product_components: 'Product components' - product_id: 'Product' productable_products: 'Productable products' - production_chain_id: 'Production chain' + production_chain: 'Production chain' + # production_chain_work_center: 'Production chain work center' + # production_chain_work_center_lines: 'Production chain work center lines' + # production_chain_work_center_uses: 'Production chain work center uses' + # production_chain_work_centers: 'Production chain work centers' + # production_chains: 'Production chains' products: 'Products' products_accounts: 'Products accounts' profession: 'Profession' @@ -708,13 +730,15 @@ eng: proposer: 'Proposer' prospect: 'Prospect' published: 'Published' + purchase: 'Purchase' purchase_amount: 'Purchase amount' - purchase_id: 'Purchase' + # purchase_invoices: 'Purchase invoices' purchase_line: 'Purchase line' purchase_lines: 'Purchase order lines' purchased_on: 'Purchased on' purchases: 'Purchase orders' purchases_account: 'Purchases account' + # purchases_products: 'Purchases products' quantity: 'Quantity' quantity_max: 'Quantity max' quantity_min: 'Quantity min' @@ -724,8 +748,10 @@ eng: receipt: 'Receipt' received: 'Received' receiver_amount: 'Received amount' - receiver_currency: 'Receiver currency' - receiver_currency_rate: 'Received currency rate' + receiver_cash: 'Receiver cash' + receiver_currency: 'Receiver currency' #? + receiver_currency_rate: 'Received currency rate' #? + receiver_journal_entry: 'Receiver journal entry' reconcilable: 'Reconcilable' record_value: 'Record value' record_value_type: 'Record value type' @@ -738,6 +764,7 @@ eng: reductions: 'Reductions' reference_number: 'Reference number' reflation_submissive: 'Reflation submissive' + reflections: 'Reflections' relative_humidity: 'Relative humidity' remaining_duration: 'Remaining duration' required: 'Required' @@ -745,24 +772,24 @@ eng: resource: 'Resource' resource_type: 'Resource type' responsible: 'Responsible' - responsible_id: 'Responsible' rights: 'Rights' role: 'Role' roles: 'Roles' rome: 'Rome' root_model: 'Root model' root_model_name: 'Root model name' - sale: 'sale' - sale_id: 'Sale' - sale_line_id: 'Sale line' + sale: 'Sale' + sale_line: 'Sale line' sale_lines: 'sale lines' sale_natures: 'sale types' sales: 'sales' sales_account: 'Sales account' sales_conditions: 'Sales conditions' sales_invoices: 'Sales invoices' + # sales_products: 'Sales products' salt: 'Salt' scheduled: 'Scheduled' + # second_stock_move: 'Second stock move' second_warehouse: 'Second warehouse' self_bank_accounts: 'Self bank accounts' self_cashes: 'Self cashes' @@ -784,7 +811,7 @@ eng: state: 'State' state_label: 'State' stock: 'Stock' - stock_move_id: 'Stock move' + stock_move: 'Stock move' stock_moves: 'Stock moves' stock_transfers: 'Stock transfers' stockable: 'Manage stocks' @@ -807,18 +834,15 @@ eng: supplier: 'Supplier' supplier_account: 'Supplier account' supplier_accounts: 'Supplier accounts' - supplier_id: 'Supplier' suppliers: 'Suppliers' surface_units: 'Surface units' suspended: 'Suspended' symmetric: 'Symmetric' target: 'Target' - target_id: 'Target' target_quantity: 'Target quantity' target_type: 'Target type' tax: 'Tax' tax_declarations: 'Tax declarations' - tax_id: 'Tax' taxes: 'Taxes' temperature: 'Temperature' template: 'Template' @@ -829,39 +853,45 @@ eng: to: 'To' to_archive: 'To archive' to_bank_on: 'To bank on' + to_deposit: 'To deposit' #? tool: 'Tool' - tool_id: 'Tool' tools: 'Tools' tools_list: 'Tools list' total_weight: 'Total weight (kg)' trackable: 'Trackable' tracking: 'Tracking' - tracking_id: 'Tracking' tracking_serial: 'Tracking serial' trackings: 'Trackings' transfers: 'Transfers' transport: 'Transport' transport_on: 'Transport on' transporter: 'Transporter' - transporter_id: 'Transporter' + # transporter_sales: 'Transporter sales' transporters: 'Transporters' transports: 'Transports' + # unconfirmed_stock_transfers: 'Unconfirmed stock transfers' + # undelivered_incoming_deliveries: 'Undelivered incoming deliveries' + # undelivered_outgoing_deliveries: 'Undelivered outgoing deliveries' undelivered_quantity: 'Undelivered quantity' unique_tracking: 'Unique tracking' unit: 'Unit' - unit_id: 'Unit' unit_quantity: 'Unit quantity' units: 'Units' + # unlocked_payments: 'Unlocked payments' + # unpaid_responsibles: 'Unpaid responsibles' + # unpaid_sales: 'Unpaid sales' unquantifiable: 'Unquantifiable' + # untransportered_deliveries: 'Untransportered deliveries' + # unused_conveyors: 'Unused conveyors' updated_at: 'Updated at' updater: 'Updater' - updater_id: 'Updater' usable_incoming_payments: 'Usable incoming payments' usable_outgoing_payments: 'Usable disbursements' usage: 'Usage' usage_duration: 'Usage duration' use_range: 'Use range' used_amount: 'Used amount' + # useful_lines: 'Useful lines' user: 'User' users: 'Users' uses: 'Uses' @@ -870,8 +900,9 @@ eng: vat_submissive: 'Vat submissive' virtual: 'Virtual' virtual_quantity: 'Virtual quantity' + # waiting_deliveries: 'Waiting deliveries' + # waiting_transporters: 'Waiting transporters' warehouse: 'Warehouse' - warehouse_id: 'Warehouse' warehouses: 'Warehouses' webpass: 'Webpass' website: 'Website' @@ -881,6 +912,7 @@ eng: with_deposit: 'With deposit' with_tracking: 'With tracking' with_transport: 'With transport' + # work_center: 'Work center' models: account: label: '%{number} - %{name}' diff --git a/config/locales/eng/rights.yml b/config/locales/eng/rights.yml index 41d21e2e1a..36ad7389d2 100644 --- a/config/locales/eng/rights.yml +++ b/config/locales/eng/rights.yml @@ -59,9 +59,9 @@ eng: manage_prices: 'Manage prices' manage_product_categories: 'Manage product categories' manage_products: 'Manage products' - manage_purchases: 'Manage purchase orders' - manage_sale_natures: 'Mange sale orders natures' - manage_sales: 'Manages sale orders' + manage_purchases: 'Manage purchases' + manage_sale_natures: 'Manage sales natures' + manage_sales: 'Manages sales' manage_stock_moves: 'Manage stock moves' manage_subscriptions: 'Manage subscriptions' manage_taxes: 'Manage taxes' diff --git a/config/locales/fra/action.yml b/config/locales/fra/action.yml index 187f8bb484..ce4036b5a7 100644 --- a/config/locales/fra/action.yml +++ b/config/locales/fra/action.yml @@ -347,6 +347,7 @@ fra: edit: 'Modifier le type de vente : %{name}' index: 'Types de ventes' new: 'Ajout d''un type de vente' + show: 'Type de vente : %{name}' sales: abort: 'Annuler la vente' cancel: 'Passage en avoir de la facture %{number}' @@ -1215,6 +1216,7 @@ fra: scheduled: 'Échéance' search: 'Rechercher' search_account: 'Rechercher un compte' + search_for_available_prices: '%{code} - %{name}%s: %{pretax_amount}/%{amount} (HT/TTC)' search_go: 'Lancer la recherche' search_sales: 'Rechercher des ventes' second_contact: 'Adresse secondaire' diff --git a/config/locales/fra/models.yml b/config/locales/fra/models.yml index ac71cfed21..91b286efb1 100644 --- a/config/locales/fra/models.yml +++ b/config/locales/fra/models.yml @@ -18,7 +18,6 @@ fra: duration: 'Durée (en minutes)' location: 'Lieu' responsible: 'Intervenant' - responsible_id: 'Intervenant' #? event_nature: duration: 'Durée par défaut (en min.)' financial_year: @@ -30,7 +29,6 @@ fra: incoming_payment_use: amount: 'Montant attribué à la vente' payment: 'Encaissement' - payment_id: 'Encaissement' #? payment_way: 'Mode d''encaissement' inventory_line: quantity: 'Quantité constatée' @@ -55,9 +53,7 @@ fra: amount: 'Montant' price: category: 'Catégorie de fiche associée' - category_id: 'Catégorie de fiche associée' #? entity: 'Fournisseur' - entity_id: 'Fournisseur' #? product: duration: 'Nombre de numéros OU période d''abonnement' price: 'Prix de revient' @@ -74,10 +70,8 @@ fra: planned_on: 'Réception prévue le' purchase_line: order: 'Achat' - order_id: 'Achat' #? sale: contact: 'Adresse pour le devis' - contact_id: 'Adresse pour le devis' #? has_downpayment: 'Acompte à verser' lines: 'Lignes de vente' parts_amount: 'Montant payé' #? @@ -85,16 +79,14 @@ fra: sale_line: label: 'Produit' price: 'Produit tarifé' - price_id: 'Produit tarifé' #? sale_nature: downpayment: 'Avec acompte' sales_invoice: #? credit: 'Avoir' #? lines: 'Lignes de facture' #? origin: 'Facture d''origine' #? - origin_id: 'Facture d''origine' #? sales_invoice_line: #? - origin_id: 'Ligne d''origine' #? + origin: 'Ligne d''origine' #? stock: quantity: 'Stock réel' stock_move: @@ -102,10 +94,8 @@ fra: stock_transfer: second_warehouse: 'Lieu de stockage d''arrivée' warehouse: 'Lieu de stockage de départ' - warehouse_id: 'Lieu de stockage de départ' #? subscription: entity: 'Abonné' - entity_id: 'Abonné' #? tax: amount: 'Valeur' tax_declaration: @@ -129,7 +119,6 @@ fra: warehouse: children: 'Sous lieu de stockage' product: 'Produit contenu' - product_id: 'Produit contenu' #? errors: messages: accepted: '%{attribute} doit être accepté' @@ -164,6 +153,7 @@ fra: wrong_length: '%{attribute} n''est pas d''une bon longueur (%{count} caractères)' models: cash: + # currency_does_not_match: 'The currency of the %{journal} is different from that specified for the cash' unvalid_bban: 'Un ou plusieurs éléments du RIB sont incorrects.' custom_field_datum: greater_than: '%{field} est trop grand (%{maximum} maximum)' @@ -188,8 +178,7 @@ fra: end_of_month: '%{attribute} doit correspondre à une date de fin de mois (%{closed_on})' journal_entry: closed_journal: 'Le journal est clôturé au %{closed_on} donc vous ne pouvez plus créer, modifier ou supprimer de pièces jusqu''à cette date-là.' - # out_of_existing_financial_year: 'The journal entry must be recorded in a period corresponding to an existing financial year.' - out_of_financial_year: 'La pièce doit être saisie durant l''exercice' #? + out_of_existing_financial_year: 'L''écriture doit être enregistrée dans un exercice comptable existant.' unbalanced: 'La pièce n''est pas équilibrée' journal_entry_line: closed_entry: 'L''écriture est verrouillée. Il n''est pas possible de la modifier.' @@ -230,15 +219,14 @@ fra: account: 'Compte' account_balance: 'Balance de compte' area: 'Zone postale' - # asset: 'Asset' - # asset_depreciation: 'Asset depreciation' + asset: 'Immobilisation' + asset_depreciation: 'Amortissement d''immobilisation' bank_statement: 'Relevé de compte bancaire' cash: 'Trésorerie' cash_transfer: 'Virement interne' company: 'Société' contact: 'Contact' cultivation: 'Culture' - currency: 'Devise' #? custom_field: 'Champ complémentaire' custom_field_choice: 'Choix de champ complémentaire' custom_field_datum: 'Donnée complémentaire de fiche' @@ -303,8 +291,6 @@ fra: sale: 'Vente' sale_line: 'Ligne de vente' sale_nature: 'Type de vente' - sales_invoice: 'Facture' #? - sales_invoice_line: 'Ligne de facture' #? sequence: 'Séquence' stock: 'Stock de produit' stock_move: 'Mouvement de stock' @@ -324,7 +310,6 @@ fra: attributes: account: 'Compte comptable' account_balances: 'Balances de compte' - account_id: 'Compte comptable' account_number: 'Numéro de compte' accounted_at: 'Date comptabilisation' accounts: 'Comptes' @@ -338,17 +323,14 @@ fra: amount: 'Montant' annotation: 'Annotation' area: 'Zone postale' - area_id: 'Zone postale' #? area_measure: 'Superficie' area_unit: 'Unité de surface' - area_unit_id: 'Unité de surface' areas: 'Zones postales' arrived_on: 'Arrivé le' assimilated_taxes_amount: 'Montant des taxes assimilées' atmospheric_pressure: 'Pression atmosphérique' attorney: 'Mandataire' attorney_account: 'Compte mandataire associé' - attorney_account_id: 'Compte mandataire associé' #? attorney_accounts: 'Comptes mandataires' attribute_name: 'Nom de l''attribut' authorized_payments_count: 'Nombre d''encaissements autorisés' @@ -361,8 +343,7 @@ fra: bank_code: 'Code banque' bank_journals: 'Journaux de banque' bank_name: 'Nom de la banque' - bank_statement: 'Relevés de compte bancaire' - bank_statement_id: 'Relevé de compte bancaire' #? + bank_statement: 'Relevé de compte bancaire' bank_statements: 'Relevés de compte bancaire' banks_accounts: 'Comptes comptables de banque' base: 'Base' @@ -371,37 +352,31 @@ fra: boolean_value: 'Valeur booléenne' born_on: 'Date de naissance' building: 'Bâtiment' - building_id: 'Bâtiment' #? by_default: 'Par défaut' cache: 'Cache' cash: 'Trésorerie' - cash_id: 'Trésorerie' cash_journals: 'Journaux de caisse' cashes: 'Trésoreries' cashes_accounts: 'Comptes de caisse' catalog_description: 'Description pour le catalogue' catalog_name: 'Nom pour le catalogue' category: 'Catégorie' - category_id: 'Catégorie' # ceded: 'Ceded' # ceded_on: 'Ceded on' changes_reflected: 'Refléter les changements' charges_accounts: 'Comptes de charge' check_number: 'N°Chèque' check_state: 'Vérifier l''état' - child_land_parcel_id: 'Sous-îlot' #? + child_land_parcel: 'Sous-îlot' #? children: 'Sous-nœuds' choice_value: 'Valeur choix' - choice_value_id: 'Valeur choix' #? choices: 'Choix de champ complémentaire' choices_count: 'Nb. Choix' city: 'Ville' city_name: 'Nom' client: 'Client' client_account: 'Compte client associé' - client_account_id: 'Compte client associé' #? client_accounts: 'Comptes clients' - client_id: 'Client' clients: 'Clients' closed: 'Clôturé' closed_on: 'Date de clôture' @@ -409,20 +384,16 @@ fra: code2: 'Code secondaire' coefficient: 'Coefficient' collected_account: 'TVA collectée' - collected_account_id: 'TVA collectée' #? collected_amount: 'TVA brute' color: 'Couleur' comment: 'Commentaire' commercial: 'Activité commerciale' commission_account: 'Compte à utiliser pour la commission' - commission_account_id: 'Compte à utiliser pour la commission' commission_amount: 'Montant de la commission' commission_base_amount: 'Montant fixe de la commission' commission_percent: 'Pourcentage de commission' company: 'Société' - company_id: 'Société' component: 'Produit contenu' - component_id: 'Produit contenu' #? components: 'Composants de produit' compute: 'Dernière valeur' conclusion: 'Conclusion' @@ -433,13 +404,11 @@ fra: connected_at: 'Connecté le' consumption: 'Consommation (litres/heure)' contact: 'Adresse' - contact_id: 'Adresse' contacts: 'Contacts' country: 'Pays' created_at: 'Date et heure de création' created_on: 'Date de création' creator: 'Créateur' - creator_id: 'Créateur' credit: 'Crédit' credit_lines: 'Lignes d''avoir' #? credited_quantity: 'Quantité déjà passée en avoir' @@ -447,14 +416,12 @@ fra: critic_quantity_min: 'Quantité minimum critique' crypt_key: 'Clé de cryptage' crypt_mode: 'Mode de cryptage' - currencies: 'Devises' #? currency: 'Devise' currency_rate: 'Taux de change' #? current_financial_year: 'Exercice comptable en cours' custom_field: 'Champ complémentaire' custom_field_choices: 'Choix de champ complémentaire' custom_field_data: 'Données complémentaires de fiche' - custom_field_id: 'Champ complémentaire' custom_fields: 'Champs complémentaires' data: 'Données complémentaires' date_value: 'Valeur date' @@ -477,20 +444,15 @@ fra: deliveries_conditions: 'Conditions de Livraison' delivery: 'Livraison' delivery_contact: 'Adresse pour la livraison' - delivery_contact_id: 'Adresse pour la livraison' - delivery_id: 'Livraison' delivery_lines: 'Lignes de livraison' delivery_modes: 'Modes de livraison' #? density_label: 'Densité' departed_on: 'Parti le' department: 'Service' - department_id: 'Service' #? departments: 'Services' deposit: 'Remise en banque' - deposit_id: 'Remise en banque' depositable_payments: 'Encaissements encaissables' depositables_account: 'Compte d''attente pour les encaissements à encaisser' - depositables_account_id: 'Compte d''attente pour les encaissements à encaisser' #? deposits: 'Remises en banque' # deprecated_amount: 'Deprecated amount' # depreciable_amount: 'Depreciable amount' @@ -498,7 +460,6 @@ fra: # depreciation_method: 'Depreciation method' description: 'Description' dest_contact: 'Adresse de livraison' #? - dest_contact_id: 'Adresse de livraison' #? diff_less: 'Droits enlevés' diff_more: 'Droits rajoutés' direct_links: 'Liens directs' @@ -507,7 +468,6 @@ fra: discount: 'Réduction (en %)' #? discount_rate: 'Taux d''escompte' district: 'Zone administrative' - district_id: 'Zone administrative' #? districts: 'Zones administratives' division: 'Position X' document_templates: 'Modèles de document' @@ -522,42 +482,34 @@ fra: ean13: 'Code EAN13' email: 'Courriel (e-mail)' emitter_amount: 'Montant émis' - emitter_cash_id: 'Trésorerie émettrice' #? + emitter_cash: 'Trésorerie émettrice' emitter_currency: 'Devise émise' emitter_currency_rate: 'Taux de la devise émise' - emitter_journal_entry_id: 'Écriture de l''émission' #? + emitter_journal_entry: 'Écriture de l''émission' #? employed: 'Employé par la société' employees: 'employés' employment: 'Emploi/Rôle' entities: 'Personnes' entity: 'Personne' entity_1: 'Personne 1' - entity_1_id: 'Personne 1' #? entity_2: 'Personne 2' - entity_2_id: 'Personne 2' #? entity_categories: 'Catégories de personne' - entity_id: 'Personne' entity_link_nature: 'Type de lien permettant d''étendre l''abonnement' - entity_link_nature_id: 'Type de lien permettant d''étendre l''abonnement' #? entity_link_natures: 'Natures de lien entre personnes' entity_links: 'Liens de personne' entity_name: 'Nom de l''abonné' entity_natures: 'Types de personne' entries: 'Écritures' entry: 'Écriture' - entry_id: 'Écriture' #? establishment: 'Établissement' - establishment_id: 'Établissement' establishments: 'Établissements' event_natures: 'Types d''évènement' events: 'Évènements' examinated_at: 'Examiné le' excise: 'Numéro d''accises' expense: 'Dépense' - expense_id: 'Dépense' expense_type: 'Type de dépense' expiration: 'Délai d''expiration du devis' - expiration_id: 'Délai d''expiration du devis' expired_on: 'Date d''expiration' exportable: 'Exportable' expression: 'Expression' @@ -568,7 +520,6 @@ fra: filename: 'Nom de fichier' filesize: 'Taille du fichier' financial_year: 'Exercice' - financial_year_id: 'Exercice' financial_years: 'Exercices' finish: 'Fin' first_met_on: 'Date de la première rencontre' @@ -588,14 +539,14 @@ fra: global_count: 'Population globale' global_credit: 'Crédit global' global_debit: 'Débit global' - group_id: 'Groupe' #? + group: 'Groupe' #? has_downpayment: 'A un acompte' hashed_password: 'Mot de passe crypté' hour_duration: 'Heure(s)' iban: 'IBAN' iban_label: 'IBAN' id: 'ID' - immobilizations_account_id: 'Compte d''immobilisation' #? + immobilizations_account: 'Compte d''immobilisation' #? importance: 'Importance' in_cash: 'En espèce' in_name: 'Abréviation incluse dans le nom de la personne' @@ -605,31 +556,26 @@ fra: incoming_payments: 'Encaissements' indirect_links: 'Liens indirects' initial_number: 'Numér initial' + # input_conveyors: 'Input conveyors' integer_value: 'Valeur entière' introduction: 'Introduction' inventories: 'Inventaires' inventory: 'Inventaire' - inventory_id: 'Inventaire' #? inventory_lines: 'Lignes d''inventaire' invoice_contact: 'Adresse pour la facture' - invoice_contact_id: 'Adresse pour la facture' #? invoiced: 'Facturée' #? invoiced_on: 'Facturée le' invoices_count: 'Nombre de factures' is_debit: 'Débit' item_listing: 'Nœud de l''extraction' - item_listing_id: 'Nœud de l''extraction' #? item_listing_node: 'Nœud de l''élément' - item_listing_node_id: 'Nœud de l''élément' #? item_nature: 'Nature de l''élément' item_value: 'Valeur de l''élément' items: 'Éléments de nœud d''extraction' journal: 'Journal' journal_entries: 'Écritures' journal_entry: 'Écriture' - journal_entry_id: 'Écriture' journal_entry_lines: 'Lignes d''écritures' - journal_id: 'Journal' journals: 'Journaux' key: 'Clé' label: 'Libellé' @@ -655,7 +601,6 @@ fra: line_6_code: 'Code postal' lines: 'Lignes' listing: 'Extraction' - listing_id: 'Extraction' #? listing_node_items: 'Éléments de nœud d''extraction' listing_nodes: 'Nœuds d''extraction' listings: 'Extractions' @@ -675,19 +620,16 @@ fra: min_duration: 'Minute(s)' mobile: 'Portable' mode: 'Mode' - mode_id: 'Mode' moved_on: 'Fait le' name: 'Nom' name_1_to_2: 'Personne 1 ⇒ Personne 2' name_2_to_1: 'Personne 2 ⇒ Personne 1' nature: 'Type' nature_code: 'Code' - nature_id: 'Type' nature_label: 'Type' net_weight: 'Masse nette' nic: 'NIC (Numéro Interne de Classement)' node: 'Nœud' - node_id: 'Nœud' #? nodes: 'Nœuds d''extraction' number: 'Numéro' number_format: 'Format du numéro' @@ -697,54 +639,44 @@ fra: office: 'Bureau/Atelier' old_password: 'Mot de passe actuel' operation: 'Travail' - operation_id: 'Travail' operation_lines: 'Intrants/sortants' - operation_nature_id: 'Type d''operation' #? + operation_nature: 'Type d''operation' #? operation_natures: 'Types de travail' operation_uses: 'Utilisations d''outil' operations: 'Travaux' order: 'Vente' #? - order_id: 'Vente' #? order_line: 'Ligne de vente' #? - order_line_id: 'Ligne de vente' #? organization: 'Organisation' - origin: 'Ligne d''origine' - origin_id: 'Origine' + origin: 'Origine' origin_type: 'Type de l''origine' original_credit: 'Crédit' # original_currency: 'Original currency' # original_currency_rate: 'Original currency rate' original_debit: 'Débit' original_name: 'Nom original' + # outgoing_deliveries: 'Outgoing deliveries' + # outgoing_delivery_lines: 'Outgoing delivery lines' outgoing_payment_modes: 'Modes de décaissement' outgoing_payment_uses: 'Parties de décaissements' outgoing_payments: 'Décaissements' owner: 'Propriétaire' - owner_id: 'Propriétaire' #? owner_type: 'Nature du propriétaire' paid: 'Réglée' #? paid_account: 'TVA déductible' - paid_account_id: 'TVA déductible' #? paid_amount: 'Montant payé' paid_on: 'Réglé le' parent: 'Parent' - parent_id: 'Parent' - parent_land_parcel_id: 'Sur-îlot' #? + parent_land_parcel: 'Sur-îlot' #? parts: 'Affectations' #? parts_amount: 'Montant utilisé' #? password: 'Mot de passe' password_confirmation: 'Confirmation du mot de passe' payee: 'Bénéficiaire' - payee_id: 'Bénéficiaire' #? payer: 'Payeur' - payer_id: 'Payeur' #? payment: 'Décaissement' payment_delay: 'Délai d''encaissement' - payment_delay_id: 'Délai d''encaissement' - payment_id: 'Décaissement' payment_mode: 'Mode d''encaissement' payment_mode_complement: 'Complément d''information sur le mode d''encaissement' - payment_mode_id: 'Mode d''encaissement' payment_modes: 'Modes d''encaissement' #? payment_on: 'A régler au plus tard le' payment_uses: 'Parties d''encaissement' @@ -765,39 +697,32 @@ fra: pretax_amount: 'Montant HT' price: 'Prix' price_amount: 'Montant HT' - price_id: 'Prix' prices: 'Prix' printed_at: 'Imprimé le' printed_on: 'Datée du' producer: 'Producteur' - producer_id: 'Producteur' #? product: 'Produit' product_categories: 'Catégories de produit' product_components: 'Composants de produit' - product_id: 'Produit' productable_products: 'Produits produisibles' - production_chain_conveyor_id: 'Convoyeur de chaîne de production' #? - production_chain_id: 'Chaîne de production' - production_chain_work_center_id: 'Centre d''opérations de chaîne de production' #? + production_chain: 'Chaîne de production' + production_chain_conveyor: 'Convoyeur de chaîne de production' #? + production_chain_work_center: 'Centre d''opérations de chaîne de production' #? products: 'Produits' products_accounts: 'Comptes produits' profession: 'Profession' - profession_id: 'Profession' #? professions: 'Professions' propagate_contacts: 'Propager les contacts' proposer: 'Parrain' - proposer_id: 'Parrain' #? prospect: 'Prospect' published: 'Publié' + purchase: 'Achat' # purchase_amount: 'Purchase amount' - purchase_id: 'Achat' purchase_line: 'Ligne d''achat' - purchase_line_id: 'Ligne d''achat' #? purchase_lines: 'Lignes d''achat' # purchased_on: 'Purchased on' purchases: 'Achats' purchases_account: 'Compte comptable de charges' - purchases_account_id: 'Compte comptable de charges' #? quantity: 'Quantité' quantity_max: 'Quantité maximum' quantity_min: 'Quantité minimum' @@ -808,60 +733,52 @@ fra: receipt: 'Reçu électronique' received: 'Reçue' receiver_amount: 'Montant reçu' - receiver_cash_id: 'Tésorerie réceptrice' #? + receiver_cash: 'Trésorerie réceptrice' receiver_currency: 'Devise reçue' receiver_currency_rate: 'Taux de la devise reçue' - receiver_journal_entry_id: 'Écriture de la réception' #? + receiver_journal_entry: 'Écriture de la réception' reconcilable: 'Lettrable' record_value: 'Enregistrement' - record_value_id: 'Enregistrement' #? record_value_type: 'Type d''enregistrement' reductible: 'Réductible' reduction: 'Ligne de réduction' reduction_origin: 'Ligne soumise à réduction' - reduction_origin_id: 'Ligne soumise à réduction' #? reduction_percent: 'Pourcentage de réduction' reduction_rate: 'Taux de réduction' reduction_submissive: 'Soumis à réduction' reductions: 'Lignes de réductions' reference_number: 'N°Référence' reflation_submissive: 'Soumis à la relance' + # reflections: 'Reflections' relative_humidity: 'Humidité relative' remaining_duration: 'Durée d''utilisation prévue (heures)' required: 'Obligatoire' reservoir: 'Réservoir' resource: 'Origine' - resource_id: 'Origine' #? resource_type: 'Origine' responsible: 'Responsable' - responsible_id: 'Responsable' rights: 'Droits' role: 'Rôle de base' - role_id: 'Rôle de base' #? roles: 'Rôles' rome: 'Code ROME' root_model: 'Racine' root_model_name: 'Racine' sale: 'Vente' - sale_id: 'Vente' - sale_line_id: 'Ligne de vente' + sale_line: 'Ligne de vente' sale_lines: 'Lignes de vente' sale_natures: 'Types de vente' sales: 'Ventes' sales_account: 'Compte comptable de produits' - sales_account_id: 'Compte comptable de produits' #? sales_conditions: 'Conditions Générales de Vente' sales_invoice: 'Facture' #? - sales_invoice_id: 'Facture' #? sales_invoice_lines: 'Lignes de facture' #? sales_invoices: 'Factures' sales_invoices_count: 'Nombre de factures' #? salt: 'Sel' scheduled: 'Encaissement programmé' - second_move_id: 'Second mouvement' #? - second_stock_move_id: 'Second mouvement de stock' #? - second_warehouse: 'Lieu de stockage d''arrivée' - second_warehouse_id: 'Lieu de stockage du second mouvement' #? + second_move: 'Second mouvement' #? + second_stock_move: 'Second mouvement de stock' #? + second_warehouse: 'Lieu de stockage du second mouvement' self_bank_accounts: 'Comptes bancaires en propre' self_cashes: 'Caisses en propre' self_contacts: 'Contacts en propre' @@ -875,7 +792,6 @@ fra: siret: 'N° SIRET' soundex: 'Soundex' source: 'Source' - source_id: 'Source' #? source_quantity: 'Quantité source' sql_type: 'Type SQL' start: 'Début' @@ -885,8 +801,7 @@ fra: state: 'État' state_label: 'État' stock: 'Stock de produit' - stock_id: 'Stock de produit' #? - stock_move_id: 'Mouvement de stock' + stock_move: 'Mouvement de stock' stock_moves: 'Mouvements de stock' stock_transfers: 'Transferts ou pertes de stock' stockable: 'Gérer les stocks' @@ -900,7 +815,6 @@ fra: subdivision: 'Position Y' subject: 'Objet' subscription_nature: 'Type' - subscription_nature_id: 'Type' #? subscription_natures: 'Types d''abonnement' subscription_period: 'Période' subscription_quantity: 'Quantité' @@ -909,25 +823,20 @@ fra: sum_method: 'Méthode de calcul' supplier: 'Fournisseur' supplier_account: 'Compte fournisseur associé' - supplier_account_id: 'Compte fournisseur associé' #? supplier_accounts: 'Comptes fournisseurs' - supplier_id: 'Fournisseur' suppliers: 'Fournisseurs' surface_units: 'Unités de surface' suspended: 'Suspendu' symbol: 'Symbole' #? symmetric: 'Symétrique' target: 'Parcelle' - target_id: 'Parcelle' target_quantity: 'Quantité cible' target_type: 'Type de cible' tax: 'Taxe' tax_declarations: 'Déclarations de taxes' - tax_id: 'Taxe' taxes: 'Taxes' temperature: 'Température' template: 'Modèle' - template_id: 'Modèle' #? text_importance: 'Importance' text_nature: 'Type' theoric_quantity: 'Quantité théorique' @@ -935,35 +844,30 @@ fra: to: 'Pour' to_archive: 'Archiver les documents' to_bank_on: 'À décaisser le' + to_deposit: 'À remettre' tool: 'Outil' - tool_id: 'Outil' tools: 'Outils' tools_list: 'Matériel' total_weight: 'Masse totale' trackable: 'Traçable' tracking: 'Lot' - tracking_id: 'Lot' tracking_serial: 'Numéro de lot' trackings: 'Lots traçables' transfers: 'Transferts' transport: 'Transport' - transport_id: 'Transport' #? transport_on: 'Transport le' transporter: 'Transporteur' - transporter_id: 'Transporteur' transporters: 'Transporteurs' transports: 'Transports' type: 'Type' #? undelivered_quantity: 'Reste à livrer' unique_tracking: 'Numéro unique' unit: 'Unité' - unit_id: 'Unité' unit_quantity: 'Quantité par unité de surface' units: 'Unités' unquantifiable: 'Non quantifiable' updated_at: 'Mis à jour le' updater: 'Modificateur' - updater_id: 'Modificateur' usable_incoming_payments: 'Encaissements utilisables' usable_outgoing_payments: 'Décaissements utilisables' usage: 'Utilisation' @@ -971,7 +875,6 @@ fra: use_range: 'Utiliser un intervalle de quantité' used_amount: 'Montant utilisé' user: 'Utilisateur' - user_id: 'Utilisateur' #? users: 'Utilisateurs' uses: 'Matériels utilisés' value: 'Valeur' @@ -981,24 +884,23 @@ fra: virtual: 'Virtuel' virtual_quantity: 'Stock virtuel' warehouse: 'Lieu de stockage' - warehouse_id: 'Lieu de stockage' warehouses: 'Lieux de stockage' webpass: 'Mot de passe web' website: 'Site web' weight: 'Poids (kg)' - with_accounting: 'Comptabiliser les encaissements' + with_accounting: 'Passer en comptabilité' with_commission: 'Inclure une commission' with_deposit: 'Utiliser les remises en banque' with_tracking: 'Avec tracabilité' with_transport: 'Avec transport' - work_center_id: 'Centre d''opération' #? + work_center: 'Centre d''opération' #? models: account: label: '%{number} - %{name}' asset: depreciation_methods: - # graduated: 'Graduated' - # linear: 'Linear' + graduated: 'Dégressive' + linear: 'Linéaire' cash: modes: bban: 'Relevé d''identité bancaire (RIB)' diff --git a/config/locales/fra/rights.yml b/config/locales/fra/rights.yml index 845fcbbd90..16c0dde62a 100644 --- a/config/locales/fra/rights.yml +++ b/config/locales/fra/rights.yml @@ -23,13 +23,14 @@ fra: mail_to_listings: 'Gérer l''envoi de courriels par les extractions' manage_accounts: 'Gérer les comptes comptables' manage_areas: 'Gérer les zones' + # manage_assets: 'Manage assets' manage_bank_statements: 'Pointage des relevés de comptes' manage_cash_transfers: 'Gérer les virements internes' manage_cashes: 'Gérer les comptes de trésorerie' manage_custom_fields: 'Gérer les champs personnalisés' manage_delays: 'Gérer les délais' manage_deposits: 'Gérer les remises en banque' - manage_districts: 'Gérer les districts' + manage_districts: 'Gérer les zones administratives' manage_document_templates: 'Gérer les modèles de document' manage_entities: 'Gérer les fiches clients/fournisseurs' manage_entities_natures: 'Gérer les types de fiche' diff --git a/config/locales/jpn/action.yml b/config/locales/jpn/action.yml index 98937aa660..12a9f35bd2 100644 --- a/config/locales/jpn/action.yml +++ b/config/locales/jpn/action.yml @@ -277,8 +277,8 @@ jpn: production_chain_work_centers: # edit: 'Edit the work center: %{name}' # new: 'Add a new work center' - # play: 'Play work center: #{name}' - # show: 'Work center: #{name}' + # play: 'Play work center: %{name}' + # show: 'Work center: %{name}' production_chains: # edit: 'Edit production chain: %{name}' # index: 'Production chains' @@ -1046,6 +1046,7 @@ jpn: # scheduled: 'Scheduled' search: '探す' # search_account: 'Search for accounts' + # search_for_available_prices: '%{code} - %{name}, %{pretax_amount}' # search_go: 'Search!' # search_sales: 'Search sales' # second_contact: 'Second address' diff --git a/config/locales/jpn/models.yml b/config/locales/jpn/models.yml index d3656c167f..13a5b975ed 100644 --- a/config/locales/jpn/models.yml +++ b/config/locales/jpn/models.yml @@ -144,6 +144,7 @@ jpn: # wrong_length: '%{attribute} is the wrong length (should be %{count} characters)' models: cash: + # currency_does_not_match: 'The currency of the %{journal} is different from that specified for the cash' # unvalid_bban: 'Unvalid BBAN. One or more elements are incorrect.' custom_field_datum: # greater_than: '%{field} is greater than %{maximum}' @@ -300,7 +301,6 @@ jpn: attributes: # account: 'Account' # account_balances: 'Account balances' - # account_id: 'Account' # account_number: 'Account number' # accounted_at: 'Accounted at' # accounts: 'Accounts' @@ -316,7 +316,6 @@ jpn: # area: 'Area' # area_measure: 'Area measure' # area_unit: 'Area unit' - # area_unit_id: 'Area unit' # areas: 'Areas' # arrived_on: 'Arrived on' # assimilated_taxes_amount: 'Assimilated taxes amount' @@ -347,14 +346,12 @@ jpn: # by_default: 'By default' # cache: 'Cache' # cash: 'Cash' - # cash_id: 'Cash' # cash_journals: 'Cash journals' # cashes: 'Bank accounts' # cashes_accounts: 'Cashes accounts' # catalog_description: 'Catalog description' # catalog_name: 'Catalog name' # category: 'Category' - # category_id: 'Category' # ceded: 'Ceded' # ceded_on: 'Ceded on' # changes_reflected: 'Changes reflected' @@ -370,7 +367,6 @@ jpn: # client: 'Client' # client_account: 'Client account' # client_accounts: 'Client accounts' - # client_id: 'Client' # clients: 'Clients' # closed: 'Closed' # closed_on: 'Closed on' @@ -383,12 +379,11 @@ jpn: comment: 'メモ' # commercial: 'Commercial' # commission_account: 'Commission account' - # commission_account_id: 'Commission account' # commission_amount: 'Commission amount' # commission_base_amount: 'Base amount of the commission' # commission_percent: 'Commission percent' company: '会社' - company_id: '会社' + company_id: '会社' #? # component: 'Component' # components: 'Components' # compute: 'Compute' @@ -400,13 +395,12 @@ jpn: # connected_at: 'Connected at' # consumption: 'Consumption' # contact: 'Contact' - # contact_id: 'Contact' # contacts: 'Contacts' # country: 'Country' # created_at: 'Created at' # created_on: 'Created on' creator: '創始者' - creator_id: '創始者' + creator_id: '創始者' #? # credit: 'Credit' # credited_quantity: 'Credited quantity' # credits: 'Credits' @@ -418,7 +412,6 @@ jpn: # custom_field: 'Custom field' # custom_field_choices: 'Custom field choices' # custom_field_data: 'Custom field data' - # custom_field_id: 'Custom field' # custom_fields: 'Custom fields' # data: 'Data' # date_value: 'Date value' @@ -440,15 +433,12 @@ jpn: # deliveries_conditions: 'Deliveries conditions' # delivery: 'Delivery' # delivery_contact: 'Delivery contact' - # delivery_contact_id: 'Delivery contact' - # delivery_id: 'Delivery' # delivery_lines: 'Delivery lines' # density_label: 'Density label' # departed_on: 'Departed on' # department: 'Department' # departments: 'Departments' # deposit: 'Deposit' - # deposit_id: 'Deposit' # depositable_payments: 'Embankable payments' # depositables_account: 'Embankables account' # deposits: 'Deposits' @@ -476,17 +466,17 @@ jpn: # ean13: 'Ean13' # email: 'Email' # emitter_amount: 'Emitted amount' + # emitter_cash: 'Emitter cash' # emitter_currency: 'Emitter currency' # emitter_currency_rate: 'Emitted currency rate' # employed: 'Employed' # employees: 'Employees' # employment: 'Employment' # entities: 'People' - # entity: 'Person' + # entity: 'Entity' # entity_1: 'Person 1' # entity_2: 'Person 2' # entity_categories: 'Person categories' - # entity_id: 'Entity' # entity_link_nature: 'Person link type' # entity_link_natures: 'Person link types' # entity_links: 'Person links' @@ -495,17 +485,14 @@ jpn: # entries: 'Entries' # entry: 'Entry' # establishment: 'Establishment' - # establishment_id: 'Establishment' # establishments: 'Establishments' # event_natures: 'Event types' # events: 'Events' # examinated_at: 'Examinated at' # excise: 'Excise' # expense: 'Expense' - # expense_id: 'Expense' # expense_type: 'Expense type' # expiration: 'Expiration' - # expiration_id: 'Expiration' # expired_on: 'Expired on' # exportable: 'Exportable' # expression: 'Expression' @@ -516,7 +503,6 @@ jpn: # filename: 'Filename' # filesize: 'Filesize' # financial_year: 'Financial year' - # financial_year_id: 'Financial year' # financial_years: 'Financial years' # finish: 'Finish' # first_met_on: 'First met on' @@ -551,6 +537,7 @@ jpn: # incoming_payments: 'Incoming payments' # indirect_links: 'Indirect links' # initial_number: 'Initial number' + # input_conveyors: 'Input conveyors' # integer_value: 'Integer value' # introduction: 'Introduction' # inventories: 'Inventories' @@ -568,9 +555,7 @@ jpn: # journal: 'Journal' # journal_entries: 'Journal entries' # journal_entry: 'Journal entry' - # journal_entry_id: 'Journal entry' # journal_entry_lines: 'Journal entry lines' - # journal_id: 'Journal' # journals: 'Journals' # key: 'Key' # label: 'Label' @@ -615,14 +600,12 @@ jpn: # min_duration: 'Min duration' # mobile: 'Mobile' # mode: 'Mode' - # mode_id: 'Mode' # moved_on: 'Moved on' name: '名前' # name_1_to_2: 'Name 1 to 2' # name_2_to_1: 'Name 2 to 1' - # nature: 'Type' + # nature: 'Nature' # nature_code: 'Type code' - # nature_id: 'Nature' # nature_label: 'Type label' # net_weight: 'Net weight (kg)' # nic: 'Nic' @@ -636,20 +619,20 @@ jpn: # office: 'Office' # old_password: 'Old password' # operation: 'Operation' - # operation_id: 'Operation' # operation_lines: 'Operation lines' # operation_natures: 'Operation types' # operation_uses: 'Tool uses' # operations: 'Operations' # organization: 'Organization' # origin: 'Origin' - # origin_id: 'Origin' # origin_type: 'Origin type' # original_credit: 'Original credit' # original_currency: 'Original currency' # original_currency_rate: 'Original currency rate' # original_debit: 'Original debit' # original_name: 'Original name' + # outgoing_deliveries: 'Outgoing deliveries' + # outgoing_delivery_lines: 'Outgoing delivery lines' # outgoing_payment_modes: 'Disbursement modes' # outgoing_payment_uses: 'Disbursement parts' # outgoing_payments: 'Disbursements' @@ -659,18 +642,15 @@ jpn: # paid_amount: 'Paid amount' # paid_on: 'Paid on' parent: '親戚' - parent_id: '親戚' + parent_id: '親戚' #? # password: 'Password' # password_confirmation: 'Confirmation of password' # payee: 'Payee' # payer: 'Payer' # payment: 'Payment' # payment_delay: 'Payment delay' - # payment_delay_id: 'Payment delay' - # payment_id: 'Payment' # payment_mode: 'Payment mode' # payment_mode_complement: 'Payment mode complement' - # payment_mode_id: 'Payment mode' # payment_on: 'Payment on' # payment_uses: 'Payment parts' # payment_way: 'Payment way' @@ -690,7 +670,6 @@ jpn: # pretax_amount: 'Pre-tax amount' # price: 'Price' # price_amount: 'Price amount' - # price_id: 'Price' # prices: 'Prices' # printed_at: 'Printed at' # printed_on: 'Printed on' @@ -698,9 +677,8 @@ jpn: # product: 'Product' # product_categories: 'Product categories' # product_components: 'Product components' - # product_id: 'Product' # productable_products: 'Productable products' - # production_chain_id: 'Production chain' + # production_chain: 'Production chain' # products: 'Products' # products_accounts: 'Products accounts' # profession: 'Profession' @@ -709,8 +687,8 @@ jpn: # proposer: 'Proposer' # prospect: 'Prospect' # published: 'Published' + # purchase: 'Purchase' # purchase_amount: 'Purchase amount' - # purchase_id: 'Purchase' # purchase_line: 'Purchase line' # purchase_lines: 'Purchase order lines' # purchased_on: 'Purchased on' @@ -725,8 +703,10 @@ jpn: # receipt: 'Receipt' # received: 'Received' # receiver_amount: 'Received amount' + # receiver_cash: 'Receiver cash' # receiver_currency: 'Receiver currency' # receiver_currency_rate: 'Received currency rate' + # receiver_journal_entry: 'Receiver journal entry' # reconcilable: 'Reconcilable' # record_value: 'Record value' # record_value_type: 'Record value type' @@ -739,6 +719,7 @@ jpn: # reductions: 'Reductions' # reference_number: 'Reference number' # reflation_submissive: 'Reflation submissive' + # reflections: 'Reflections' # relative_humidity: 'Relative humidity' # remaining_duration: 'Remaining duration' # required: 'Required' @@ -746,16 +727,14 @@ jpn: # resource: 'Resource' # resource_type: 'Resource type' # responsible: 'Responsible' - # responsible_id: 'Responsible' # rights: 'Rights' # role: 'Role' # roles: 'Roles' # rome: 'Rome' # root_model: 'Root model' # root_model_name: 'Root model name' - # sale: 'sale' - # sale_id: 'Sale' - # sale_line_id: 'Sale line' + # sale: 'Sale' + # sale_line: 'Sale line' # sale_lines: 'sale lines' # sale_natures: 'sale types' # sales: 'sales' @@ -785,7 +764,7 @@ jpn: # state: 'State' # state_label: 'State' # stock: 'Stock' - # stock_move_id: 'Stock move' + # stock_move: 'Stock move' # stock_moves: 'Stock moves' # stock_transfers: 'Stock transfers' # stockable: 'Manage stocks' @@ -808,18 +787,15 @@ jpn: # supplier: 'Supplier' # supplier_account: 'Supplier account' # supplier_accounts: 'Supplier accounts' - # supplier_id: 'Supplier' # suppliers: 'Suppliers' # surface_units: 'Surface units' # suspended: 'Suspended' # symmetric: 'Symmetric' # target: 'Target' - # target_id: 'Target' # target_quantity: 'Target quantity' # target_type: 'Target type' # tax: 'Tax' # tax_declarations: 'Tax declarations' - # tax_id: 'Tax' # taxes: 'Taxes' # temperature: 'Temperature' # template: 'Template' @@ -830,33 +806,30 @@ jpn: # to: 'To' # to_archive: 'To archive' # to_bank_on: 'To bank on' + # to_deposit: 'To deposit' # tool: 'Tool' - # tool_id: 'Tool' # tools: 'Tools' # tools_list: 'Tools list' # total_weight: 'Total weight (kg)' # trackable: 'Trackable' # tracking: 'Tracking' - # tracking_id: 'Tracking' # tracking_serial: 'Tracking serial' # trackings: 'Trackings' # transfers: 'Transfers' # transport: 'Transport' # transport_on: 'Transport on' # transporter: 'Transporter' - # transporter_id: 'Transporter' # transporters: 'Transporters' # transports: 'Transports' # undelivered_quantity: 'Undelivered quantity' # unique_tracking: 'Unique tracking' # unit: 'Unit' - # unit_id: 'Unit' # unit_quantity: 'Unit quantity' # units: 'Units' # unquantifiable: 'Unquantifiable' # updated_at: 'Updated at' updater: '修正の人' - updater_id: '修正の人' + updater_id: '修正の人' #? # usable_incoming_payments: 'Usable incoming payments' # usable_outgoing_payments: 'Usable disbursements' # usage: 'Usage' @@ -872,7 +845,6 @@ jpn: # virtual: 'Virtual' # virtual_quantity: 'Virtual quantity' # warehouse: 'Warehouse' - # warehouse_id: 'Warehouse' # warehouses: 'Warehouses' # webpass: 'Webpass' # website: 'Website' diff --git a/config/locales/jpn/rights.yml b/config/locales/jpn/rights.yml index 81ef73a60b..d66807a00a 100644 --- a/config/locales/jpn/rights.yml +++ b/config/locales/jpn/rights.yml @@ -23,6 +23,7 @@ jpn: # mail_to_listings: 'Send mail to lists' # manage_accounts: 'Manage accounts' # manage_areas: 'Manage areas' + # manage_assets: 'Manage assets' # manage_bank_statements: 'Point bank statements' # manage_cash_transfers: 'Manage cash transfers' # manage_cashes: 'Manage cashes' diff --git a/config/locales/spa/action.yml b/config/locales/spa/action.yml index 0da49d6268..4a40c5b367 100644 --- a/config/locales/spa/action.yml +++ b/config/locales/spa/action.yml @@ -298,8 +298,8 @@ spa: production_chain_work_centers: # edit: 'Edit the work center: %{name}' # new: 'Add a new work center' - # play: 'Play work center: #{name}' - # show: 'Work center: #{name}' + # play: 'Play work center: %{name}' + # show: 'Work center: %{name}' production_chains: # edit: 'Edit production chain: %{name}' # index: 'Production chains' @@ -1170,6 +1170,7 @@ spa: # scheduled: 'Scheduled' search: 'buscars piezas/escrituras' # search_account: 'Search for accounts' + # search_for_available_prices: '%{code} - %{name}, %{pretax_amount}' # search_go: 'Search!' # search_sales: 'Search sales' # second_contact: 'Second address' diff --git a/config/locales/spa/models.yml b/config/locales/spa/models.yml index db43cf74fb..5e113a8b2c 100644 --- a/config/locales/spa/models.yml +++ b/config/locales/spa/models.yml @@ -144,6 +144,7 @@ spa: # wrong_length: '%{attribute} is the wrong length (should be %{count} characters)' models: cash: + # currency_does_not_match: 'The currency of the %{journal} is different from that specified for the cash' # unvalid_bban: 'Unvalid BBAN. One or more elements are incorrect.' custom_field_datum: # greater_than: '%{field} is greater than %{maximum}' @@ -300,7 +301,6 @@ spa: attributes: # account: 'Account' # account_balances: 'Account balances' - # account_id: 'Account' # account_number: 'Account number' # accounted_at: 'Accounted at' # accounts: 'Accounts' @@ -316,7 +316,6 @@ spa: # area: 'Area' # area_measure: 'Area measure' # area_unit: 'Area unit' - # area_unit_id: 'Area unit' # areas: 'Areas' # arrived_on: 'Arrived on' # assimilated_taxes_amount: 'Assimilated taxes amount' @@ -347,14 +346,12 @@ spa: # by_default: 'By default' # cache: 'Cache' # cash: 'Cash' - # cash_id: 'Cash' # cash_journals: 'Cash journals' # cashes: 'Bank accounts' # cashes_accounts: 'Cashes accounts' # catalog_description: 'Catalog description' # catalog_name: 'Catalog name' # category: 'Category' - # category_id: 'Category' # ceded: 'Ceded' # ceded_on: 'Ceded on' # changes_reflected: 'Changes reflected' @@ -370,7 +367,6 @@ spa: # client: 'Client' # client_account: 'Client account' # client_accounts: 'Client accounts' - # client_id: 'Client' # clients: 'Clients' # closed: 'Closed' # closed_on: 'Closed on' @@ -383,12 +379,11 @@ spa: # comment: 'Comment' # commercial: 'Commercial' # commission_account: 'Commission account' - # commission_account_id: 'Commission account' # commission_amount: 'Commission amount' # commission_base_amount: 'Base amount of the commission' # commission_percent: 'Commission percent' company: 'Compañía' - company_id: 'Compañía' + company_id: 'Compañía' #? # component: 'Component' # components: 'Components' # compute: 'Compute' @@ -400,13 +395,11 @@ spa: # connected_at: 'Connected at' # consumption: 'Consumption' # contact: 'Contact' - # contact_id: 'Contact' # contacts: 'Contacts' # country: 'Country' # created_at: 'Created at' # created_on: 'Created on' # creator: 'Creator' - # creator_id: 'Creator' # credit: 'Credit' # credited_quantity: 'Credited quantity' # credits: 'Credits' @@ -418,7 +411,6 @@ spa: # custom_field: 'Custom field' # custom_field_choices: 'Custom field choices' # custom_field_data: 'Custom field data' - # custom_field_id: 'Custom field' # custom_fields: 'Custom fields' # data: 'Data' # date_value: 'Date value' @@ -440,15 +432,12 @@ spa: # deliveries_conditions: 'Deliveries conditions' # delivery: 'Delivery' # delivery_contact: 'Delivery contact' - # delivery_contact_id: 'Delivery contact' - # delivery_id: 'Delivery' # delivery_lines: 'Delivery lines' # density_label: 'Density label' # departed_on: 'Departed on' # department: 'Department' # departments: 'Departments' # deposit: 'Deposit' - # deposit_id: 'Deposit' # depositable_payments: 'Embankable payments' # depositables_account: 'Embankables account' # deposits: 'Deposits' @@ -476,17 +465,17 @@ spa: # ean13: 'Ean13' # email: 'Email' # emitter_amount: 'Emitted amount' + # emitter_cash: 'Emitter cash' # emitter_currency: 'Emitter currency' # emitter_currency_rate: 'Emitted currency rate' # employed: 'Employed' # employees: 'Employees' # employment: 'Employment' # entities: 'People' - # entity: 'Person' + # entity: 'Entity' # entity_1: 'Person 1' # entity_2: 'Person 2' # entity_categories: 'Person categories' - # entity_id: 'Entity' # entity_link_nature: 'Person link type' # entity_link_natures: 'Person link types' # entity_links: 'Person links' @@ -495,17 +484,14 @@ spa: # entries: 'Entries' # entry: 'Entry' # establishment: 'Establishment' - # establishment_id: 'Establishment' # establishments: 'Establishments' # event_natures: 'Event types' # events: 'Events' # examinated_at: 'Examinated at' # excise: 'Excise' # expense: 'Expense' - # expense_id: 'Expense' # expense_type: 'Expense type' # expiration: 'Expiration' - # expiration_id: 'Expiration' # expired_on: 'Expired on' # exportable: 'Exportable' # expression: 'Expression' @@ -516,7 +502,6 @@ spa: # filename: 'Filename' # filesize: 'Filesize' # financial_year: 'Financial year' - # financial_year_id: 'Financial year' # financial_years: 'Financial years' # finish: 'Finish' # first_met_on: 'First met on' @@ -551,6 +536,7 @@ spa: # incoming_payments: 'Incoming payments' # indirect_links: 'Indirect links' # initial_number: 'Initial number' + # input_conveyors: 'Input conveyors' # integer_value: 'Integer value' # introduction: 'Introduction' # inventories: 'Inventories' @@ -568,9 +554,7 @@ spa: # journal: 'Journal' # journal_entries: 'Journal entries' # journal_entry: 'Journal entry' - # journal_entry_id: 'Journal entry' # journal_entry_lines: 'Journal entry lines' - # journal_id: 'Journal' # journals: 'Journals' # key: 'Key' # label: 'Label' @@ -615,14 +599,12 @@ spa: # min_duration: 'Min duration' # mobile: 'Mobile' # mode: 'Mode' - # mode_id: 'Mode' # moved_on: 'Moved on' name: 'Nombre' # name_1_to_2: 'Name 1 to 2' # name_2_to_1: 'Name 2 to 1' - # nature: 'Type' + # nature: 'Nature' # nature_code: 'Type code' - # nature_id: 'Nature' # nature_label: 'Type label' # net_weight: 'Net weight (kg)' # nic: 'Nic' @@ -636,20 +618,20 @@ spa: # office: 'Office' # old_password: 'Old password' # operation: 'Operation' - # operation_id: 'Operation' # operation_lines: 'Operation lines' # operation_natures: 'Operation types' # operation_uses: 'Tool uses' # operations: 'Operations' # organization: 'Organization' # origin: 'Origin' - # origin_id: 'Origin' # origin_type: 'Origin type' # original_credit: 'Original credit' # original_currency: 'Original currency' # original_currency_rate: 'Original currency rate' # original_debit: 'Original debit' # original_name: 'Original name' + # outgoing_deliveries: 'Outgoing deliveries' + # outgoing_delivery_lines: 'Outgoing delivery lines' # outgoing_payment_modes: 'Disbursement modes' # outgoing_payment_uses: 'Disbursement parts' # outgoing_payments: 'Disbursements' @@ -659,18 +641,14 @@ spa: # paid_amount: 'Paid amount' # paid_on: 'Paid on' # parent: 'Parent' - # parent_id: 'Parent' # password: 'Password' # password_confirmation: 'Confirmation of password' # payee: 'Payee' # payer: 'Payer' # payment: 'Payment' # payment_delay: 'Payment delay' - # payment_delay_id: 'Payment delay' - # payment_id: 'Payment' # payment_mode: 'Payment mode' # payment_mode_complement: 'Payment mode complement' - # payment_mode_id: 'Payment mode' # payment_on: 'Payment on' # payment_uses: 'Payment parts' # payment_way: 'Payment way' @@ -690,7 +668,6 @@ spa: # pretax_amount: 'Pre-tax amount' # price: 'Price' # price_amount: 'Price amount' - # price_id: 'Price' # prices: 'Prices' # printed_at: 'Printed at' # printed_on: 'Printed on' @@ -698,9 +675,8 @@ spa: # product: 'Product' # product_categories: 'Product categories' # product_components: 'Product components' - # product_id: 'Product' # productable_products: 'Productable products' - # production_chain_id: 'Production chain' + # production_chain: 'Production chain' # products: 'Products' # products_accounts: 'Products accounts' # profession: 'Profession' @@ -709,8 +685,8 @@ spa: # proposer: 'Proposer' # prospect: 'Prospect' # published: 'Published' + # purchase: 'Purchase' # purchase_amount: 'Purchase amount' - # purchase_id: 'Purchase' # purchase_line: 'Purchase line' # purchase_lines: 'Purchase order lines' # purchased_on: 'Purchased on' @@ -725,8 +701,10 @@ spa: # receipt: 'Receipt' # received: 'Received' # receiver_amount: 'Received amount' + # receiver_cash: 'Receiver cash' # receiver_currency: 'Receiver currency' # receiver_currency_rate: 'Received currency rate' + # receiver_journal_entry: 'Receiver journal entry' # reconcilable: 'Reconcilable' # record_value: 'Record value' # record_value_type: 'Record value type' @@ -739,6 +717,7 @@ spa: # reductions: 'Reductions' # reference_number: 'Reference number' # reflation_submissive: 'Reflation submissive' + # reflections: 'Reflections' # relative_humidity: 'Relative humidity' # remaining_duration: 'Remaining duration' # required: 'Required' @@ -746,16 +725,14 @@ spa: # resource: 'Resource' # resource_type: 'Resource type' # responsible: 'Responsible' - # responsible_id: 'Responsible' # rights: 'Rights' # role: 'Role' # roles: 'Roles' # rome: 'Rome' # root_model: 'Root model' # root_model_name: 'Root model name' - # sale: 'sale' - # sale_id: 'Sale' - # sale_line_id: 'Sale line' + # sale: 'Sale' + # sale_line: 'Sale line' # sale_lines: 'sale lines' # sale_natures: 'sale types' # sales: 'sales' @@ -785,7 +762,7 @@ spa: # state: 'State' # state_label: 'State' # stock: 'Stock' - # stock_move_id: 'Stock move' + # stock_move: 'Stock move' # stock_moves: 'Stock moves' # stock_transfers: 'Stock transfers' # stockable: 'Manage stocks' @@ -808,18 +785,15 @@ spa: # supplier: 'Supplier' # supplier_account: 'Supplier account' # supplier_accounts: 'Supplier accounts' - # supplier_id: 'Supplier' # suppliers: 'Suppliers' # surface_units: 'Surface units' # suspended: 'Suspended' # symmetric: 'Symmetric' # target: 'Target' - # target_id: 'Target' # target_quantity: 'Target quantity' # target_type: 'Target type' # tax: 'Tax' # tax_declarations: 'Tax declarations' - # tax_id: 'Tax' # taxes: 'Taxes' # temperature: 'Temperature' # template: 'Template' @@ -830,33 +804,29 @@ spa: # to: 'To' # to_archive: 'To archive' # to_bank_on: 'To bank on' + # to_deposit: 'To deposit' # tool: 'Tool' - # tool_id: 'Tool' # tools: 'Tools' # tools_list: 'Tools list' # total_weight: 'Total weight (kg)' # trackable: 'Trackable' # tracking: 'Tracking' - # tracking_id: 'Tracking' # tracking_serial: 'Tracking serial' # trackings: 'Trackings' # transfers: 'Transfers' # transport: 'Transport' # transport_on: 'Transport on' # transporter: 'Transporter' - # transporter_id: 'Transporter' # transporters: 'Transporters' # transports: 'Transports' # undelivered_quantity: 'Undelivered quantity' # unique_tracking: 'Unique tracking' # unit: 'Unit' - # unit_id: 'Unit' # unit_quantity: 'Unit quantity' # units: 'Units' # unquantifiable: 'Unquantifiable' # updated_at: 'Updated at' # updater: 'Updater' - # updater_id: 'Updater' # usable_incoming_payments: 'Usable incoming payments' # usable_outgoing_payments: 'Usable disbursements' # usage: 'Usage' @@ -872,7 +842,6 @@ spa: # virtual: 'Virtual' # virtual_quantity: 'Virtual quantity' # warehouse: 'Warehouse' - # warehouse_id: 'Warehouse' # warehouses: 'Warehouses' # webpass: 'Webpass' # website: 'Website' diff --git a/config/locales/spa/rights.yml b/config/locales/spa/rights.yml index afad2d56c9..8e494eff8a 100644 --- a/config/locales/spa/rights.yml +++ b/config/locales/spa/rights.yml @@ -23,6 +23,7 @@ spa: # mail_to_listings: 'Send mail to lists' # manage_accounts: 'Manage accounts' # manage_areas: 'Manage areas' + # manage_assets: 'Manage assets' # manage_bank_statements: 'Point bank statements' # manage_cash_transfers: 'Manage cash transfers' # manage_cashes: 'Manage cashes' diff --git a/config/menus.yml b/config/menus.yml index 5c049fcf04..8fe5464592 100644 --- a/config/menus.yml +++ b/config/menus.yml @@ -642,6 +642,7 @@ menus: - "sale_natures::create" - "sale_natures::destroy" - "sale_natures::edit" + - "sale_natures::show" - "sale_natures::list" - "sale_natures::new" - "sale_natures::update" diff --git a/config/rights.yml b/config/rights.yml index 8c158c3ecc..c0edad198f 100644 --- a/config/rights.yml +++ b/config/rights.yml @@ -252,7 +252,7 @@ manage_areas: - "areas::new" - "areas::update" - "dashboards::relations" -# (((MANAGE_ASSETS))) +# Manage assets manage_assets: actions: - "assets::create" @@ -851,6 +851,7 @@ manage_sale_natures: - "sale_natures::list" - "sale_natures::new" - "sale_natures::update" + - "sale_natures::show" # Manages sale orders manage_sales: actions: diff --git a/db/migrate/20120320105523_review_financial_models.rb b/db/migrate/20120320105523_review_financial_models.rb new file mode 100644 index 0000000000..4841cfa46c --- /dev/null +++ b/db/migrate/20120320105523_review_financial_models.rb @@ -0,0 +1,46 @@ +class ReviewFinancialModels < ActiveRecord::Migration + def up + add_column :financial_years, :currency_precision, :integer + execute "UPDATE #{quoted_table_name(:financial_years)} SET currency_precision = 2" + + add_column :cashes, :country, :string, :limit=>2 + execute "UPDATE #{quoted_table_name(:cashes)} SET country = 'fr'" + + remove_column :cash_transfers, :currency + remove_column :cash_transfers, :emitter_currency + remove_column :cash_transfers, :receiver_currency + remove_column :cash_transfers, :receiver_currency_rate + rename_column :cash_transfers, :emitter_currency_rate, :currency_rate + + add_column :incoming_payment_modes, :depositables_journal_id, :integer + journals = connection.select_all("SELECT id, journal_id FROM #{quoted_table_name(:cashes)}") + execute "UPDATE #{quoted_table_name(:incoming_payment_modes)} SET depositables_journal_id = CASE "+journals.collect{|r| "WHEN cash_id=#{r['id']} THEN #{r['journal_id']}"}.join(" ")+" END WHERE with_deposit" + + add_column :sale_natures, :with_accounting, :boolean, :null=>false, :default=>false + add_column :sale_natures, :currency, :string, :limit=>3 + add_column :sale_natures, :journal_id, :integer + sales_journals = connection.select_all("SELECT record_value_id AS id, company_id FROM #{quoted_table_name(:preferences)} WHERE name = 'sales_journal' AND record_value_id IS NOT NULL") + execute "UPDATE #{quoted_table_name(:sale_natures)} SET with_accounting = #{quoted_true}, currency ='EUR', journal_id=CASE "+sales_journals.collect{|r| "WHEN company_id=#{r['company_id']} THEN #{r['id']}"}.join(" ")+" END" + sales_journals = connection.select_all("SELECT id, company_id FROM #{quoted_table_name(:journals)} WHERE nature = 'sales' AND currency = 'EUR'") + execute "UPDATE #{quoted_table_name(:sale_natures)} SET journal_id=CASE "+sales_journals.collect{|r| "WHEN company_id=#{r['company_id']} THEN #{r['id']}"}.join(" ")+" END WHERE journal_id IS NULL" + end + + def down + remove_column :sales, :journal_id + remove_column :sales, :currency + remove_column :sales, :with_accounting + + remove_column :incoming_payment_modes, :depositables_journal_id + + rename_column :cash_transfers, :currency_rate, :emitter_currency_rate + add_column :cash_transfers, :receiver_currency_rate, :decimal, :precision=>19, :scale=>10 + add_column :cash_transfers, :receiver_currency, :string, :limit=>3 + add_column :cash_transfers, :emitter_currency, :string, :limit=>3 + add_column :cash_transfers, :currency, :string, :limit=>3 + execute "UPDATE #{quoted_table_name(:cash_transfers)} SET receiver_currency_rate=1, receiver_currency='EUR', emitter_currency='EUR', currency='EUR'" + + remove_column :cashes, :country + + remove_column :financial_years, :currency_precision + end +end diff --git a/db/schema.rb b/db/schema.rb index 7e163f9d0a..527150e35c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120308184507) do +ActiveRecord::Schema.define(:version => 20120320105523) do create_table "account_balances", :force => true do |t| t.integer "account_id", :null => false @@ -170,35 +170,28 @@ add_index "bank_statements", ["updater_id"], :name => "index_bank_account_statements_on_updater_id" create_table "cash_transfers", :force => true do |t| - t.integer "emitter_cash_id", :null => false - t.integer "receiver_cash_id", :null => false + t.integer "emitter_cash_id", :null => false + t.integer "receiver_cash_id", :null => false t.integer "emitter_journal_entry_id" t.datetime "accounted_at" - t.string "number", :null => false + t.string "number", :null => false t.text "comment" - t.decimal "emitter_currency_rate", :precision => 19, :scale => 10, :default => 1.0, :null => false - t.decimal "emitter_amount", :precision => 19, :scale => 4, :default => 0.0, :null => false - t.decimal "receiver_amount", :precision => 19, :scale => 4, :default => 0.0, :null => false - t.integer "company_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.decimal "currency_rate", :precision => 19, :scale => 10, :default => 1.0, :null => false + t.decimal "emitter_amount", :precision => 19, :scale => 4, :default => 0.0, :null => false + t.decimal "receiver_amount", :precision => 19, :scale => 4, :default => 0.0, :null => false + t.integer "company_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "creator_id" t.integer "updater_id" - t.integer "lock_version", :default => 0, :null => false + t.integer "lock_version", :default => 0, :null => false t.integer "receiver_journal_entry_id" - t.decimal "receiver_currency_rate", :precision => 19, :scale => 10 t.date "created_on" - t.string "currency", :limit => 3 - t.string "emitter_currency", :limit => 3 - t.string "receiver_currency", :limit => 3 end add_index "cash_transfers", ["company_id"], :name => "index_cash_transfers_on_company_id" add_index "cash_transfers", ["created_at"], :name => "index_cash_transfers_on_created_at" add_index "cash_transfers", ["creator_id"], :name => "index_cash_transfers_on_creator_id" - add_index "cash_transfers", ["currency"], :name => "index_cash_transfers_on_currency" - add_index "cash_transfers", ["emitter_currency"], :name => "index_cash_transfers_on_emitter_currency" - add_index "cash_transfers", ["receiver_currency"], :name => "index_cash_transfers_on_receiver_currency" add_index "cash_transfers", ["updated_at"], :name => "index_cash_transfers_on_updated_at" add_index "cash_transfers", ["updater_id"], :name => "index_cash_transfers_on_updater_id" @@ -226,6 +219,7 @@ t.string "bank_name", :limit => 50 t.string "nature", :limit => 16, :default => "bank_account", :null => false t.string "currency", :limit => 3 + t.string "country", :limit => 2 end add_index "cashes", ["account_id"], :name => "index_bank_accounts_on_account_id" @@ -775,17 +769,18 @@ add_index "events", ["updater_id"], :name => "index_events_on_updater_id" create_table "financial_years", :force => true do |t| - t.string "code", :limit => 12, :null => false - t.boolean "closed", :default => false, :null => false - t.date "started_on", :null => false - t.date "stopped_on", :null => false - t.integer "company_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.string "code", :limit => 12, :null => false + t.boolean "closed", :default => false, :null => false + t.date "started_on", :null => false + t.date "stopped_on", :null => false + t.integer "company_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "creator_id" t.integer "updater_id" - t.integer "lock_version", :default => 0, :null => false - t.string "currency", :limit => 3 + t.integer "lock_version", :default => 0, :null => false + t.string "currency", :limit => 3 + t.integer "currency_precision" end add_index "financial_years", ["code", "company_id"], :name => "index_financialyears_on_code_and_company_id", :unique => true @@ -891,6 +886,7 @@ t.decimal "commission_base_amount", :precision => 19, :scale => 4, :default => 0.0, :null => false t.integer "commission_account_id" t.integer "position" + t.integer "depositables_journal_id" end add_index "incoming_payment_modes", ["company_id"], :name => "index_payment_modes_on_company_id" @@ -1878,22 +1874,25 @@ add_index "sale_lines", ["updater_id"], :name => "index_sale_order_lines_on_updater_id" create_table "sale_natures", :force => true do |t| - t.string "name", :null => false - t.integer "expiration_id", :null => false - t.boolean "active", :default => true, :null => false - t.integer "payment_delay_id", :null => false - t.boolean "downpayment", :default => false, :null => false - t.decimal "downpayment_minimum", :precision => 19, :scale => 4, :default => 0.0, :null => false - t.decimal "downpayment_rate", :precision => 19, :scale => 10, :default => 0.0, :null => false + t.string "name", :null => false + t.integer "expiration_id", :null => false + t.boolean "active", :default => true, :null => false + t.integer "payment_delay_id", :null => false + t.boolean "downpayment", :default => false, :null => false + t.decimal "downpayment_minimum", :precision => 19, :scale => 4, :default => 0.0, :null => false + t.decimal "downpayment_rate", :precision => 19, :scale => 10, :default => 0.0, :null => false t.text "comment" - t.integer "company_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "company_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "creator_id" t.integer "updater_id" - t.integer "lock_version", :default => 0, :null => false + t.integer "lock_version", :default => 0, :null => false t.integer "payment_mode_id" t.text "payment_mode_complement" + t.boolean "with_accounting", :default => false, :null => false + t.string "currency", :limit => 3 + t.integer "journal_id" end add_index "sale_natures", ["company_id"], :name => "index_sale_order_natures_on_company_id" diff --git a/lib/ekylibre/models.rb b/lib/ekylibre/models.rb index f61fdf0341..3c0d9122a3 100644 --- a/lib/ekylibre/models.rb +++ b/lib/ekylibre/models.rb @@ -247,6 +247,7 @@ module Ekylibre :company_id => :company, :creator_id => :user, :depositables_account_id => :account, + :depositables_journal_id => :journal, :updater_id => :user }, :incoming_payment_use => { @@ -569,6 +570,7 @@ module Ekylibre :company_id => :company, :creator_id => :user, :expiration_id => :delay, + :journal_id => :journal, :payment_delay_id => :delay, :payment_mode_id => :incoming_payment_mode, :updater_id => :user diff --git a/lib/ekylibre/record.rb b/lib/ekylibre/record.rb index 3429223ac3..25d214b5c2 100644 --- a/lib/ekylibre/record.rb +++ b/lib/ekylibre/record.rb @@ -32,6 +32,7 @@ module Record require File.join(dir, 'autosave') require File.join(dir, 'sums') require File.join(dir, 'preference') +require File.join(dir, 'dependents') # require File.join(dir, 'transfer') require File.join(dir, 'acts', 'numbered') require File.join(dir, 'acts', 'reconcilable') diff --git a/lib/ekylibre/record/acts/numbered.rb b/lib/ekylibre/record/acts/numbered.rb index 3df275e202..b068cd0a94 100644 --- a/lib/ekylibre/record/acts/numbered.rb +++ b/lib/ekylibre/record/acts/numbered.rb @@ -22,33 +22,33 @@ def acts_as_numbered(column=:number, options = {}) code = "" - code += "attr_readonly :#{column}\n" unless options[:readonly].is_a? FalseClass + code << "attr_readonly :#{column}\n" unless options[:readonly].is_a? FalseClass - code += "validates_presence_of :#{column}, :if=>lambda{|r| not r.#{column}.blank?}\n" + code << "validates_presence_of :#{column}, :if=>lambda{|r| not r.#{column}.blank?}\n" - code += "validates_uniqueness_of :#{column}, :scope=>:company_id\n" + code << "validates_uniqueness_of :#{column}, :scope=>:company_id\n" - code += "before_validation(:on=>:create) do\n" - code += " if self.company\n" - code += " last = #{last}\n" - code += " self.#{column} = (last.nil? ? #{options[:start].inspect} : last.#{column}.blank? ? #{options[:start].inspect} : last.#{column}.succ)\n" - code += " else\n" + code << "before_validation(:on=>:create) do\n" + code << " if self.company\n" + code << " last = #{last}\n" + code << " self.#{column} = (last.nil? ? #{options[:start].inspect} : last.#{column}.blank? ? #{options[:start].inspect} : last.#{column}.succ)\n" + code << " else\n" max = self.columns_hash[column.to_s].limit||64 - code += " self.#{column} = Time.now.to_i.to_s(36)[0..#{max-1}]\n" - code += " (#{max}-self.#{column}.size).times { self.#{column} += (36*rand).to_i.to_s(36) }\n" - code += " end\n" - code += " return true\n" - code += "end\n" - - code += "after_validation(:on=>:create) do\n" - code += " if sequence = self.company.preferred_#{sequence}\n" - code += " self.#{column} = sequence.next_value\n" - code += " else\n" - code += " last = #{last}\n" - code += " self.#{column} = (last.nil? ? #{options[:start].inspect} : last.#{column}.blank? ? #{options[:start].inspect} : last.#{column}.succ)\n" - code += " end\n" - code += " return true\n" - code += "end\n" + code << " self.#{column} = Time.now.to_i.to_s(36)[0..#{max-1}]\n" + code << " (#{max}-self.#{column}.size).times { self.#{column} += (36*rand).to_i.to_s(36) }\n" + code << " end\n" + code << " return true\n" + code << "end\n" + + code << "after_validation(:on=>:create) do\n" + code << " if sequence = self.company.preferred_#{sequence}\n" + code << " self.#{column} = sequence.next_value\n" + code << " else\n" + code << " last = #{last}\n" + code << " self.#{column} = (last.nil? ? #{options[:start].inspect} : last.#{column}.blank? ? #{options[:start].inspect} : last.#{column}.succ)\n" + code << " end\n" + code << " return true\n" + code << "end\n" # puts code class_eval code end diff --git a/lib/ekylibre/record/acts/protected.rb b/lib/ekylibre/record/acts/protected.rb index 7e5999d8a0..1e2a2513be 100644 --- a/lib/ekylibre/record/acts/protected.rb +++ b/lib/ekylibre/record/acts/protected.rb @@ -7,21 +7,16 @@ def self.included(base) module ClassMethods - def protect_on_update(&block) - define_method :updateable?, &block - class_eval "before_update {|record| record.updateable? }" -# if Rails.version.match(/^2\.3/) -# class_eval "before_update {|record| return false unless record.updateable? }" -# else -# class_eval "before_update { return false unless self.updateable? }" -# end - end - - - - def protect_on_destroy(&block) - define_method :destroyable?, &block - class_eval "before_destroy { |record| record.destroyable? }" + # Blocks update or destroy if necessary + def protect(options={}, &block) + options[:on] = [:update, :destroy] unless options[:on] + options[:on] = [options[:on]] unless options[:on].is_a?(Array) + for callback in options[:on] + method_name = "#{callback}able?".to_sym + raise Exception, "Cannot protect because a method #{method_name} is already defined." if self.respond_to?(method_name) + define_method method_name, &block + class_eval "before_#{callback} {|record| record.#{method_name} }" + end end diff --git a/lib/ekylibre/record/company_record.rb b/lib/ekylibre/record/company_record.rb index d9c8b6fb41..f5cf5afa31 100644 --- a/lib/ekylibre/record/company_record.rb +++ b/lib/ekylibre/record/company_record.rb @@ -25,9 +25,9 @@ class CompanyRecord < Ekylibre::Record::Base def self.inherited(child) super code = "attr_readonly :company_id\n" - code += "belongs_to :company\n" + code << "belongs_to :company\n" # Redundant with clean:validations - # code += "validates_presence_of :company, :company_id" + # code << "validates_presence_of :company, :company_id" child.class_eval code end diff --git a/lib/ekylibre/record/dependents.rb b/lib/ekylibre/record/dependents.rb new file mode 100644 index 0000000000..557c01568d --- /dev/null +++ b/lib/ekylibre/record/dependents.rb @@ -0,0 +1,33 @@ +module Ekylibre::Record #:nodoc: + module Dependents + def self.included(base) + base.send(:include, InstanceMethods) + end + + module InstanceMethods + # Look for all has_one, has_many and has_and_belongs_to_many reflections + def has_dependents? + refs = self.class.reflections.values.select{|r| r.macro.to_s.match(/^has_/)} + return false unless refs.size > 0 + method_name = "has_"+refs.collect{|r| r.name.to_s}.sort.join("_or_")+"?" + unless self.respond_to?(method_name) + code = "" + code << "def #{method_name}\n" + code << " return (" + refs.collect do |r| + if r.macro.to_s == "has_one" + "self.#{r.name}" + else + "self.#{r.name}.first" + end + end.join(" || ") + ")\n" + code << "end\n" + class_eval(code) + end + return self.send(method_name) + end + + end + + end +end +Ekylibre::Record::Base.send(:include, Ekylibre::Record::Dependents) diff --git a/lib/list/renderers/simple_renderer.rb b/lib/list/renderers/simple_renderer.rb index 0a1f4dca06..47a6b94992 100644 --- a/lib/list/renderers/simple_renderer.rb +++ b/lib/list/renderers/simple_renderer.rb @@ -92,13 +92,16 @@ def columns_to_cells(table, nature, options={}) if [:date, :datetime, :timestamp].include? column.datatype datum = "(#{datum}.nil? ? '' : ::I18n.localize(#{datum}))" end - if column.datatype == :decimal and currency = column.options[:currency] + if (currency = column.options[:currency]) # column.datatype == :decimal and currency = currency[nature] if currency.is_a?(Hash) + currency = :currency if currency.is_a?(TrueClass) currency = "RECORD.#{currency}" if currency.is_a?(Symbol) currency.gsub!(/RECORD/, record) - datum = "(#{datum}.nil? ? '' : number_to_money(#{datum}, #{currency}))" + # datum = "(#{datum}.nil? ? '' : number_to_money(#{datum}, #{currency}))" + datum = "(#{datum}.nil? ? '' : I18n.localize(#{datum}, :currency => #{currency}))" elsif column.datatype == :decimal - datum = "(#{datum}.nil? ? '' : number_to_currency(#{datum}, :separator=>',', :delimiter=>' ', :unit=>'', :precision=>#{column.options[:precision]||2}))" + # datum = "(#{datum}.nil? ? '' : number_to_currency(#{datum}, :separator=>',', :delimiter=>' ', :unit=>'', :precision=>#{column.options[:precision]||2})).gsub(//)" + datum = "(#{datum}.nil? ? '' : I18n.localize(#{datum}))" end if column.options[:url].is_a?(TrueClass) and nature==:body datum = "(#{datum}.blank? ? '' : link_to(#{datum}, {:controller=>:#{column.class_name.underscore.pluralize}, :action=>:show, :id=>#{column.record_expr(record)+'.id'}}))" diff --git a/lib/numisma/currency.rb b/lib/numisma/currency.rb index 51493ab2b5..465f8f08f9 100644 --- a/lib/numisma/currency.rb +++ b/lib/numisma/currency.rb @@ -34,6 +34,40 @@ def round(value, options={}) def ==(other_currency) self.code == other_currency.code end + + # Produces a amount of the currency with the locale parameters + # TODO: Find a better way to specify number formats which are more complex that the default Rails use + def localize(amount, options={}) + return unless amount + + options.symbolize_keys! + + defaults = I18n.translate('number.format'.to_sym, :locale => options[:locale], :default => {}) + defaultt = I18n.translate('number.currency.format'.to_sym, :locale => options[:locale], :default => {}) + defaultt[:negative_format] ||= "-" + defaultt[:format] if defaultt[:format] + formatcy = I18n.translate("number.currency.formats.#{self.code}".to_sym, :locale => options[:locale], :default => {}) + formatcy[:negative_format] ||= "-" + formatcy[:format] if formatcy[:format] + + prec = {} + prec[:separator] = formatcy[:separator] || defaultt[:separator] || defaults[:separator] + prec[:delimiter] = formatcy[:delimiter] || defaultt[:delimiter] || defaults[:delimiter] + prec[:precision] = formatcy[:precision] || self.precision || defaultt[:precision] + format = formatcy[:format] || defaultt[:format] || defaults[:format] + negative_format = formatcy[:negative_format] || defaultt[:negative_format] || defaults[:negative_format] || "-" + format + unit = formatcy[:unit] || self.unit || self.code + + if amount.to_f < 0 + format = negative_format # options.delete(:negative_format) + amount = amount.respond_to?("abs") ? amount.abs : amount.sub(/^-/, '') + end + + value = amount.to_s + integers, decimals = value.split(/\./) + decimals = decimals.gsub(/0+$/, '').ljust(prec[:precision], '0').reverse.split(/(?=\d{3})/).reverse.collect{|x| x.reverse}.join(prec[:delimiter]) + value = integers.gsub(/^0+[1-9]+/, '').gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{prec[:delimiter]}") + value += prec[:separator] + decimals unless decimals.blank? + return format.gsub(/%n/, value).gsub(/%u/, unit).gsub(/%s/, "\u{00A0}").html_safe + end end diff --git a/lib/tasks/clean/locales.rb b/lib/tasks/clean/locales.rb index 122bb6968e..86fed708b4 100644 --- a/lib/tasks/clean/locales.rb +++ b/lib/tasks/clean/locales.rb @@ -192,13 +192,16 @@ for column in model.instance_methods attributes[column][1] = :used if attributes[column] end + for column in model.reflections.keys + attributes[column] = [column.to_s.humanize, :undefined] unless attributes[column] + end end end for k, v in models to_translate += 1 # if v[1]!=:unused untranslated += 1 if v[1]==:undefined end - for k, v in attributes + for k, v in attributes.delete_if{|k,v| k.to_s.match(/^\_/)} to_translate += 1 # if v[1]!=:unused untranslated += 1 if v[1]==:undefined end diff --git a/public/themes/tekyla/stylesheets/list.css b/public/themes/tekyla/stylesheets/list.css index afd7e110a2..340f04b571 100644 --- a/public/themes/tekyla/stylesheets/list.css +++ b/public/themes/tekyla/stylesheets/list.css @@ -48,43 +48,21 @@ table.list tfoot .widget { display: block; padding: 2px; } html[dir="ltr"] table.list tfoot .widget { float: left; margin: 0 8px 0 0; } html[dir="rtl"] table.list tfoot .widget { float: right; margin: 0 0 0 8px; } -/* -table.list tfoot .menu { position: relative; background: none; border: none; padding: 4px;} -table.list tfoot .menu a { cursor: pointer; } -table.list tfoot .menu a.start { padding: 4px; } -table.list tfoot .menu ul { display: none; bottom: 22px; padding: 1px; position:absolute; background: Menu; border:1px solid ButtonShadow; z-index: 1000; box-shadow: 0px 0px 4px #999; -moz-box-shadow: 0px 0px 4px #999; -webkit-box-shadow: 0px 0px 4px #999;} -html[dir="ltr"] table.list tfoot .menu ul { left: -1px;} -html[dir="rtl"] table.list tfoot .menu ul { right: -1px;} -table.list tfoot .menu:hover > ul { display: block; } -table.list tfoot .menu ul li { list-style-type: none; color: MenuText; padding: 2px 4px; width: 15em; position: relative;} -table.list tfoot .menu ul li * { color: MenuText;} -table.list tfoot .menu ul li.separator { height: 0; padding:0; margin:0; border-top: 1px solid ButtonHighlight; border-top: 1px solid ButtonShadow; margin: 3px 0 3px;} -table.list tfoot .menu ul li.separator:hover { background: transparent;} -table.list tfoot .menu ul li a { padding: 2px 2px 2px 20px; display: block; } -table.list tfoot .menu ul li ul { display: none; position: absolute; bottom: -1px; } -html[dir="ltr"] table.list tfoot .menu ul li ul { left: 15em; } -html[dir="rtl"] table.list tfoot .menu ul li ul { right: 15em; } -table.list tfoot .menu ul li:hover { background: Highlight; color: HighlightText; } -table.list tfoot .menu ul li:hover > * { color: HighlightText; } -table.list tfoot .menu ul li:hover ul { display:block; } -table.list tfoot .menu ul li ul:hover { display:block; } -*/ - table.list .spe { width: 16px; height: 16px; padding: 0; vertical-align:bottom;} table.list .spe .list-menu { position: relative; background: none; border: none; } table.list .spe .list-menu * { font-weight: normal; } table.list .spe .list-menu a { cursor: pointer; } table.list .spe .list-menu .list-menu-start { display: block; font-size: 0; color: transparent; text-shadow: none; padding: 4px; width: 16px; height: 16px; background: url(../images/buttons/list-start.png) no-repeat center; } -table.list .spe .list-menu:hover .list-menu-start { background-color: Menu; z-index:5000; position: relative; top: 0px; } -table.list .spe .list-menu ul { display: none; position:absolute; top: 22px; padding: 1px; margin:0; background: Menu; border:1px solid ButtonShadow; z-index: 1000; box-shadow: 0 0 4px rgba(0,0,0,0.2); -moz-box-shadow: 0 0 4px rgba(0,0,0,0.2); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.2); behavior: url(/pie.htc); } +table.list .spe .list-menu:hover .list-menu-start { background-color: #F1F1F1; z-index:5000; position: relative; top: 0px; } +table.list .spe .list-menu ul { display: none; position:absolute; top: 22px; padding: 1px; margin:0; background: #F1F1F1; border:1px solid #AAA; z-index: 1000; box-shadow: 0 0 4px rgba(0,0,0,0.2); -moz-box-shadow: 0 0 4px rgba(0,0,0,0.2); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.2); behavior: url(/pie.htc); } html[dir="ltr"] table.list .spe .list-menu ul { right: -1px;} html[dir="rtl"] table.list .spe .list-menu ul { left: -1px;} table.list .spe .list-menu:hover > ul { display: block; } -table.list .spe .list-menu ul li { list-style-type: none; color: MenuText; padding: 2px 4px; width: 190px; position: relative;} -table.list .spe .list-menu ul li * { color: MenuText;} +table.list .spe .list-menu ul li { list-style-type: none; color: #000; padding: 2px 4px; width: 190px; position: relative;} +table.list .spe .list-menu ul li * { color: #000;} table.list .spe .list-menu ul li.parent > a { font-weight: bold; } -table.list .spe .list-menu ul li.separator { height: 0; padding: 0; border-top: 1px solid ButtonHighlight; border-bottom: 1px solid ButtonShadow; margin: 2px auto;} +table.list .spe .list-menu ul li.separator { height: 0; padding: 0; border-top: 1px solid #F1F1F1; border-bottom: 1px solid #AAA; margin: 2px auto;} table.list .spe .list-menu ul li.separator:hover { background: transparent;} table.list .spe .list-menu ul li a { display: block; } html[dir="ltr"] table.list .spe .list-menu ul li a { padding: 2px 2px 2px 20px; } @@ -92,8 +70,8 @@ html[dir="rtl"] table.list .spe .list-menu ul li a { padding: 2px 20px 2px 2px; table.list .spe .list-menu ul li ul { display: none; position: absolute; top: -2px; } html[dir="ltr"] table.list .spe .list-menu ul li ul { right: 198px; } html[dir="rtl"] table.list .spe .list-menu ul li ul { left: 198px; } -table.list .spe .list-menu ul li:hover { background: Highlight; color: HighlightText; } -table.list .spe .list-menu ul li:hover > * { color: HighlightText; } +table.list .spe .list-menu ul li:hover { background: #C9D7F1; color: #000; } +table.list .spe .list-menu ul li:hover > * { color: #000; } table.list .spe .list-menu ul li:hover ul { display:block; } table.list .spe .list-menu ul li ul:hover { display:block; } diff --git a/public/themes/tekyla/stylesheets/screen.css b/public/themes/tekyla/stylesheets/screen.css index e60cfee377..d279cb59c5 100644 --- a/public/themes/tekyla/stylesheets/screen.css +++ b/public/themes/tekyla/stylesheets/screen.css @@ -22,8 +22,8 @@ fieldset nobr { margin: 0 8px; vertical-align: middle; } fieldset .actions { border-left: none; border-right: none; border-bottom: none; margin-top: 8px} td, th, a, p, input, textarea, select, div { font-size:13px;} small, sup, sub { font-size: 11px; } -a:link, a:visited, a:focus { color:#00C; } -a:hover { color: #000; } +a:link, a:visited, a:focus { color:#02C; text-decoration: none; } +a:hover { color: #000; text-decoration: underline;} a.current:link, a.current:visited, a.current:focus { color: #000; text-decoration: none; font-weight: bold} a.current:hover { color: #000; } input[type="submit"] { padding: 1px 4px; } @@ -171,7 +171,7 @@ html[dir="rtl"] div#side { float: right; } html[dir="ltr"] #side .sd-module .sd-title { padding: 4px 4px 4px 12px; } html[dir="rtl"] #side .sd-module .sd-title { padding: 4px 12px 4px 4px; } #side .sd-module .sd-title h2 {} -#side .sd-module .sd-title *[data-toggle-module] { display: block; cursor: pointer; height: 12px; width: 12px; position: relative; top: 2px; background: url(../images/toggle.png);} +#side .sd-module .sd-title *[data-toggle-module] { display: block; cursor: pointer; height: 12px; width: 12px; position: relative; top: 2px; background: url(../images/toggle.png); padding: 0;} html[dir="ltr"] #side .sd-module .sd-title *[data-toggle-module] {float: right} html[dir="rtl"] #side .sd-module .sd-title *[data-toggle-module] {float: left} #side .sd-module .sd-title .show[data-toggle-module] { background-position: 0 0; } @@ -192,27 +192,6 @@ html[dir="rtl"] #side .sd-module .sd-title *[data-toggle-module] {float: left} -/* -#side .module { padding: 0 0 8px; margin: 0; border-top: 1px solid #95b0e4; } -#side .module:first-child { padding-top: 8px; border-top: none; } -#side .module > h2 { padding: 4px 8px; font-size : 13px; color: #012; font-weight: bold; } - -#side .module.help { background: #FAFAFA url(../images/shadow-top.png) repeat-x bottom; } -#side .module.help #help { background: url(../images/shadow-bottom.png) repeat-x top; } - -#side .module.menu ul { padding: 0 20px; margin: 0 5px; } -#side .module.menu ul li { list-style-type: square; } -#side .module.menu ul li a { display: block; padding: 2px 4px; text-decoration: underline; } -#side .module.menu ul li a .path { color: #AAA; font-size: 11px;} - -#side .module.menu.master { background: #F1F1F1; } -#side .module.menu.master ul { padding: 0; margin: 0;} -#side .module.menu.master ul li { display: block; list-style-type: none; } -#side .module.menu.master ul li a { text-decoration: none; padding: 4px 12px; color: #222; } -#side .module.menu.master ul li a:hover {background: #C9D7F1; border-left: 4px solid #95b0e4; padding-left: 8px;} -#side .module.menu.master ul li a.current {background: #95b0e4; color: white; text-shadow: 0 0 2px #3D5C8D;} -*/ - .main { padding: 8px; overflow: auto; overflow-y: scroll; /*#F7F7FF*/; } /* border-left: 4px solid #95b0e4; border-right: none; border-top: none;*/ .main h1 { margin: 0px 0px 8px; font-size:20px; color: #047; font-weight: bold; } .main .subheading { margin: -4px 0 8px; font-size:18px; color: #AAA; font-weight: normal; font-style: italic; } diff --git a/test/fixtures/cash_transfers.yml b/test/fixtures/cash_transfers.yml index 76356f075c..a2799f41ef 100644 --- a/test/fixtures/cash_transfers.yml +++ b/test/fixtures/cash_transfers.yml @@ -26,19 +26,15 @@ # created_at :datetime not null # created_on :date # creator_id :integer -# currency :string(3) +# currency_rate :decimal(19, 10) default(1.0), not null # emitter_amount :decimal(19, 4) default(0.0), not null # emitter_cash_id :integer not null -# emitter_currency :string(3) -# emitter_currency_rate :decimal(19, 10) default(1.0), not null # emitter_journal_entry_id :integer # id :integer not null, primary key # lock_version :integer default(0), not null # number :string(255) not null # receiver_amount :decimal(19, 4) default(0.0), not null # receiver_cash_id :integer not null -# receiver_currency :string(3) -# receiver_currency_rate :decimal(19, 10) # receiver_journal_entry_id :integer # updated_at :datetime not null # updater_id :integer @@ -50,9 +46,9 @@ # company_id: 1 # created_at: 2009-07-19 19:13:59 +02:00 # creator_id: 1 +# currency_rate: 0 # emitter_amount: 0 # emitter_cash_id: 1 -# emitter_currency_rate: 0 # id: 1 # number: "Lorem ipsum" # receiver_amount: 0 diff --git a/test/fixtures/cashes.yml b/test/fixtures/cashes.yml index 162fcb8af8..1ecc45de9b 100644 --- a/test/fixtures/cashes.yml +++ b/test/fixtures/cashes.yml @@ -28,6 +28,7 @@ # bic :string(16) # by_default :boolean not null # company_id :integer not null +# country :string(2) # created_at :datetime not null # creator_id :integer # currency :string(3) diff --git a/test/fixtures/documents.yml b/test/fixtures/documents.yml index 81cb364cfe..c3c068dcb7 100644 --- a/test/fixtures/documents.yml +++ b/test/fixtures/documents.yml @@ -25,18 +25,18 @@ # creator_id :integer # crypt_key :binary # crypt_mode :string(255) not null -# extension :string(255) +# extension :string(255) not null # filename :string(255) # filesize :integer # id :integer not null, primary key # lock_version :integer default(0), not null # nature_code :string(255) # original_name :string(255) not null -# owner_id :integer -# owner_type :string(255) +# owner_id :integer not null +# owner_type :string(255) not null # printed_at :datetime # sha256 :string(255) not null -# subdir :string(255) +# subdir :string(255) not null # template_id :integer # updated_at :datetime not null # updater_id :integer @@ -49,9 +49,13 @@ # created_at: 2009-07-19 19:13:59 +02:00 # creator_id: 1 # crypt_mode: "Lorem ipsum" +# extension: "Lorem ipsum" # id: 1 # original_name: "Lorem ipsum" +# owner_id: 1 +# owner_type: "Lorem ipsum" # sha256: "Lorem ipsum" +# subdir: "Lorem ipsum" # updated_at: 2009-07-19 19:13:59 +02:00 # updater_id: 1 # diff --git a/test/fixtures/financial_years.yml b/test/fixtures/financial_years.yml index aef7346f70..2fe616cbc5 100644 --- a/test/fixtures/financial_years.yml +++ b/test/fixtures/financial_years.yml @@ -20,18 +20,19 @@ # # == Table: financial_years # -# closed :boolean not null -# code :string(12) not null -# company_id :integer not null -# created_at :datetime not null -# creator_id :integer -# currency :string(3) -# id :integer not null, primary key -# lock_version :integer default(0), not null -# started_on :date not null -# stopped_on :date not null -# updated_at :datetime not null -# updater_id :integer +# closed :boolean not null +# code :string(12) not null +# company_id :integer not null +# created_at :datetime not null +# creator_id :integer +# currency :string(3) +# currency_precision :integer +# id :integer not null, primary key +# lock_version :integer default(0), not null +# started_on :date not null +# stopped_on :date not null +# updated_at :datetime not null +# updater_id :integer # # # == Fixture: financial_years diff --git a/test/fixtures/incoming_payment_modes.yml b/test/fixtures/incoming_payment_modes.yml index 2645b55429..76d9c24c36 100644 --- a/test/fixtures/incoming_payment_modes.yml +++ b/test/fixtures/incoming_payment_modes.yml @@ -28,6 +28,7 @@ # created_at :datetime not null # creator_id :integer # depositables_account_id :integer +# depositables_journal_id :integer # id :integer not null, primary key # lock_version :integer default(0), not null # name :string(50) not null diff --git a/test/fixtures/sale_natures.yml b/test/fixtures/sale_natures.yml index 57e58dc59b..5d2e435955 100644 --- a/test/fixtures/sale_natures.yml +++ b/test/fixtures/sale_natures.yml @@ -25,11 +25,13 @@ # company_id :integer not null # created_at :datetime not null # creator_id :integer +# currency :string(3) # downpayment :boolean not null # downpayment_minimum :decimal(19, 4) default(0.0), not null # downpayment_rate :decimal(19, 10) default(0.0), not null # expiration_id :integer not null # id :integer not null, primary key +# journal_id :integer # lock_version :integer default(0), not null # name :string(255) not null # payment_delay_id :integer not null @@ -37,6 +39,7 @@ # payment_mode_id :integer # updated_at :datetime not null # updater_id :integer +# with_accounting :boolean not null # # # == Fixture: sale_natures @@ -55,6 +58,7 @@ # payment_delay_id: 1 # updated_at: 2009-07-19 19:13:59 +02:00 # updater_id: 1 +# with_accounting: true # sale_natures_001: active: true diff --git a/test/fixtures/subscriptions.yml b/test/fixtures/subscriptions.yml index 60b41ae059..abb5d0adbc 100644 --- a/test/fixtures/subscriptions.yml +++ b/test/fixtures/subscriptions.yml @@ -20,6 +20,7 @@ # # == Table: subscriptions # +# _activation :string(255) # comment :text # company_id :integer not null # contact_id :integer diff --git a/test/unit/cash_test.rb b/test/unit/cash_test.rb index 4e15db2a90..ea57e4687d 100644 --- a/test/unit/cash_test.rb +++ b/test/unit/cash_test.rb @@ -28,6 +28,7 @@ # bic :string(16) # by_default :boolean not null # company_id :integer not null +# country :string(2) # created_at :datetime not null # creator_id :integer # currency :string(3) diff --git a/test/unit/cash_transfer_test.rb b/test/unit/cash_transfer_test.rb index 0b01da8b9c..b2b371ceb1 100644 --- a/test/unit/cash_transfer_test.rb +++ b/test/unit/cash_transfer_test.rb @@ -26,19 +26,15 @@ # created_at :datetime not null # created_on :date # creator_id :integer -# currency :string(3) +# currency_rate :decimal(19, 10) default(1.0), not null # emitter_amount :decimal(19, 4) default(0.0), not null # emitter_cash_id :integer not null -# emitter_currency :string(3) -# emitter_currency_rate :decimal(19, 10) default(1.0), not null # emitter_journal_entry_id :integer # id :integer not null, primary key # lock_version :integer default(0), not null # number :string(255) not null # receiver_amount :decimal(19, 4) default(0.0), not null # receiver_cash_id :integer not null -# receiver_currency :string(3) -# receiver_currency_rate :decimal(19, 10) # receiver_journal_entry_id :integer # updated_at :datetime not null # updater_id :integer diff --git a/test/unit/document_test.rb b/test/unit/document_test.rb index dd352b3255..232e592c72 100644 --- a/test/unit/document_test.rb +++ b/test/unit/document_test.rb @@ -25,18 +25,18 @@ # creator_id :integer # crypt_key :binary # crypt_mode :string(255) not null -# extension :string(255) +# extension :string(255) not null # filename :string(255) # filesize :integer # id :integer not null, primary key # lock_version :integer default(0), not null # nature_code :string(255) # original_name :string(255) not null -# owner_id :integer -# owner_type :string(255) +# owner_id :integer not null +# owner_type :string(255) not null # printed_at :datetime # sha256 :string(255) not null -# subdir :string(255) +# subdir :string(255) not null # template_id :integer # updated_at :datetime not null # updater_id :integer diff --git a/test/unit/financial_year_test.rb b/test/unit/financial_year_test.rb index dccc35472d..463d80c0ff 100644 --- a/test/unit/financial_year_test.rb +++ b/test/unit/financial_year_test.rb @@ -20,18 +20,19 @@ # # == Table: financial_years # -# closed :boolean not null -# code :string(12) not null -# company_id :integer not null -# created_at :datetime not null -# creator_id :integer -# currency :string(3) -# id :integer not null, primary key -# lock_version :integer default(0), not null -# started_on :date not null -# stopped_on :date not null -# updated_at :datetime not null -# updater_id :integer +# closed :boolean not null +# code :string(12) not null +# company_id :integer not null +# created_at :datetime not null +# creator_id :integer +# currency :string(3) +# currency_precision :integer +# id :integer not null, primary key +# lock_version :integer default(0), not null +# started_on :date not null +# stopped_on :date not null +# updated_at :datetime not null +# updater_id :integer # diff --git a/test/unit/incoming_payment_mode_test.rb b/test/unit/incoming_payment_mode_test.rb index de417d5015..04b5136a6f 100644 --- a/test/unit/incoming_payment_mode_test.rb +++ b/test/unit/incoming_payment_mode_test.rb @@ -28,6 +28,7 @@ # created_at :datetime not null # creator_id :integer # depositables_account_id :integer +# depositables_journal_id :integer # id :integer not null, primary key # lock_version :integer default(0), not null # name :string(50) not null diff --git a/test/unit/sale_nature_test.rb b/test/unit/sale_nature_test.rb index 5d00b1d827..cf5fc9619e 100644 --- a/test/unit/sale_nature_test.rb +++ b/test/unit/sale_nature_test.rb @@ -25,11 +25,13 @@ # company_id :integer not null # created_at :datetime not null # creator_id :integer +# currency :string(3) # downpayment :boolean not null # downpayment_minimum :decimal(19, 4) default(0.0), not null # downpayment_rate :decimal(19, 10) default(0.0), not null # expiration_id :integer not null # id :integer not null, primary key +# journal_id :integer # lock_version :integer default(0), not null # name :string(255) not null # payment_delay_id :integer not null @@ -37,6 +39,7 @@ # payment_mode_id :integer # updated_at :datetime not null # updater_id :integer +# with_accounting :boolean not null # diff --git a/test/unit/subscription_test.rb b/test/unit/subscription_test.rb index 376e515f60..e2f2b74ff5 100644 --- a/test/unit/subscription_test.rb +++ b/test/unit/subscription_test.rb @@ -20,6 +20,7 @@ # # == Table: subscriptions # +# _activation :string(255) # comment :text # company_id :integer not null # contact_id :integer