Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16.0 mig hr expense advance clearing #191

Closed

Conversation

jumeldi74
Copy link

No description provided.

kittiu and others added 30 commits June 26, 2023 10:00
[UPD] Update hr_expense_advance_clearing.pot

[UPD] README.rst
Fix install error when there are already some expense in system.

[UPD] README.rst

hr_expense_advance_clearing 12.0.1.0.1
We should prevent setting the analytic account in expenses used as
employees advance. Otherwise, it can lead to errors charging against an
analytic account that later won't be compensated when all is reconcile.
Anyway, the advance is not an expense, but money of the company moving
from one place to another, that later will be used for real expenses
that will be imputed to the corresponding analytic account
@Saran440
Copy link
Member

@jumeldi74 Thank you for your help migrate to v16
but expense in core odoo v16 has change big process.

version < 16, it will create journal entry when post journal entries at expense
version 16, it will create bills when post journal entries at expense

So, it must change code in this module for reconciled and matching.
We will migrate this module ASAP.

@jumeldi74
Copy link
Author

@jumeldi74 Thank you for your help migrate to v16 but expense in core odoo v16 has change big process.

version < 16, it will create journal entry when post journal entries at expense version 16, it will create bills when post journal entries at expense

So, it must change code in this module for reconciled and matching. We will migrate this module ASAP.

Noted Sir. Thank you

@jumeldi74
Copy link
Author

hi @Saran440 , allow me to try to migrate this module, need your review / feedback. We are planning to migrate and add other features in OCA env, this is the prelimenary effort, thanks

@LFPSGS
Copy link

LFPSGS commented Sep 11, 2023

Hi @Saran440 and @jumeldi74

I wanted to thank you both for your efforts and ask if you could give any hints about a timeline to migrate this module to v16?

Best Regards,
Luiz Fernando


# self = self.with_context(**clean_context(self.env.context)) # remove default_*
if self.advance_sheet_id and self.payment_mode == "own_account":
moves = res[self.id]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
moves = res[self.id]

# self = self.with_context(**clean_context(self.env.context)) # remove default_*
if self.advance_sheet_id and self.payment_mode == "own_account":
moves = res[self.id]
counter_line = moves.line_ids.filtered(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
counter_line = moves.line_ids.filtered(
counter_line = res.line_ids.filtered(

@Saran440
Copy link
Member

@jumeldi74 Functional Test. I found bug

  1. Create advance > submit > approve > post journal entries. state move to done it should move to state "Posted"
    Selection_005

  2. Create advance with "Clearing Product" > submit > approve > post journal entries > register payment > clear advance. it will error

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/custom/src/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1611, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1815, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 697, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 42, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 461, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 448, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/models.py", line 6531, in onchange
    record._onchange_eval(name, field_onchange[name], result)
  File "/opt/odoo/custom/src/odoo/odoo/models.py", line 6242, in _onchange_eval
    method_res = method(self)
  File "/opt/odoo/auto/addons/hr_expense_advance_clearing/models/hr_expense_sheet.py", line 153, in _onchange_advance_sheet_id
    self.expense_line_ids += self.create_clearing_expense_line(line)
  File "/opt/odoo/auto/addons/hr_expense_advance_clearing/models/hr_expense_sheet.py", line 143, in create_clearing_expense_line
    clear_advance = self._prepare_clear_advance(line)
  File "/opt/odoo/auto/addons/hr_expense_advance_clearing/models/hr_expense_sheet.py", line 169, in _prepare_clear_advance
    clear_line._compute_from_product_id_company_id()  # Set some vals
AttributeError: 'hr.expense' object has no attribute '_compute_from_product_id_company_id'

The above server error caused the following client error:
null
  1. case clearing > advance
    Example.
    Advance 100$, Clearing 130$
    Clearing can post journal entries but can't register payment.
    Selection_006

@Saran440
Copy link
Member

Move to #203

@Saran440 Saran440 closed this Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants