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

Odoo how to dynamically create a weekly schedule mod-fri and mon-fri depending on a field inter value

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
fieldscontextwizardsform_viewdymanic_fields
6947 Widoki
Awatar
danielmwai

 I  have this  task  which  i  describe below and  i  have  gotten  stuck  ,  i  would appreciate  some  help 

I  earlier  posted it  on  Stack Overflow this  is  the  link    http://stackoverflow.com/questions/34044275/odoo-how-to-dynamically-create-a-weekly-schedule-mod-fri-and-mon-fri-depending-o

**TASK** :

- Model A to Model B have a many2many relation .

- In Model B which has a many2many relation,i have a Integer field.

- If the field integer is 3 or more , for each line of the line items added using the many2many items , generate dynamically weekly schedules meaning if the integer value is 3 generate three weeks dynamically for all the line items in the many2many if the field is 4 for each line items generate 4 week to schedule on .

I have tried using a wizard to no avail .

Ways of solving i think could be of help but i havent been able successfully make it work is using the fields_view_init() , fields_view_get() , using context where i pick the value of the integer fields in model B of the many to many relation and using @api.onchange and @api.depends -- pull the value of the integer field and may be using the fields_view_get() dynamically create the two weeks schedule or the 3 three weeks depending on the integer value . 

How can i achieve , please some code examples are highly appreciated .

This code below will help understand what i mean above

 
 
 class ratecard_sin_radio(models.Model):
 code = fields.Char(string='SINGULAR RATECARD CODE',readonly=True)
 name = fields.Char(string='NAME')
 outlet_id = fields.Many2one(comodel_name='outlet', string='Outlet')
 timeband_id = fields.Many2one(comodel_name='timeband', string='TimeBand')
 
 
 
class ratecard_multiple(models.Model):
 #pudb.set_trace()
 _name = 'ratecard.multiple'
 scheduled_for = fields.Integer(string='SCHEDULED FOR',default=1 ,track_visibility='always',store=True , readonly=True)
 multiple_ratecard_id = fields.Many2many(comodel_name='ratecard.sin.radio', relation='ratecard_multiple_singular_rel',
 column1='ratecard_multiple_id',
 column2='ratecard_sin_radio_id', 
 string='RATECARDS') 

Sample part of the view i have :

 <group colspan="4" col="4" >
 <tree editable="bottom">
 <group colspan="2" col="2" >
 <field name='name'/>
 
 <field name="scheduled_for"/>
 </group>
 <field name='multiple_ratecard_id' nolabel="1" options="{'reload_on_button': true}"> <!-- widget="many2many"-->
 <tree string="ALLOCATE SPOTS" editable="bottom">
 <!--<field name="week_id" widget="one2many_list"/>-->
 <button name="scheduler" string="SCHEDULE" type="object" class="oe_highlight"/>
 <field name="code"/>
 <field name="name"/>
 <field name="outlet_id" on_change="onchange_outlet(outlet_id)" placeholder="OUTLET"/>
 <field name="outlet_type_id" domain="[('outlet_id', '=' ,outlet_id)]" placeholder="OUTLET TYPE" />
 <field name='monday'/>
 <field name='tuesday'/>
 <field name='wednesday'/>
 <field name='thursday'/>
 <field name='friday'/>
 <field name='saturday'/>
 <field name='sunday'/>
 <field name="spot_total"/>
 <field name="noofweeks"/>
 <field name='allocate_subtotal'/>
 <field name="rates_total"/>
 <field name="total_cost"/>
 </tree>
 </field>

The button scheduler is a function that now depends on scheduled_for to dynamically generate the weekly views that is if scheduled_for is 3

then dynamically i generate mon- sun mon - sun mon-sun . if

4 then i generate mon -sun mon-sun mon-sun mon-sun

On the

 ` <button name="scheduler" string="SCHEDULE" type="object" class="oe_highlight"/>`

calls this function which creates a week. Problem i need to control this week to be generated according to the

 `scheduled_for` value such that if `scheduled_for` is 3 i return a week calendar model that have 3 weeks that is mon-sun , mon-sun , mon -sun if it the `scheduled_for` is 4 then i return mon-sun , mon-sun , mon -sun , mon-sun

 @api.multi
 def scheduler(self):
 view_id = self.env.ref('ragtimeorder.view_week_form').id
 # context = self._context.copy()
 return {
 'name':_('SCHEDULE RATECARD'),
 'view_type': 'form',
 'view_mode': 'form',
 'views': [(view_id, 'form'), ],
 'res_model': 'week',
 # 'context': self._context,
 'type': 'ir.actions.act_window',
 'target': 'new',
 'flags': {'action_buttons': True},
 }

Problem with this scheduler function is static which it is required to be dynamic

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ść
How to pass values form javascript to form?
javascript fields form context form_view
Awatar
0
paź 19
5325
passing field values with context in wizard
wizard fields values context
Awatar
Awatar
1
paź 17
34814
Odoo 9 How to sort order for a field in form view Rozwiązane
fields order sort form_view
Awatar
Awatar
Awatar
2
cze 17
14263
field value in context
wizard fields v7 context
Awatar
0
mar 15
4617
form_view_ref not working in calendar
calendar xml context form_view createedit
Awatar
1
lis 23
2612
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