bemade_project_documents: new module based on bemade_documents_portal
This commit is contained in:
parent
9a4d145537
commit
a30e89a777
8 changed files with 72 additions and 2 deletions
2
bemade_project_documents/__init__.py
Normal file
2
bemade_project_documents/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
from . import models
|
||||
from . import wizard
|
||||
|
|
@ -22,12 +22,14 @@
|
|||
'summary': 'Improved workflow for project documents.',
|
||||
'description': """Adds multiple workflow items to project documents, including:
|
||||
* Approval stages
|
||||
* Document versions with revision numbers""",
|
||||
* Document versions with revision numbers
|
||||
* Ability to request document approval from a partner
|
||||
""",
|
||||
'category': '',
|
||||
'author': 'Bemade Inc.',
|
||||
'website': 'https://www.bemade.org',
|
||||
'license': 'OPL-1',
|
||||
'depends': [],
|
||||
'depends': ['documents_project'],
|
||||
'data': [],
|
||||
'demo': [],
|
||||
'installable': True,
|
||||
|
|
|
|||
2
bemade_project_documents/models/__init__.py
Normal file
2
bemade_project_documents/models/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
from . import project
|
||||
from . import document
|
||||
7
bemade_project_documents/models/document.py
Normal file
7
bemade_project_documents/models/document.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class Document(models.Model):
|
||||
_inherit = 'documents.document'
|
||||
|
||||
external_approver_ids = fields.Many2many('res.partner')
|
||||
15
bemade_project_documents/models/project.py
Normal file
15
bemade_project_documents/models/project.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class Project(models.Model):
|
||||
_inherit = 'project.project'
|
||||
|
||||
document_ids = fields.One2many('documents.document',
|
||||
compute='_compute_document_ids')
|
||||
|
||||
def _compute_document_ids(self):
|
||||
for project in self:
|
||||
project.document_ids = self.env['documents.document'].search([
|
||||
('res_model', '=', 'project.project'),
|
||||
('res_id', '=', project.id),
|
||||
])
|
||||
33
bemade_project_documents/views/project_views.xml
Normal file
33
bemade_project_documents/views/project_views.xml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="project_action_view_documents" model="ir.actions.act_window">
|
||||
<field name="name">Documents</field>
|
||||
<field name="res_model">documents.document</field>
|
||||
<field name="view_mode">tree,kanban</field>
|
||||
<field name="search_view_id" ref="documents.document_view_search"/>
|
||||
<field name="domain">
|
||||
[('res_id', '=', active_id), ('res_model', '=', 'project.project')]
|
||||
</field>
|
||||
<field name="context">{
|
||||
'default_res_id': active_id,
|
||||
'default_res_model': 'project.project',
|
||||
}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
No documents found. Let's create one!
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_project_kanban_inherit" model="ir.ui.view">
|
||||
<field name="inherit_id" ref="project.view_project_kanban"/>
|
||||
<field name="name">project_documents.project.view.kanban</field>
|
||||
<field name="model">project.project</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//a[@name='attachment_tree_view']/.." position="replace">
|
||||
<a name="%(project_action_view_documents)" type="action">Documents</a>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
1
bemade_project_documents/wizard/__init__.py
Normal file
1
bemade_project_documents/wizard/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import request_approvals_wizard
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class RequestDocumentApprovalsWizard(models.TransientModel):
|
||||
_name = 'project_documents.approval.wizard'
|
||||
|
||||
project_id = fields.Many2one('project.project')
|
||||
|
||||
Loading…
Reference in a new issue