Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 7.47 KB | None | 0 0
  1. <?xml version="1.0" encoding= "utf-8"?>
  2.  
  3. <openerp>
  4.    <data>
  5.  
  6.    <record id= "dietfacts_product_template_tree_view" model= "ir.ui.view">
  7.    <field name="inherit_id" ref="product.product_template_tree_view" />
  8.    <field name="model">product.template</field >
  9.    <field name="arch" type= "xml">
  10.          <field name="categ_id" position="before">
  11.             <field name="servingsize"/>
  12.              <field name="calories"/>
  13.             <field name="nutrition_score"/>
  14.              <field name="lastupdated"/>
  15.          </field>
  16.    </field>
  17.    </record>
  18.    
  19.     <record id= "dietfacts_product_template_form_view" model= "ir.ui.view">
  20.    <field name="inherit_id" ref="product.product_template_only_form_view" />
  21.    <field name="model">product.template</field >
  22.    <field name="arch" type= "xml">
  23.          <field name="list_price" position="after">
  24.            
  25.              <field name="calories"/>
  26.              <field name="nutrition_score"/>
  27.              <field name="servingsize"/>
  28.              <field name="lastupdated"/>
  29.              
  30.            
  31.          </field>
  32.          
  33.           <page name="sales" position="after">
  34.              <page name="nutrients" string="Nutrients">
  35.                <field name="nutrient_ids" widget="one2many_list">
  36.                 <tree editable="bottom">
  37.                  <field name="nutrient_id"/>
  38.                 <field name="value"/>
  39.                 <field name="uom"/>
  40.                 <field name="dailypercent"/>
  41.                 </tree>
  42.                 </field>
  43.              </page>
  44.           </page>
  45.    </field>
  46.    </record>
  47.    
  48.           <record id="product.product_template_action_dietfacts" model= "ir.actions.act_window" >
  49.             <field name="name" >Diet Items</field >
  50.             <field name="type" >ir.actions.act_window</field>
  51.             <field name="res_model" >product.template</field >
  52.             <field name="view_mode" >tree,kanban,form</field >
  53.             <field name="view_type" >form</field >
  54.             <field name="view_id" ref= "product.product_template_tree_view" />
  55.             <field name="context" >{"search_default_filter_to_sell":1}</field>
  56.             <field name="domain">[('categ_id.name','=','Diet Items')]</field>
  57.             <field name="help" type= "html">
  58.                 <p class="oe_view_nocontent_create" >
  59.                     Click to define a new product.
  60.                 </p><p>
  61.                     You must define a product for everything you sell, whether it's a physical product, a consumable or a service you offer to  customers.            
  62.                 </p><p>
  63.                     The product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.
  64.                 </p>
  65.             </field>
  66.         </record>
  67.        
  68.        
  69.            <record id="meal_action_dietfacts" model= "ir.actions.act_window" >
  70.             <field name="name" >Meals</field >
  71.             <field name="type" >ir.actions.act_window</field>
  72.             <field name="res_model" >res.users.meal</field >
  73.             <field name="view_mode" >tree,kanban,form</field >
  74.             <field name="view_type" >form</field >
  75.             <field name="help" type= "html">
  76.                 <p class="oe_view_nocontent_create" >
  77.                     Click to define a new meal.
  78.                 </p>
  79.             </field>
  80.         </record>
  81.        
  82.    <record id= "dietfacts_meal_form_view" model= "ir.ui.view">
  83.    <field name="model">res.users.meal</field >
  84.    <field name="arch" type= "xml">
  85.           <form>
  86.             <group>
  87.              <field name="name"/>
  88.              <field name="meal_date"/>
  89.              <field name="user_id"/>
  90.              <field name="totalcalories"/>
  91.              <field name="largemeal"/>
  92.              <field name="notes"/>
  93.              
  94.              </group>
  95.              <notebook>
  96.                 <page name="mealitems" string="Meal Items">
  97.                   <field name="item_ids" widget="one2many_list">
  98.                    <tree editable="bottom">
  99.                       <field name = "item_id" />
  100.                       <field name = "calories"/>
  101.                       <field name = "servings" />
  102.                       <field name = "notes"/>
  103.                    </tree>
  104.                   </field>
  105.                   </page>
  106.              </notebook>
  107.            </form>
  108.            
  109.          
  110.    </field>
  111.    </record>
  112.    
  113.    
  114.    <record id= "dietfacts_meal_tree_view" model= "ir.ui.view">
  115.    <field name="model">res.users.meal</field >
  116.    <field name="arch" type= "xml">
  117.          <tree>
  118.             <field name="name"/>
  119.              <field name="meal_date"/>
  120.              <field name="user_id"/>
  121.              <field name="totalcalories" sum="Total Calories"/>
  122.          </tree>
  123.    </field>
  124.    </record>
  125.  
  126.  
  127.          <menuitem action= "product.product_template_action_dietfacts"
  128.            id="menu_product_template_action_dietfacts"
  129.            parent="base.menu_sales" sequence= "14" />
  130.          
  131.          <menuitem action= "meal_action_dietfacts"
  132.            id="menu_meal_action_dietfacts"
  133.            parent="base.menu_sales" sequence= "15" />
  134.            
  135.            
  136.            <record id="nutrient_action_dietfacts" model= "ir.actions.act_window" >
  137.             <field name="name" >Nutrients</field >
  138.             <field name="type" >ir.actions.act_window</field>
  139.             <field name="res_model" >product.nutrient</field >
  140.             <field name="view_mode" >tree,kanban,form</field >
  141.             <field name="view_type" >form</field >
  142.             <field name="help" type= "html">
  143.                 <p class="oe_view_nocontent_create" >
  144.                     Click to define a new nutrient.
  145.                 </p>
  146.             </field>
  147.         </record>    
  148.        
  149.         <menuitem action= "nutrient_action_dietfacts"
  150.            id="menu_nutrient_action_dietfacts"
  151.            parent="base.menu_sales" sequence= "15" />
  152.            
  153.            
  154.         <template id= "product.nutrition">
  155.         <t t-call="report.html_container" >
  156.           <t t-foreach ="docs" t-as ="o">
  157.             <t t-call ="report.external_layout">
  158.                 <div class="page" >
  159.                      <div class="oe_structure" />
  160.                      <h1>Nutrition Report</h1>
  161.                      <h2>Product Name: <span t-field="o.name"/></h2>
  162.                      <p>Calories: <span t-field="o.calories"/></p>
  163.                      <p>Nutrition Score: <span t-field="o.nutrition_score"/></p>
  164.                      
  165.                      <h3>Nutrition Details</h3>
  166.                      <t t-foreach="o.nutrient_ids" t-as="line">
  167.                      <div class="row">
  168.                       <div class="col-xs-6">
  169.                        <span t-field="line.nutrient_id.name"/>
  170.                        </div>
  171.                        <div class="col-xs-2">
  172.                            <span t-field="line.value"/>
  173.                         </div>
  174.                         <div class="col-xs-4">
  175.                         <span t-field="line.nutrient_id.uom_id.name"/>
  176.                         </div>
  177.                        </div>
  178.                      </t>
  179.                 </div>
  180.             </t>
  181.           </t>
  182.         </t>
  183.         </template>
  184.            
  185.             <report id="dietfacts_product" model="product.template"
  186.               string="Nutrition Products"
  187.               report_type="qweb-pdf"
  188.                name="product.nutrition"
  189.                file="product.nutrition"/>
  190.  
  191.      
  192.    </data>
  193. </openerp>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement