|
@ -23,6 +23,7 @@ class operation_request(models.Model): |
|
|
|
|
|
|
|
|
request_date = fields.Date(string='Request date', |
|
|
request_date = fields.Date(string='Request date', |
|
|
default=lambda self: self.get_date_now()) |
|
|
default=lambda self: self.get_date_now()) |
|
|
|
|
|
effective_date = fields.Date(string='Effective date', required=False) |
|
|
partner_id = fields.Many2one('res.partner', |
|
|
partner_id = fields.Many2one('res.partner', |
|
|
string='Cooperator', |
|
|
string='Cooperator', |
|
|
domain=[('member', '=', True)], |
|
|
domain=[('member', '=', True)], |
|
@ -87,6 +88,13 @@ class operation_request(models.Model): |
|
|
invoice = fields.Many2one('account.invoice', |
|
|
invoice = fields.Many2one('account.invoice', |
|
|
string="Invoice") |
|
|
string="Invoice") |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
@api.constrains("effective_date") |
|
|
|
|
|
def _constrain_effective_date(self): |
|
|
|
|
|
for obj in self: |
|
|
|
|
|
if obj.effective_date > fields.Datetime.now(): |
|
|
|
|
|
raise ValidationError("The effective date can not be in the future.")\ |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def approve_operation(self): |
|
|
def approve_operation(self): |
|
|
for rec in self: |
|
|
for rec in self: |
|
@ -211,7 +219,10 @@ class operation_request(models.Model): |
|
|
def execute_operation(self): |
|
|
def execute_operation(self): |
|
|
self.ensure_one() |
|
|
self.ensure_one() |
|
|
|
|
|
|
|
|
effective_date = self.get_date_now() |
|
|
|
|
|
|
|
|
if self.effective_date: |
|
|
|
|
|
effective_date = self.effective_date |
|
|
|
|
|
else: |
|
|
|
|
|
effective_date = self.get_date_now() |
|
|
sub_request = self.env['subscription.request'] |
|
|
sub_request = self.env['subscription.request'] |
|
|
|
|
|
|
|
|
for rec in self: |
|
|
for rec in self: |
|
|