Issues with Salary Line Items
silvermind opened this issue · 3 comments
hi @huerlisi I've ran into an issue with the salary system in the current bookyt version, which is critical for now, as we need to pay salaries tomorrow ;)). When I add a new Salary. it can't be saved, no error is shows. What is maybe related is: When I add a new "Position" to the new salary form I get a server side error:
NoMethodError in SalariesController#new_line_item
undefined methodcredit_account' for #<Class:0x007fd9c50d2a40> app/controllers/invoices_controller.rb:29:in
new_line_item'
In the InvoiceController https://github.com/huerlisi/bookyt/blob/master/app/controllers/invoices_controller.rb#L29 the Class is used (should be a Salary with Invoice Type), the Code itself has a default_credit_account and default_debit_account method, but not credit_account method
https://github.com/huerlisi/bookyt_salary/blob/master/app/models/salary.rb
It seems the code have not been changed in recent times.. do you have an idea?
After an in depth analysis I found and solved these issues:
- The Salary can't be saved, as the SaldoLineItems can't be saved (times in now a required field, which should only be validate for non SaldoLineItems)
https://github.com/huerlisi/bookyt/blob/master/app/models/line_item.rb#L15
introduced with this change: (and others)
597f4e7
fixed with this commit: (please cherry pick if you like it)
silvermind@8376c45
- The "new position" on a uncreated salary is broken, due to invalid method names in the salary model:
96ea808
fixed with this commit in the salary gem (will send a pull request): silvermind/bookyt_salary@cd23a0b
- just FYI: before fixing the errors above, sometime when a validation error is thrown (e.g. times no defined, the saldo line items where converted to a normal line item ...) I've skipped this bug, as I can no longer reproduce the validations problems.)
over & out, btw still a great code base 👍
@silvermind very nice, thanks for the fix! Will take a look and integrate.
I think this issue has been fixes. Thx for the hints!