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

[FIX] point_of_sale: pass noupdate True for pos load demo data #162080

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from

Conversation

atp-odoo
Copy link
Contributor

when database uploaded without demo data and there is no any valid pos product in point of sale, and customer used load demo data from point of sale frontend screen, then it will create demo record from this file which was actually defined in point_of_sale/data/point_of_sale_onboarding_main_config.xml with noupdate= False.

but as this xmlids has been created from python file using load samples, it was noupdate=False.

so during upgrade as there was no demo file loaded, and this entry are with noupdate='f' ORM try to remove those recod , pos session too.
in _process_end during upgrade from 17.0 to
saas-17.1, and which was create issues as
that pos session linked with account bank statement lines which was linked to journal entry so it will try remove journal entries which was partially reconciled.
so we need to set noupdate=True in file:
point_of_sale/data/point_of_sale_onboarding_main_config.xml
and also in python function _load_onboarding_data

see:

convert.convert_file(self.env, 'point_of_sale', 'data/point_of_sale_onboarding.xml', None, mode='init', kind='data')

 File "/home/odoo/src/odoo/saas-17.1/odoo/addons/base/models/ir_model.py", line 2561, in _process_end
    self._process_end_unlink_record(record)
  File "/home/odoo/src/odoo/saas-17.1/odoo/addons/base/models/ir_model.py", line 2490, in _process_end_unlink_record
    record.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/point_of_sale/models/pos_session.py", line 517, in unlink
    self.statement_line_ids.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_bank_statement_line.py", line 395, in unlink
    moves.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/sale/models/account_move.py", line 30, in unlink
    res = super(AccountMove, self).unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_move.py", line 2770, in unlink
    self.line_ids.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_move_line.py", line 1672, in unlink
    self._check_reconciliation()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_move_line.py", line 1322, in _check_reconciliation
    raise UserError(_("You cannot do this modification on a reconciled journal entry. "
odoo.exceptions.UserError: No puede hacer esta modificación en un asiento conciliado. Puede cambiar algunos campos no legales, o romper antes la conciliación.
Asiento (id): CSH1/2024/00002 (5)

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

when database uploaded without demo data and there is no
any valid pos product in point of sale, and customer used
load demo data from point of sale frontend screen, then
it will create demo record from this file which was actually defined in point_of_sale/data/point_of_sale_onboarding_main_config.xml
with noupdate= False.

but as this xmlids has been created from python file using load samples, it was noupdate=False.

so during upgrade as there was no demo file loaded, and this entry are with noupdate='f'
ORM try to remove those recod , pos session too.
in _process_end during upgrade from 17.0 to
saas-17.1, and which was create issues as
that pos session linked with account bank statement lines which was
linked to journal entry so it will try remove journal entries which
was partially reconciled.
so we need to set noupdate=True in file:
point_of_sale/data/point_of_sale_onboarding_main_config.xml
 and also in python function `_load_onboarding_data`

see:
https://github.com/odoo/odoo/blob/1648ee1abff1ae12b3933baa85a2e048fa2eb557/addons/point_of_sale/models/pos_session.py#L2247

```
 File "/home/odoo/src/odoo/saas-17.1/odoo/addons/base/models/ir_model.py", line 2561, in _process_end
    self._process_end_unlink_record(record)
  File "/home/odoo/src/odoo/saas-17.1/odoo/addons/base/models/ir_model.py", line 2490, in _process_end_unlink_record
    record.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/point_of_sale/models/pos_session.py", line 517, in unlink
    self.statement_line_ids.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_bank_statement_line.py", line 395, in unlink
    moves.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/sale/models/account_move.py", line 30, in unlink
    res = super(AccountMove, self).unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_move.py", line 2770, in unlink
    self.line_ids.unlink()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_move_line.py", line 1672, in unlink
    self._check_reconciliation()
  File "/home/odoo/src/odoo/saas-17.1/addons/account/models/account_move_line.py", line 1322, in _check_reconciliation
    raise UserError(_("You cannot do this modification on a reconciled journal entry. "
odoo.exceptions.UserError: No puede hacer esta modificación en un asiento conciliado. Puede cambiar algunos campos no legales, o romper antes la conciliación.
Asiento (id): CSH1/2024/00002 (5)
```
@robodoo
Copy link
Contributor

robodoo commented Apr 16, 2024

@C3POdoo C3POdoo requested review from a team and caburj and removed request for a team April 16, 2024 13:52
@C3POdoo C3POdoo added the RD research & development, internal work label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants