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
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • 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

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

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
fieldscontextwizardsform_viewdymanic_fields
6956 Rodiniai
Portretas
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
Portretas
Atmesti
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 pass values form javascript to form?
javascript fields form context form_view
Portretas
0
spal. 19
5332
passing field values with context in wizard
wizard fields values context
Portretas
Portretas
1
spal. 17
34827
Odoo 9 How to sort order for a field in form view Solved
fields order sort form_view
Portretas
Portretas
Portretas
2
birž. 17
14276
field value in context
wizard fields v7 context
Portretas
0
kov. 15
4620
form_view_ref not working in calendar
calendar xml context form_view createedit
Portretas
1
lapkr. 23
2626
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