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

Invalid operation when creating a new Country Office #455

Open
adriancris opened this issue Jun 11, 2024 · 2 comments · May be fixed by OpenG2P/openg2p-registry#150
Open

Invalid operation when creating a new Country Office #455

adriancris opened this issue Jun 11, 2024 · 2 comments · May be fixed by OpenG2P/openg2p-registry#150
Assignees

Comments

@adriancris
Copy link

adriancris commented Jun 11, 2024

Instance:
ACF-DEV

Steps to reproduce:

  1. Navigate to Registry > Configuration > Country Office.
  2. Click New then provide a Country Office Name.
  3. Click Save manually.

Actual Behavior:
Error after clicking Save manually.

Expected Behavior:
Should be able to create a new Country Office

Screenshot:
Image

@reichie020212
Copy link
Member

reichie020212 commented Jul 9, 2024

below are Red's findings:

  • "stock" is having an error upon installation if "g2p_registry_base" is install and there are more than 1 company
  • Error in the screenshot occured if "stock" and "g2p_registry_base" are installed.
  • The cause of error is because of the company_id field in the file g2p_registry_base/models/registrant.py changing it's parameters to required=True and adding a default value. check below code
company_id = fields.Many2one("res.company", required=True, default=lambda self: self.env.company)
  • originaly, company_id of res.partner is not required and doesn't have a default value. check below code
company_id = fields.Many2one('res.company', 'Company', index=True)
  • this error shows because of a company checker function that will only execute if the model's attribute _check_company_auto is set to True
  • "stock.warehouse" model's _check_company_auto is set to True that's why _check_company function of base Model is executing.
  • _check_company checks if the res.company of a res.partner is the same as the res.company of the record that is being updated/created or if the res.company is False.
  • because of the default value that was added in the company_id field, _check_company is raising an error since it is neither the same company of the record nor it is blank.

@reichie020212
Copy link
Member

@dasunhegoda @jeremi @gonzalesedwin1123 , above is my findings on this issue, i just have a question. Should we be the one to fix this issue or should it be the OpenG2P people?

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 a pull request may close this issue.

2 participants