diff --git a/project_revenue_amount/models/custom_project.py b/project_revenue_amount/models/custom_project.py
index be8e21c..f1e9b48 100755
--- a/project_revenue_amount/models/custom_project.py
+++ b/project_revenue_amount/models/custom_project.py
@@ -9,6 +9,7 @@ class CustomProject(models.Model):
revenue_amount_lines = fields.One2many('project.revenue.lines' , 'project_id')
+
class ProjectRevenueLines(models.Model):
_name = 'project.revenue.lines'
@@ -17,7 +18,37 @@ class ProjectRevenueLines(models.Model):
end_date = fields.Date(required=True)
fixed_amount = fields.Float()
-
+ def edit_revenue_history_record(self):
+ context = dict(self.env.context)
+ context['form_view_initial_mode'] = 'edit'
+ return {
+ 'name': ('Edit Revenue History'),
+ 'type': 'ir.actions.act_window',
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'target': 'new',
+ 'res_model': 'project.revenue.lines',
+ 'res_id': self.id,
+ 'context': context,
+ # 'view_id': view_id
+ }
+
+ @api.onchange('start_date')
+ def _onchange_start_date(self):
+ if self.project_id:
+ records = self.env['project.revenue.lines'].sudo().search([('project_id', '=', self.project_id.id)])
+ if self.start_date:
+ if self.start_date.day != 1:
+ raise AccessError('Please select first date of month')
+ else:
+ pass
+ for line in records:
+ if self.start_date >= line.start_date and self.start_date <= line.end_date:
+ raise AccessError('Date already exist')
+
+ def update_record(self):
+ return {
+ 'type': 'ir.actions.act_window_close'}
diff --git a/project_revenue_amount/security/ir.model.access.csv b/project_revenue_amount/security/ir.model.access.csv
index d3f1176..ccb2421 100755
--- a/project_revenue_amount/security/ir.model.access.csv
+++ b/project_revenue_amount/security/ir.model.access.csv
@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_project_revenue_lines,access.project.revenue.lines,model_project_revenue_lines,,1,1,1,0
-access_project_revenue_wizard,access.project.revenue.wizard,model_project_revenue_wizard,,1,1,1,0
+access_project_revenue_lines,access.project.revenue.lines,model_project_revenue_lines,project.group_project_manager,1,1,1,1
+access_project_revenue_wizard,access.project.revenue.wizard,model_project_revenue_wizard,project.group_project_manager,1,1,1,1
diff --git a/project_revenue_amount/views/custom_project.xml b/project_revenue_amount/views/custom_project.xml
index 008a1d2..0334e5f 100755
--- a/project_revenue_amount/views/custom_project.xml
+++ b/project_revenue_amount/views/custom_project.xml
@@ -13,6 +13,10 @@
+
+
@@ -20,4 +24,25 @@
+
+
+ project.edit.project.revenue.lines
+ project.revenue.lines
+
+
+
+
\ No newline at end of file
diff --git a/project_revenue_amount/wizard/project_revenue_wizard.xml b/project_revenue_amount/wizard/project_revenue_wizard.xml
index 559f8b4..69ab0e5 100755
--- a/project_revenue_amount/wizard/project_revenue_wizard.xml
+++ b/project_revenue_amount/wizard/project_revenue_wizard.xml
@@ -1,6 +1,6 @@
- project.edit.project.inherit,wizard
+ project.edit.project.inherit.wizard
project.revenue.wizard