Skip to Content
Menu
This question has been flagged
2 Replies
2536 Views

https://gist.github.com/WeeDom/d5b9f02f710b198a131cb711b3d933ad.

Odoo 10 can't see values in view of new model I've just created. I got the model to create correctly, I can see the right joins and data through psql cli. All info on a github gist, and pasted below in case the gist goes away at some point in the future. I get no errors in the logs, and when running odoo with log-level=debug_sql there's no mention of my tables. One suggestion has been that the view isn't being seen, but if I change the field="name" bit to field="namety-mcnameface" then I do get a ParseError in the gui.


client=# \d report_template_management_report_template_management_notes

                                        Table "public.report_template_management_report_template_management_notes"

       Column       |            Type             |                                               Modifiers                                               

--------------------+-----------------------------+-------------------------------------------------------------------------------------------------------

 id                 | integer                     | not null default nextval('report_template_management_report_template_management_no_id_seq'::regclass)

 notes_and_guidance | text                        | 

 create_uid         | integer                     | 

 create_date        | timestamp without time zone | 

 name               | character varying           | 

 write_uid          | integer                     | 

 write_date         | timestamp without time zone | 

Indexes:

    "report_template_management_report_template_management_note_pkey" PRIMARY KEY, btree (id)

Foreign-key constraints:

    "report_template_management_report_template_man_create_uid_fkey1" FOREIGN KEY (create_uid) REFERENCES res_users(id) ON DELETE SET NULL

    "report_template_management_report_template_mana_write_uid_fkey1" FOREIGN KEY (write_uid) REFERENCES res_users(id) ON DELETE SET NULL

Referenced by:

    TABLE "report_template_management_report_template_management" CONSTRAINT "report_template_management_report_template_managemen_notes_fkey" FOREIGN KEY (notes) REFERENCES report_template_management_report_template_management_notes(id) ON DELETE SET NULL


client=# \d report_template_management_report_template_management

                                        Table "public.report_template_management_report_template_management"

     Column      |            Type             |                                             Modifiers                                              

-----------------+-----------------------------+----------------------------------------------------------------------------------------------------

 id              | integer                     | not null default nextval('report_template_management_report_template_management_id_seq'::regclass)

 create_uid      | integer                     | 

 name            | character varying           | 

 notes           | integer                     | 

 write_uid       | integer                     | 

 report_template | text                        | 

 write_date      | timestamp without time zone | 

 create_date     | timestamp without time zone | 

Indexes:

    "report_template_management_report_template_management_pkey" PRIMARY KEY, btree (id)

Foreign-key constraints:

    "report_template_management_report_template_mana_create_uid_fkey" FOREIGN KEY (create_uid) REFERENCES res_users(id) ON DELETE SET NULL

    "report_template_management_report_template_manag_write_uid_fkey" FOREIGN KEY (write_uid) REFERENCES res_users(id) ON DELETE SET NULL

    "report_template_management_report_template_managemen_notes_fkey" FOREIGN KEY (notes) REFERENCES report_template_management_report_template_management_notes(id) ON DELETE SET NULL


client=# select * from report_template_management_report_template_management_notes 

client-# ;

 id | notes_and_guidance | create_uid |        create_date        |  name  | write_uid |        write_date         

----+--------------------+------------+---------------------------+--------+-----------+---------------------------

  1 | some guidance      |          1 | 2019-04-23 13:48:28.45109 | a test |         1 | 2019-04-23 13:48:28.45109

(1 row)


client=#

client=# select * from report_template_management_report_template_management;

 id | create_uid |      name       | notes | write_uid |          report_template          |         write_date         |        create_date

----+------------+-----------------+-------+-----------+-----------------------------------+----------------------------+----------------------------

  1 |          1 | test template 1 |     1 |         1 | some text that will be a template | 2019-04-23 15:37:21.404463 | 2019-04-23 15:37:21.404463

(1 row)


client=#.

models.py


from odoo import models, fields, api                                                                                                                                                                                              
                                                                                                                                                                                                                                  
class report_template_management(models.Model):                                                                                                                                                                                   
    _name = 'report_template_management.templates'                                                                                                                                                                                
                                                                                                                                                                                                                                  
    name = fields.Char()                                                                                                                                                                                                          
    report_template = fields.Html()                                                                                                                                                                                               
    notes = fields.Many2one('report_template_management.notes')                                                                                                                                                                   
                                                                                                                                                                                                                                  
class report_template_management_notes(models.Model):                                                                                                                                                                             
    _name = 'report_template_management.notes'                                                                                                                                                                                    
                                                                                                                                                                                                                                  
    name = fields.Char()                                                                                                                                                                                                          
    notes_and_guidance = fields.Html()

views.xml

<odoo>
  <data>
    <record model="ir.ui.view" id="report_template_management.notes_list">                                                                                                                                                        
        <field name="name">report_template_management notes list</field>                                                                                                                                                            
        <field name="model">report_template_management.notes</field>                                                                                                                                                                
        <field name="arch" type="xml">                                                                                                                                                                                              
          <tree string="Report Template Notes">                                                                                                                                                                                     
            <field name="name"/>                                                                                                                                                                                       
            <field name="notes_and_guidance"/>                                                                                                                                                                             
          </tree>                                                                                                                                                                                                                   
        </field>                                                                                                                                                                                                                    
      </record>
  </data>
</odoo>
Avatar
Discard

really don't understand what you wanted to say. Have you at least any data in the model? Did you define an action window and added the view to that action? I would suggest that you look at pythons and odoos coding guidelines so your code will be easily readable.

Author

Hi, Tabla,

Yes, there's one line of data in the templates table and one line of data in the notes table. I entered it manually from the cli in psql.

as to your other questions, everything I've done is in the code I posted. I created the module using 'odoo scaffold' and tried to work from the examples that provided.

Author Best Answer

For people looking for help with this in the future, I found that following this video step-by-step got me going:

https://www.youtube.com/watch?v=ImCS9xog_M4

absolute gold

Avatar
Discard