Skip to content

Commit

Permalink
Merge 6cff312 into ceb2133
Browse files Browse the repository at this point in the history
  • Loading branch information
max3903 committed May 17, 2019
2 parents ceb2133 + 6cff312 commit ba0660b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions agreement_legal/__init__.py
@@ -1,4 +1,12 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, SUPERUSER_ID
from . import models


def post_init_agreement_legal(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, dict())
cr.execute('UPDATE agreement SET stage_id = %s WHERE stage_id IS NULL;',
(env.ref('agreement_legal.agreement_stage_new').id,))
return True
6 changes: 5 additions & 1 deletion agreement_legal/__manifest__.py
Expand Up @@ -35,7 +35,11 @@
"views/agreement.xml",
"views/menu.xml",
],
"post_init_hook": "post_init_agreement_legal",
"application": True,
"development_status": "Beta",
"maintainers": ["max3903", "ygol"],
"maintainers": [
"max3903",
"ygol"
],
}
3 changes: 2 additions & 1 deletion agreement_legal/models/agreement.py
Expand Up @@ -339,7 +339,6 @@ def _read_group_stage_ids(self, stages, domain, order):
"agreement.stage",
string="Stage",
group_expand="_read_group_stage_ids",
default=lambda self: self._default_stage_id(),
help="Select the current stage of the agreement.",
track_visibility="onchange",
index=True)
Expand Down Expand Up @@ -389,6 +388,8 @@ def create(self, vals):
vals["code"] = self.env["ir.sequence"].next_by_code(
"agreement"
) or _("New")
vals["stage_id"] = \
self.env.ref("agreement_legal.agreement_stage_new").id
return super(Agreement, self).create(vals)

# Increments the revision on each save action
Expand Down

0 comments on commit ba0660b

Please sign in to comment.