Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

domain_force need to be upgrade everytime there is a change

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
ir.ruleodoo16
1536 Widoki
Awatar
Dimas Aditya Kristianto

I'm trying to change an ir.rule that is from odoo base crm module. Specifically in odoo-server/addons/crm/security/crm_security.xml. The ir.rule is registered as no_update then I find this thread "How to inherit and change the domain of standard rules in odoo 8.0?". It work. The ir.rule is changed. 


My goal is to change the domain_force so that when the user's "Sales" access right was set to "User: Own document only", it will see the user status in "Sales Team" (crm.team). If he is a leader, he can see the member's opportunity and his opportunity when opening the CRM menu




I add new many2many field in res.partner to store all crm.lead that a user can be viewed 


The problem is when I open CRM menu, the data is not updated when I change the leader in "Sales Team". But it change when I upgrade the module OR set the argument --dev=xml​ when running the service





class CrmLead(models.Model):

    _inherit = 'crm.lead'

    def write(self, vals):

        res = super(CrmLead, self).write(vals)

        _logger.info("Editing in crm.lead")


        # user_ids = self.user_id

        partner_ids = self.env['res.users'].search([]).partner_id.ids

        if partner_ids:

            self._update_visible_crm_lead_ids(partner_ids)

        _logger.info("Finish editing in crm.lead")

        return res


    visible_res_users_ids = fields.Many2many('res.partner', string='Leads')

    def _update_visible_crm_lead_ids(self, partner_ids):

        """

        1. Check the user. If the user is leader, get the members user_id. If not, just get user_id

        2. Get all crm_lead that has the user_id that we got from the first step

        3. Replace all visible_crm_lead_ids with the new one


        """

        _logger.info("Entering update_visible_crm_lead with users: %s", partner_ids)

        partners = self.env['res.partner'].sudo().search([('id', 'in', partner_ids)])

        for partner in partners:

            res_user = self.env['res.users'].search([('partner_id', '=', res_user.id)])

            all_user_to_get_all_crm_lead = res_user.ids

            if crm_team_based_on_leader:

                all_user_to_get_all_crm_lead = all_user_to_get_all_crm_lead + crm_team_based_on_leader.member_ids.ids

                all_user_to_get_all_crm_lead = list(set(all_user_to_get_all_crm_lead))

                

            all_crm_lead = self.env['crm.lead'].search([('user_id', 'in', all_user_to_get_all_crm_lead)]).ids

            _logger.debug("partner display name: %s", partner.display_name)

            _logger.debug("res users: %s", res_user.display_name)

            _logger.debug("all_crm_lead: %s", all_crm_lead)

            partner.visible_crm_lead_ids = [(6, 0, all_crm_lead)]



class ResPartner(models.Model):

    _inherit = "res.partner"

    visible_crm_lead_ids = fields.Many2many('crm.lead', string='Leads')


class CrmTeam(models.Model):

    _inherit = 'crm.team'


    def write(self, vals):

        res = super(CrmTeam, self).write(vals)

        self.create_depart_users_write()

        # self.update_res_partner()

        _logger.info("Editing in crm.team")

        crm_lead = self.env['crm.lead'].search([], limit=1)

        if crm_lead:

            partner_ids = self.env['res.users'].search([]).partner_id.ids

            crm_lead._update_visible_crm_lead_ids(partner_ids)


        _logger.info("Finish editing in crm.team")

        return res

  



<?xml version="1.0" encoding="utf-8"?>

<odoo>


    <!--Find the corresponding "to be inherited record" with noupdate="1" -->

    <function name="write" model="ir.model.data">

        <function model="ir.model.data" name="search">

            <value eval="[('module', '=', 'crm'), ('name', '=', 'crm_rule_personal_lead')]" />

        </function>

        <value eval="{'noupdate': False}"/>

    </function>


    <!--Finish the job, i.e. inheriting/modifying some fields-->

    <record id="crm.crm_rule_personal_lead" model="ir.rule">            

        <field name="domain_force">[('id', 'in', user.partner_id.visible_crm_lead_ids.ids)]</field>        

    </record>


    <!--Optional, if you want to set noupdate to True again-->

    

    <function name="write" model="ir.model.data">

        <function model="ir.model.data" name="search">

            <value eval="[('module', '=', 'crm'), ('name', '=', 'crm_rule_personal_lead')]" />

        </function>

        <value eval="{'noupdate': True}"/>

    </function>


</odoo>







0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Automatic Batch Transfer Rozwiązane
odoo16
Awatar
Awatar
1
sie 25
1383
Automatic Batch Transfer
odoo16
Awatar
Awatar
1
maj 25
2196
Bank statement import via email
odoo16
Awatar
0
lis 24
2122
Display 'total' ( Like in Sale Order) on TOP
odoo16
Awatar
Awatar
2
paź 24
2163
I have a manufacturing type product that comes out with 0 stock despite having materials.
odoo16
Awatar
0
sie 24
1660
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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