mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-24 17:38:42 -06:00
[MIG] document_page_multi_company (#188)
* [MIG] document_page_multi_company Added this feature from the old module directly in document_page
This commit is contained in:
parent
523a1c07ef
commit
a0998d406e
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Document Page',
|
'name': 'Document Page',
|
||||||
'version': '11.0.2.0.0',
|
'version': '11.0.2.1.0',
|
||||||
'category': 'Knowledge Management',
|
'category': 'Knowledge Management',
|
||||||
'author': 'OpenERP SA, Odoo Community Association (OCA)',
|
'author': 'OpenERP SA, Odoo Community Association (OCA)',
|
||||||
'images': [
|
'images': [
|
||||||
|
@ -104,6 +104,14 @@ class DocumentPage(models.Model):
|
|||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
company_id = fields.Many2one(
|
||||||
|
'res.company',
|
||||||
|
'Company',
|
||||||
|
help='If set, page is accessible only from this company',
|
||||||
|
index=True,
|
||||||
|
ondelete='cascade',
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_page_index(self, link=True):
|
def _get_page_index(self, link=True):
|
||||||
"""Return the index of a document."""
|
"""Return the index of a document."""
|
||||||
|
@ -19,6 +19,16 @@ class DocumentPageHistory(models.Model):
|
|||||||
content = fields.Text()
|
content = fields.Text()
|
||||||
diff = fields.Text(compute='_compute_diff')
|
diff = fields.Text(compute='_compute_diff')
|
||||||
|
|
||||||
|
company_id = fields.Many2one(
|
||||||
|
'res.company',
|
||||||
|
'Company',
|
||||||
|
help='If set, page is accessible only from this company',
|
||||||
|
related='page_id.company_id',
|
||||||
|
store=True,
|
||||||
|
index=True,
|
||||||
|
readonly=True,
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_diff(self):
|
def _compute_diff(self):
|
||||||
"""Shows a diff between this version and the previous version"""
|
"""Shows a diff between this version and the previous version"""
|
||||||
|
@ -14,4 +14,18 @@
|
|||||||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.rule" id="document_page_rule">
|
||||||
|
<field name="name">document_page multi-company</field>
|
||||||
|
<field name="model_id" ref="model_document_page"/>
|
||||||
|
<field name="global" eval="True"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.rule" id="document_page_history_rule">
|
||||||
|
<field name="name">document_page_history multi-company</field>
|
||||||
|
<field name="model_id" ref="model_document_page_history"/>
|
||||||
|
<field name="global" eval="True"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
<tree string="Document Page">
|
<tree string="Document Page">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="parent_id"/>
|
<field name="parent_id"/>
|
||||||
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
<field name="create_uid" invisible="1"/>
|
<field name="create_uid" invisible="1"/>
|
||||||
<field name="content_uid"/>
|
<field name="content_uid"/>
|
||||||
<field name="content_date"/>
|
<field name="content_date"/>
|
||||||
@ -50,6 +51,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="parent_id" string="Category" context="{'default_type':'category'}"/>
|
<field name="parent_id" string="Category" context="{'default_type':'category'}"/>
|
||||||
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="content_uid"/>
|
<field name="content_uid"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user