[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', 'name': 'GOLEM non-profit resources',
'summary': 'GOLEM resources management', 'summary': 'GOLEM resources management',
'description': ''' GOLEM resources management ''', 'description': ''' GOLEM resources management ''',
'version': '10.0.1.5.0', 'version': '10.0.1.6.0',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois', 'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

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

View File

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

View File

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

View File

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