Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Pass data from wizard to another

Odoberať

Get notified when there's activity on this post

This question has been flagged
17.2
1 Odpoveď
1535 Zobrazenia
Avatar
jenan soliman

Hello,


I have models make appointment customer and choose appointment customer the first model has service_id and is_package I want to pass their value into the second wizard so I can create validation here is models 


def action_open_choose_appointment(self):
choose_appointment = self.env['choose.appointment.customer'].create({
'service_id': self.service_id.id if self.service_id else False,
'is_package': self.is_package,
})
return {
'type': 'ir.actions.act_window',
'res_model': 'choose.appointment.customer',
'res_id': choose_appointment.id,
'view_mode': 'form',
'target': 'new',
'context': {
'default_service_id': self.service_id.id if self.service_id else False,
'is_package': self.is_package,
},
}

i use this function in the first model and here is the second model
lass ChooseMembershipAppointment(models.TransientModel):

_inherit = ["choose.appointment.customer"]
_description = "Choose Membership for Customer"

service_id = fields.Many2one('appointment.product', string="Service")
# ('consumed_service_ids.service_id', '=', service_id)
is_package = fields.Boolean(string="Package Selected", default=False)
membership_id = fields.Many2one('customer.membership', string='Customer Membership',
domain="[('partner_id', '=', partner_id),('status','=','active'),]")
notes = fields.Text(string="Notes")
membership_package = fields.Many2one(related='membership_id.membership_package_id')
has_membership = fields.Boolean(string="Has Membership", compute='_compute_has_membership', store=False)

def some_method(self):

business_appointment = self.env['make.business.appointment'].create({})

result = business_appointment.action_open_choose_appointment()

return result


@api.model
def create(self, vals):

print("Context: %s", self.env.context)
service_id = self.env.context.get('default_service_id')
is_package = self.env.context.get('is_package')
if service_id:
print("kkkkkkkkkkkkkk")
vals['service_id'] = service_id
if is_package:
print("wooooooooooooooooooow")
vals['is_package'] = is_package
return super(ChooseMembershipAppointment, self).create(vals)


def default_get(self, fields_list):
res = super(ChooseMembershipAppointment, self).default_get(fields_list)

res['is_package'] = self.env.context.get('default_package_selected', False)
print("Context: %s", self.env.context)
partner_id = self._context.get('partner_id')


if partner_id:
memberships = self.env['customer.membership'].search([
('partner_id', '=', partner_id),
('status', '=', 'active')
], order='date_from asc', limit=1)

if memberships:
res['membership_id'] = memberships.id


return res
0
Avatar
Zrušiť
Avatar
SunArc Technologies
Best Answer

Using context can pass and get value


Example,


  def action_open_choose_appointment(self):

    return {

        'type': 'ir.actions.act_window',

        'res_model': 'choose.appointment.customer',

        'view_mode': 'form',

        'target': 'new',

        'context': {

            'default_service_id': self.service_id.id if self.service_id else False,

            'default_is_package': self.is_package,  # Use a prefixed key

        },

    }

   

    @api.model

    def create(self, vals):

        service_id = self.env.context.get('default_service_id')

        is_package = self.env.context.get('default_is_package')  # Use the correct context key

        if service_id:

            vals['service_id'] = service_id

        if is_package is not None: 

            vals['is_package'] = is_package

        return super(ChooseMembershipAppointment, self).create(vals)   

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
"ODOO" as the website Title in google search - how to remove
website 17.2
Avatar
Avatar
Avatar
Avatar
3
okt 24
2740
Product with attributes linked with service product.
community 17.2
Avatar
0
okt 24
882
studio customization import error - invalid operation
Studio 17.2
Avatar
0
aug 24
1571
How to redirect the user to country specific website based on their location
online 17.2
Avatar
0
júl 24
1473
Website Purchase Order
odoo.sh 17.2
Avatar
0
jún 24
1478
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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