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
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    Others
    • 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
  • Help

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

returning view with all records

Odoberať

Get notified when there's activity on this post

This question has been flagged
viewsreturn
5461 Zobrazenia
Avatar
Grf

So i made a menu that is calling a method that makes some logic and creates records in product.assortment.remove and after all record are created it returns a view. But my problem is that I get the view with 0 records.

My goal is that my method should return a view with all records created and a user can remove some records( with trash icon like in average tree view) how can i acheave that?

class AssortmentProductRemoval(models.TransientModel):
    _name = 'assortment.product.removal.wiz'
    _description = "Wizard for removing assortment product"

    prod_assort_rem_ids = fields.One2many(
        'product.assortment.remove', 'product_id',
        string='Product Assortmen Remove',)

@api.multi
def _check_assortment_items(self):
     <-- some logic here -->
     assort_rem_obj = self.env['product.assortment.remove']
     vals = ({'qty_sold': qty,
              'product_id': product.id,
              'profit': profit})
        assort_rem_obj.create(vals)
    view = self.env.ref('config_hetlita.assortment_product_removal')
    return {
        'type': 'ir.actions.act_window',
        'view_type': 'form',
        'view_mode': 'form',
        'res_model': 'assortment.product.removal.wiz',
        'views': [(view.id, 'form'), (False, 'tree')],
        'res_id': self.id,
        'target': 'new'
    }

class ProductAssortmentRemove(models.Model):
    _name = 'product.assortment.remove'

    product_id = fields.Many2one(
        'product.template', string='Product',
        domain=[],
        required=False)
    turnover = fields.Float(string='Turnover', required=False)
    profit = fields.Float(string='Profit', required=False)
    qty_sold = fields.Float(string='Quantity sold', required=False)
<record model="ir.ui.view" id="assortment_product_removal">
            <field name="name">view.name</field>
            <field name="model">assortment.product.removal.wiz</field>
            <field name="arch" type="xml">
               <form string="Update Set">
                <field name="prod_assort_rem_ids" >
                    <tree editable="bottom">
                        <field name="product_id"/>
                        <field name="turnover"/>
                        <field name="qty_sold"/>
                    </tree>
                </field>
                <footer>
                    <button string="Cancel" icon="gtk-cancel" special="cancel" />
                    or
                    <button name="action_save_sol" string="Save" type="object" icon="gtk-ok"/>
                </footer>
            </form>
            </field>
        </record>


        <record id="action_test2" model="ir.actions.server">
            <field name="name">Assortment product removal</field>
            <field name="model_id" ref="model_assortment_product_removal_wiz"/>
            <field name="state">code</field>
              <field name="code">action = self._check_assortment_items(cr, uid, context.get('active_ids'), context=context)</field>
        </record>

        <menuitem id="your_menu_id12" action="action_test2" parent="base.menu_sale_config"  name="Assort remove"  sequence="1"/>
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
Is it possible to redirect user an external url & open view at the same function ?
views view return
Avatar
0
apr 20
4779
Select multiple elements with XPath Solved
views
Avatar
Avatar
Avatar
Avatar
Avatar
5
aug 24
48201
Filter out (hide) lines in tree component Solved
views
Avatar
Avatar
Avatar
2
apr 24
3471
What are the different types of views available in Odoo? Solved
views
Avatar
Avatar
Avatar
Avatar
3
jún 23
7906
view layout (two fields on the same row within an xpath) Solved
views
Avatar
Avatar
2
jún 23
5813
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