Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

returning view with all records

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
viewsreturn
5458 Vues
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
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Is it possible to redirect user an external url & open view at the same function ?
views view return
Avatar
0
avr. 20
4778
Select multiple elements with XPath Résolu
views
Avatar
Avatar
Avatar
Avatar
Avatar
5
août 24
48195
Filter out (hide) lines in tree component Résolu
views
Avatar
Avatar
Avatar
2
avr. 24
3470
What are the different types of views available in Odoo? Résolu
views
Avatar
Avatar
Avatar
Avatar
3
juin 23
7902
view layout (two fields on the same row within an xpath) Résolu
views
Avatar
Avatar
2
juin 23
5811
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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