mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-19 14:32:02 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
2
odoo-bringout-oca-dms-dms/dms/wizards/__init__.py
Normal file
2
odoo-bringout-oca-dms-dms/dms/wizards/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
from . import wizard_dms_file_move
|
||||
from . import wizard_dms_share
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright 2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class WizardDmsFileMove(models.TransientModel):
|
||||
_name = "wizard.dms.file.move"
|
||||
_description = "Wizard Dms File Move"
|
||||
|
||||
count_files = fields.Integer(readonly=True)
|
||||
directory_id = fields.Many2one(
|
||||
comodel_name="dms.directory", required=True, string="Directory"
|
||||
)
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
vals = super().default_get(fields)
|
||||
if self.env.context.get("active_ids"):
|
||||
vals.update({"count_files": len(self.env.context.get("active_ids"))})
|
||||
return vals
|
||||
|
||||
def process(self):
|
||||
items = self.env["dms.file"].browse(self.env.context.get("active_ids"))
|
||||
items.write({"directory_id": self.directory_id})
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2024 Tecnativa - Víctor Martínez
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="wizard_dms_file_move_form_view" model="ir.ui.view">
|
||||
<field name="name">wizard.dms.file.move.form</field>
|
||||
<field name="model">wizard.dms.file.move</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<i class="fa fa-exclamation-triangle mr-3" title="Warning" />
|
||||
<b>ATTENTION:</b> Tips to keep in mind before moving files:<br />
|
||||
- This change cannot be undone.<br />
|
||||
- Remember that the permissions of the files are those of the folder that contains it, therefore, it is possible that when you change it, the permissions will also change.<br
|
||||
/>
|
||||
Make this change at your own risk.
|
||||
</div>
|
||||
<group>
|
||||
<field name="directory_id" />
|
||||
<field name="count_files" string="Total files" />
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
name="process"
|
||||
string="Move"
|
||||
class="btn-primary"
|
||||
type="object"
|
||||
confirm="Are you sure? All files will be moved."
|
||||
/>
|
||||
<button string="Cancel" class="btn-default" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="wizard_dms_file_move_act_window" model="ir.actions.act_window">
|
||||
<field name="name">Move files</field>
|
||||
<field name="res_model">wizard.dms.file.move</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
19
odoo-bringout-oca-dms-dms/dms/wizards/wizard_dms_share.py
Normal file
19
odoo-bringout-oca-dms-dms/dms/wizards/wizard_dms_share.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright 2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class WizardDmsShare(models.TransientModel):
|
||||
_name = "wizard.dms.share"
|
||||
_inherit = "portal.share"
|
||||
_description = "Wizard for sharing DMS records"
|
||||
|
||||
@api.model
|
||||
def _selection_target_model(self):
|
||||
return [
|
||||
(model.model, model.name)
|
||||
for model in self.env["ir.model"]
|
||||
.sudo()
|
||||
.search([("model", "in", ("dms.directory", "dms.file"))])
|
||||
]
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="wizard_dms_share_form" model="ir.ui.view">
|
||||
<field name="name">wizard.dms.share.form</field>
|
||||
<field name="model">wizard.dms.share</field>
|
||||
<field name="inherit_id" ref="portal.portal_share_wizard" />
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="res_model" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<record id="wizard_dms_directory_share_action" model="ir.actions.act_window">
|
||||
<field name="name">Share</field>
|
||||
<field name="res_model">wizard.dms.share</field>
|
||||
<field name="binding_model_id" ref="model_dms_directory" />
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<record id="wizard_dms_file_share_action" model="ir.actions.act_window">
|
||||
<field name="name">Share</field>
|
||||
<field name="res_model">wizard.dms.share</field>
|
||||
<field name="binding_model_id" ref="model_dms_file" />
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue