{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/vertical-medical/pulls/comments/40887676","id":40887676,"diff_hunk":"@@ -20,38 +20,33 @@\n #\n # #############################################################################\n \n-from openerp.osv import fields, orm\n+from openerp import api, fields, models\n+from openerp.exceptions import ValidationError\n \n \n-class MedicalPathology(orm.Model):\n+class MedicalPathology(models.Model):\n     _name = 'medical.pathology'\n+    _description = 'Medical Pathology'\n \n-    _columns = {\n-        'category': fields.many2one('medical.pathology.category',\n-                                    string='Main Category',\n-                                    help='Select the main category for this '\n-                                         'disease This is usually associated '\n-                                         'to the standard. For instance, the '\n-                                         'chapter on the ICD-10 '\n-                                         'will be the main category for the '\n-                                         'disease'),\n-        'info': fields.text(string='Extra Info'),\n-        'code': fields.char(size=256, string='Code', required=True,\n-                            help='Specific Code for the Disease (eg, ICD-10)'),\n-        'name': fields.char(size=256, string='Name', required=True,\n-                            translate=True, help='Disease name'),\n-        'groups': fields.one2many('medical.disease_group.members',\n-                                  'disease_group_id', string='Groups',\n-                                  help='Specify the groups this pathology '\n-                                       'belongs. Some automated processes act '\n-                                       'upon the code of the group'),\n-        'protein': fields.char(size=256, string='Protein involved',\n-                               help='Name of the protein(s) affected'),\n-        'gene': fields.char(size=256, string='Gene'),\n-        'chromosome': fields.char(size=256, string='Affected Chromosome',\n-                                  help='chromosome number'),\n-    }\n+    @api.one\n+    @api.constrains('code')\n+    def _check_unicity_name(self):\n+        domain = [\n+            ('code', '=', self.code),\n+        ]\n+        if len(self.search(domain)) > 1:\n+            raise ValidationError('\"code\" Should be unique per Pathology')\n \n-#    _sql_constraints = [\n-#        ('name_uniq', 'UNIQUE(name)', 'Name must be unique!'),\n-#    ]\n+    name = fields.Char(required=True, translate=True)\n+    code = fields.Char(required=True)\n+    notes = fields.Text()","path":"medical_emr/models/medical_pathology.py","position":53,"original_position":53,"commit_id":"ad6f8214c90651c630eeb6404aa51289f7022edd","original_commit_id":"ad6f8214c90651c630eeb6404aa51289f7022edd","user":{"login":"lmignon","id":544090,"avatar_url":"https://avatars.githubusercontent.com/u/544090?v=3","gravatar_id":"","url":"https://api.github.com/users/lmignon","html_url":"https://github.com/lmignon","followers_url":"https://api.github.com/users/lmignon/followers","following_url":"https://api.github.com/users/lmignon/following{/other_user}","gists_url":"https://api.github.com/users/lmignon/gists{/gist_id}","starred_url":"https://api.github.com/users/lmignon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmignon/subscriptions","organizations_url":"https://api.github.com/users/lmignon/orgs","repos_url":"https://api.github.com/users/lmignon/repos","events_url":"https://api.github.com/users/lmignon/events{/privacy}","received_events_url":"https://api.github.com/users/lmignon/received_events","type":"User","site_admin":false},"body":"If the name is translatable, the notes should be translatable.","created_at":"2015-10-01T08:02:53Z","updated_at":"2015-10-01T08:02:53Z","html_url":"https://github.com/OCA/vertical-medical/pull/31#discussion_r40887676","pull_request_url":"https://api.github.com/repos/OCA/vertical-medical/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/OCA/vertical-medical/pulls/comments/40887676"},"html":{"href":"https://github.com/OCA/vertical-medical/pull/31#discussion_r40887676"},"pull_request":{"href":"https://api.github.com/repos/OCA/vertical-medical/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/vertical-medical/pulls/31","id":42671421,"html_url":"https://github.com/OCA/vertical-medical/pull/31","diff_url":"https://github.com/OCA/vertical-medical/pull/31.diff","patch_url":"https://github.com/OCA/vertical-medical/pull/31.patch","issue_url":"https://api.github.com/repos/OCA/vertical-medical/issues/31","number":31,"state":"open","locked":false,"title":"[8.0] Improve Disease","user":{"login":"JonathanNEMRY","id":7601731,"avatar_url":"https://avatars.githubusercontent.com/u/7601731?v=3","gravatar_id":"","url":"https://api.github.com/users/JonathanNEMRY","html_url":"https://github.com/JonathanNEMRY","followers_url":"https://api.github.com/users/JonathanNEMRY/followers","following_url":"https://api.github.com/users/JonathanNEMRY/following{/other_user}","gists_url":"https://api.github.com/users/JonathanNEMRY/gists{/gist_id}","starred_url":"https://api.github.com/users/JonathanNEMRY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonathanNEMRY/subscriptions","organizations_url":"https://api.github.com/users/JonathanNEMRY/orgs","repos_url":"https://api.github.com/users/JonathanNEMRY/repos","events_url":"https://api.github.com/users/JonathanNEMRY/events{/privacy}","received_events_url":"https://api.github.com/users/JonathanNEMRY/received_events","type":"User","site_admin":false},"body":"This PR depends on #27\r\n* [x] Improvement of views disease and pathology objects\r\n* [x] Migration of disease and pathology into new api\r\n* [x] Include a button form patient to access its diseases\r\n* [x] Manage inactivation on patient: inactive linked diseases (and set dod)\r\n* [x] Computed name on disease based on pathology and short comment\r\n* [x] Add automatic tests","created_at":"2015-08-18T08:07:47Z","updated_at":"2015-10-01T08:02:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97ecd31dc1e8b53582674e23039f6b211af040c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/vertical-medical/pulls/31/commits","review_comments_url":"https://api.github.com/repos/OCA/vertical-medical/pulls/31/comments","review_comment_url":"https://api.github.com/repos/OCA/vertical-medical/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/vertical-medical/issues/31/comments","statuses_url":"https://api.github.com/repos/OCA/vertical-medical/statuses/ad6f8214c90651c630eeb6404aa51289f7022edd","head":{"label":"acsone:8.0-incubator_imp_disease-jne","ref":"8.0-incubator_imp_disease-jne","sha":"ad6f8214c90651c630eeb6404aa51289f7022edd","user":{"login":"acsone","id":7601056,"avatar_url":"https://avatars.githubusercontent.com/u/7601056?v=3","gravatar_id":"","url":"https://api.github.com/users/acsone","html_url":"https://github.com/acsone","followers_url":"https://api.github.com/users/acsone/followers","following_url":"https://api.github.com/users/acsone/following{/other_user}","gists_url":"https://api.github.com/users/acsone/gists{/gist_id}","starred_url":"https://api.github.com/users/acsone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acsone/subscriptions","organizations_url":"https://api.github.com/users/acsone/orgs","repos_url":"https://api.github.com/users/acsone/repos","events_url":"https://api.github.com/users/acsone/events{/privacy}","received_events_url":"https://api.github.com/users/acsone/received_events","type":"Organization","site_admin":false},"repo":{"id":29350698,"name":"vertical-medical","full_name":"acsone/vertical-medical","owner":{"login":"acsone","id":7601056,"avatar_url":"https://avatars.githubusercontent.com/u/7601056?v=3","gravatar_id":"","url":"https://api.github.com/users/acsone","html_url":"https://github.com/acsone","followers_url":"https://api.github.com/users/acsone/followers","following_url":"https://api.github.com/users/acsone/following{/other_user}","gists_url":"https://api.github.com/users/acsone/gists{/gist_id}","starred_url":"https://api.github.com/users/acsone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acsone/subscriptions","organizations_url":"https://api.github.com/users/acsone/orgs","repos_url":"https://api.github.com/users/acsone/repos","events_url":"https://api.github.com/users/acsone/events{/privacy}","received_events_url":"https://api.github.com/users/acsone/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acsone/vertical-medical","description":"Open Source Health care system","fork":true,"url":"https://api.github.com/repos/acsone/vertical-medical","forks_url":"https://api.github.com/repos/acsone/vertical-medical/forks","keys_url":"https://api.github.com/repos/acsone/vertical-medical/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acsone/vertical-medical/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acsone/vertical-medical/teams","hooks_url":"https://api.github.com/repos/acsone/vertical-medical/hooks","issue_events_url":"https://api.github.com/repos/acsone/vertical-medical/issues/events{/number}","events_url":"https://api.github.com/repos/acsone/vertical-medical/events","assignees_url":"https://api.github.com/repos/acsone/vertical-medical/assignees{/user}","branches_url":"https://api.github.com/repos/acsone/vertical-medical/branches{/branch}","tags_url":"https://api.github.com/repos/acsone/vertical-medical/tags","blobs_url":"https://api.github.com/repos/acsone/vertical-medical/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acsone/vertical-medical/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acsone/vertical-medical/git/refs{/sha}","trees_url":"https://api.github.com/repos/acsone/vertical-medical/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acsone/vertical-medical/statuses/{sha}","languages_url":"https://api.github.com/repos/acsone/vertical-medical/languages","stargazers_url":"https://api.github.com/repos/acsone/vertical-medical/stargazers","contributors_url":"https://api.github.com/repos/acsone/vertical-medical/contributors","subscribers_url":"https://api.github.com/repos/acsone/vertical-medical/subscribers","subscription_url":"https://api.github.com/repos/acsone/vertical-medical/subscription","commits_url":"https://api.github.com/repos/acsone/vertical-medical/commits{/sha}","git_commits_url":"https://api.github.com/repos/acsone/vertical-medical/git/commits{/sha}","comments_url":"https://api.github.com/repos/acsone/vertical-medical/comments{/number}","issue_comment_url":"https://api.github.com/repos/acsone/vertical-medical/issues/comments{/number}","contents_url":"https://api.github.com/repos/acsone/vertical-medical/contents/{+path}","compare_url":"https://api.github.com/repos/acsone/vertical-medical/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acsone/vertical-medical/merges","archive_url":"https://api.github.com/repos/acsone/vertical-medical/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acsone/vertical-medical/downloads","issues_url":"https://api.github.com/repos/acsone/vertical-medical/issues{/number}","pulls_url":"https://api.github.com/repos/acsone/vertical-medical/pulls{/number}","milestones_url":"https://api.github.com/repos/acsone/vertical-medical/milestones{/number}","notifications_url":"https://api.github.com/repos/acsone/vertical-medical/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acsone/vertical-medical/labels{/name}","releases_url":"https://api.github.com/repos/acsone/vertical-medical/releases{/id}","created_at":"2015-01-16T14:02:39Z","updated_at":"2015-01-16T14:02:40Z","pushed_at":"2015-09-30T09:42:27Z","git_url":"git://github.com/acsone/vertical-medical.git","ssh_url":"git@github.com:acsone/vertical-medical.git","clone_url":"https://github.com/acsone/vertical-medical.git","svn_url":"https://github.com/acsone/vertical-medical","homepage":"http://medical.odoo.com","size":4420,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"8.0"}},"base":{"label":"OCA:8.0-incubator","ref":"8.0-incubator","sha":"c334ee10d3da990d2a3b3d9f7e1570ce63de189a","user":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"repo":{"id":21203152,"name":"vertical-medical","full_name":"OCA/vertical-medical","owner":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OCA/vertical-medical","description":"Open Source Health care system","fork":false,"url":"https://api.github.com/repos/OCA/vertical-medical","forks_url":"https://api.github.com/repos/OCA/vertical-medical/forks","keys_url":"https://api.github.com/repos/OCA/vertical-medical/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/vertical-medical/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/vertical-medical/teams","hooks_url":"https://api.github.com/repos/OCA/vertical-medical/hooks","issue_events_url":"https://api.github.com/repos/OCA/vertical-medical/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/vertical-medical/events","assignees_url":"https://api.github.com/repos/OCA/vertical-medical/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/vertical-medical/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/vertical-medical/tags","blobs_url":"https://api.github.com/repos/OCA/vertical-medical/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/vertical-medical/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/vertical-medical/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/vertical-medical/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/vertical-medical/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/vertical-medical/languages","stargazers_url":"https://api.github.com/repos/OCA/vertical-medical/stargazers","contributors_url":"https://api.github.com/repos/OCA/vertical-medical/contributors","subscribers_url":"https://api.github.com/repos/OCA/vertical-medical/subscribers","subscription_url":"https://api.github.com/repos/OCA/vertical-medical/subscription","commits_url":"https://api.github.com/repos/OCA/vertical-medical/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/vertical-medical/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/vertical-medical/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/vertical-medical/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/vertical-medical/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/vertical-medical/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/vertical-medical/merges","archive_url":"https://api.github.com/repos/OCA/vertical-medical/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/vertical-medical/downloads","issues_url":"https://api.github.com/repos/OCA/vertical-medical/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/vertical-medical/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/vertical-medical/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/vertical-medical/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/vertical-medical/labels{/name}","releases_url":"https://api.github.com/repos/OCA/vertical-medical/releases{/id}","created_at":"2014-06-25T12:57:22Z","updated_at":"2015-09-16T22:17:56Z","pushed_at":"2015-09-30T08:31:27Z","git_url":"git://github.com/OCA/vertical-medical.git","ssh_url":"git@github.com:OCA/vertical-medical.git","clone_url":"https://github.com/OCA/vertical-medical.git","svn_url":"https://github.com/OCA/vertical-medical","homepage":"","size":5346,"stargazers_count":33,"watchers_count":33,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"open_issues_count":13,"forks":57,"open_issues":13,"watchers":33,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/vertical-medical/pulls/31"},"html":{"href":"https://github.com/OCA/vertical-medical/pull/31"},"issue":{"href":"https://api.github.com/repos/OCA/vertical-medical/issues/31"},"comments":{"href":"https://api.github.com/repos/OCA/vertical-medical/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/vertical-medical/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/vertical-medical/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/vertical-medical/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/vertical-medical/statuses/ad6f8214c90651c630eeb6404aa51289f7022edd"}}}}