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

[REF] 8.0 mgmtsystem hazard #28

Merged
merged 1 commit into from
Nov 3, 2015

Conversation

llacroix
Copy link

Changed nothing and it seems to work

Depends on:

@coveralls
Copy link

Coverage Status

Coverage decreased (-20.93%) when pulling 3e6d26c on savoirfairelinux:8.0-mgmtsystem_hazard into d10997c on OCA:8.0.

@bwrsandman
Copy link

Needs tests

@bwrsandman bwrsandman added this to the 8.0 milestone Nov 24, 2014
@llacroix
Copy link
Author

Ok going to add tests

@max3903 max3903 mentioned this pull request Feb 14, 2015
26 tasks
@coveralls
Copy link

Coverage Status

Coverage decreased (-11.75%) to 85.93% when pulling 1a043d0 on savoirfairelinux:8.0-mgmtsystem_hazard into fba5b14 on OCA:8.0.

@llacroix llacroix mentioned this pull request Apr 1, 2015
4 tasks
@llacroix
Copy link
Author

llacroix commented Apr 1, 2015

The problem in this PR is that it tries to set a field as required on res_company without setting a default value during an alter table. Existing records will trigger a constraint error.

2015-04-01 10:12:24,162 16655 INFO 2925915-28-1a043d-all openerp.modules.module: module mgmtsystem_hazard: creating or updating database tables
2015-04-01 10:12:29,983 16655 ERROR 2925915-28-1a043d-all openerp.sql_db: bad query: ALTER TABLE "res_company" ALTER COLUMN "risk_computation_id" SET NOT NULL
Traceback (most recent call last):
      File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/2925915-28-1a043d/openerp/sql_db.py", line 234, in execute
res = self._obj.execute(query, params)
IntegrityError: column "risk_computation_id" contains null values

2015-04-01 10:12:29,985 16655 WARNING 2925915-28-1a043d-all openerp.models: WARNING: unable to set column risk_computation_id of table res_company not null !
Try to re-run: openerp-server --update=module
If it doesn't work, update records and execute manually:
ALTER TABLE res_company ALTER COLUMN risk_computation_id SET NOT NULL
Traceback (most recent call last):
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/2925915-28-1a043d/openerp/models.py", line 2643, in _auto_init
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k))
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/2925915-28-1a043d/openerp/sql_db.py", line 158, in wrapper
return f(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/2925915-28-1a043d/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
IntegrityError: column "risk_computation_id" contains null values

We have to decide between adding a default value and keeping it required=True, or set it required=False and update some views with require on certain states.

@max3903
Copy link
Member

max3903 commented Apr 1, 2015

You can set A * B * C as the default value and add this configuration step in the README.rst

@coveralls
Copy link

Coverage Status

Coverage decreased (-6.35%) to 93.65% when pulling d61687d on savoirfairelinux:8.0-mgmtsystem_hazard into 49cc23b on OCA:8.0.

@bwrsandman
Copy link

Needs test for:

  • mgmtsystem_hazard_risk/models/res_company.py risk_computation_id
  • mgmtsystem_hazard_risk/models/mgmtsystem_hazard.py risk
  • mgmtsystem_hazard_risk/models/mgmtsystem_hazard_residual_risk.py risk

@ghost
Copy link

ghost commented Jun 2, 2015

@max3903 @bwrsandman It seems that these modules are not multi-system at all and the multi-company seems incomplete. I think that most models should have both a system_id field and a company_id field (related to the company of the system). For example, the risk formula is taken from the user's company. It would make more sence to take it from the system related to the mgmtsystem.hazard record.

@max3903
Copy link
Member

max3903 commented Jun 3, 2015

@dufresnedavid Very true, but this is the lowest priority.

@max3903
Copy link
Member

max3903 commented Sep 19, 2015

👍

"website": "http://www.savoirfairelinux.com",
"license": "AGPL-3",
"category": "Management System",
"description": """\
Copy link
Member

Choose a reason for hiding this comment

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

Description must go in README.rst

_name = "mgmtsystem.hazard"
_description = __doc__

name = fields.Char('Name', size=50, required=True, translate=True)
Copy link
Member

Choose a reason for hiding this comment

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

Size shouldn't be specified

@yvaucher
Copy link
Member

yvaucher commented Oct 9, 2015

just few remarks otherwise 👍 (code review + french translations)

@dreispt
Copy link
Member

dreispt commented Oct 10, 2015

Multi-system and multi-company support should be mentioned in the Roadmap section, then.

@max3903 max3903 force-pushed the 8.0-mgmtsystem_hazard branch 2 times, most recently from f85cf28 to 6732070 Compare October 10, 2015 18:45

name = fields.Char(
'Control Measure',
size=50,
Copy link
Member

Choose a reason for hiding this comment

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

drop size

@dreispt
Copy link
Member

dreispt commented Oct 30, 2015

Build green, two approvals, remarks fixed - I would merge but it needs a rebase!

max3903 pushed a commit that referenced this pull request Nov 3, 2015
@max3903 max3903 merged commit 35a994d into OCA:8.0 Nov 3, 2015
@max3903 max3903 deleted the 8.0-mgmtsystem_hazard branch November 3, 2015 19:04
tschanzt pushed a commit to camptocamp/management-system that referenced this pull request Jun 26, 2019
BSCOS-109 Fix filters and search methods
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.

6 participants