[ADD]GOLEM Resource : add social abilities on resource and reservation, and track fields on reservation

This commit is contained in:
Fabien BOURGEOIS 2018-02-18 17:30:11 +01:00
parent a5d4e5feb3
commit 977e817326
5 changed files with 20 additions and 9 deletions

View File

@ -20,7 +20,7 @@
'name': 'GOLEM non-profit resources',
'summary': 'GOLEM resources management',
'description': ''' GOLEM resources management ''',
'version': '10.0.1.5.0',
'version': '10.0.1.6.0',
'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -25,6 +25,7 @@ class GolemResource(models.Model):
""" GOLEM Resource Model """
_name = 'golem.resource'
_description = 'GOLEM Resource Model'
_inherit = 'mail.thread'
name = fields.Char(required=True, index=True)
active = fields.Boolean(default=True)

View File

@ -27,6 +27,7 @@ class GolemResourceReservation(models.Model):
""" GOLEM Resource Reservation Model """
_name = 'golem.resource.reservation'
_description = 'GOLEM Reservation Model'
_inherit = 'mail.thread'
name = fields.Char(compute='_compute_name', store=True)
# TODO: handle multiple days reservation
@ -41,6 +42,7 @@ class GolemResourceReservation(models.Model):
resource_id = fields.Many2one('golem.resource', required=True, index=True,
string='Resource', readonly=True,
track_visibility='onchange',
states={'draft': [('readonly', False)]})
resource_avaibility_start = fields.Date(related='resource_id.avaibility_start')
resource_avaibility_stop = fields.Date(related='resource_id.avaibility_stop')
@ -51,16 +53,16 @@ class GolemResourceReservation(models.Model):
states={'draft': [('readonly', False)]})
partner_id = fields.Many2one('res.partner', string='On behalf of',
required=True, index=True, readonly=True,
track_visibility='onchange',
states={'draft': [('readonly', False)]})
state = fields.Selection([
('canceled', 'Canceled'),
('draft', 'Draft'),
('confirmed', 'Confirmed'),
('validated', 'Validated'),
('rejected', 'Rejected')
], default='draft')
state = fields.Selection([('canceled', 'Canceled'),
('draft', 'Draft'),
('confirmed', 'Confirmed'),
('validated', 'Validated'),
('rejected', 'Rejected')],
default='draft', track_visibility='onchange')
rejection_reason = fields.Text(readonly=True)
rejection_reason = fields.Text(readonly=True, track_visibility='onchange')
@api.depends('resource_id', 'date')
def _compute_name(self):

View File

@ -91,6 +91,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>

View File

@ -77,6 +77,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>