Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

How to Set Default Directory for Attachments Depedning on Object

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
knowledgedocumentir.attachment
3 Replies
9313 Rodiniai
Portretas
Cyrus Waithaka

I am implementing the Knowledge Management module in odoo v8 and I have come across a major short coming.The directory field in the attachments is not automatically set by the system even if I configure the "Folders per resource" part in Knowledge.

For example, I have a Clients folder whose parent folder is documents. This folder is set as "Folders per resource" for the partner model. Now, if I attach an attachment on a customer, it is not being placed in the clients folder by default.

Does anyone know how to make attachments in odoo to go to a specific directory by default so I don't have to manually set the directory field in the attachment form. I feel this is a vital feature in as documents organisation is concerned. 

(Please upvote the question so that I can be able to comment)

1
Portretas
Atmesti
Portretas
Cyrus Waithaka
Autorius Best Answer

I found some great explanation here https://www.odoo.com/forum/help-1/question/where-are-document-attachments-stored-529 (Antony Lesuisse's answer) on how to set odoo to save the attachments in the file system.

I then used the following piece of code to set a default for 'parent_id' field in the attachment. (ir.attachment class)

from openerp.osv import osv, fields
from openerp.tools.translate import _
class ir_attachment(osv.osv):
    #extend document
    _inherit = "ir.attachment"
    def create(self, cr, uid, vals, context=None):
        if context is None:
            context = {}
        if not vals.get('res_model', False) and context.get('default_res_model', False):
            vals.get['res_model'] = context.get('default_res_model', False)        
        if not vals.get('parent_id', False):
            parent_id = self.pool.get('document.directory').search(cr, uid, [('ressource_type_id','=',vals.get('res_model'))])
            if parent_id and parent_id[0]:
               vals['parent_id'] = parent_id[0]
            else:
                vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context)
        
        return super(ir_attachment, self).create(cr, uid, vals, context)
ir_attachment()
class document_directory(osv.osv):
    _inherit = 'document.directory'
    _sql_constraints = [
        ('dir_uniq', 'unique (ressource_id,ressource_parent_type_id)',
         'The Directory name must be unique per Resource Type and Resource !'),
    ]
This atleast did what I needed.
0
Portretas
Atmesti
Portretas
JORDI BALLESTER ALOMAR
Best Answer

Hello Cyrus,

The functionality "Folders by resource" only works in relation to module "document_ftp". That is, when you access to your repository using FTP, the application dynamically constructs one folder per resource (e.g. one folder for each sales order), based on the flag that you set to the 'Customers' folder in Odoo. These are not physical but 'virtual' folders.

What you ask for is interesting, but would require a specific development, so that each object in Odoo would create it's own physical folder per resource.


Regards,

Jordi.



 




0
Portretas
Atmesti
Cyrus Waithaka
Autorius

Unfortunately, document_ftp has not been ported to odoo v8. Please see how I achieved what I wanted in my answer below

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
How to do User-wise Security access to document attachment ? Solved
document ir.attachment
Portretas
Portretas
Portretas
3
birž. 23
13516
How to show all attachments in Folders per Resource
attachment knowledge document
Portretas
Portretas
1
birž. 16
6366
Sharing Documents & Files with Secure Portal Users
knowledge document portal
Portretas
0
gruod. 23
8028
How to attach existing documents to a message or any other object?
attach knowledge document issues
Portretas
Portretas
Portretas
2
bal. 19
11662
How to massively import documents to 'knowledge' and store them in different sections?
import knowledge document v6
Portretas
0
rugp. 24
5456
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now