bemade_project_documents: new module based on bemade_documents_portal

This commit is contained in:
Marc Durepos 2023-09-26 12:16:13 -04:00
parent 9a4d145537
commit a30e89a777
8 changed files with 72 additions and 2 deletions

View file

@ -0,0 +1,2 @@
from . import models
from . import wizard

View file

@ -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,

View file

@ -0,0 +1,2 @@
from . import project
from . import document

View 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')

View 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),
])

View 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>

View file

@ -0,0 +1 @@
from . import request_approvals_wizard

View file

@ -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')