Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding= "utf-8"?>
- <openerp>
- <data>
- <record id= "dietfacts_product_template_tree_view" model= "ir.ui.view">
- <field name="inherit_id" ref="product.product_template_tree_view" />
- <field name="model">product.template</field >
- <field name="arch" type= "xml">
- <field name="categ_id" position="before">
- <field name="servingsize"/>
- <field name="calories"/>
- <field name="nutrition_score"/>
- <field name="lastupdated"/>
- </field>
- </field>
- </record>
- <record id= "dietfacts_product_template_form_view" model= "ir.ui.view">
- <field name="inherit_id" ref="product.product_template_only_form_view" />
- <field name="model">product.template</field >
- <field name="arch" type= "xml">
- <field name="list_price" position="after">
- <field name="calories"/>
- <field name="nutrition_score"/>
- <field name="servingsize"/>
- <field name="lastupdated"/>
- </field>
- <page name="sales" position="after">
- <page name="nutrients" string="Nutrients">
- <field name="nutrient_ids" widget="one2many_list">
- <tree editable="bottom">
- <field name="nutrient_id"/>
- <field name="value"/>
- <field name="uom"/>
- <field name="dailypercent"/>
- </tree>
- </field>
- </page>
- </page>
- </field>
- </record>
- <record id="product.product_template_action_dietfacts" model= "ir.actions.act_window" >
- <field name="name" >Diet Items</field >
- <field name="type" >ir.actions.act_window</field>
- <field name="res_model" >product.template</field >
- <field name="view_mode" >tree,kanban,form</field >
- <field name="view_type" >form</field >
- <field name="view_id" ref= "product.product_template_tree_view" />
- <field name="context" >{"search_default_filter_to_sell":1}</field>
- <field name="domain">[('categ_id.name','=','Diet Items')]</field>
- <field name="help" type= "html">
- <p class="oe_view_nocontent_create" >
- Click to define a new product.
- </p><p>
- You must define a product for everything you sell, whether it's a physical product, a consumable or a service you offer to customers.
- </p><p>
- The product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.
- </p>
- </field>
- </record>
- <record id="meal_action_dietfacts" model= "ir.actions.act_window" >
- <field name="name" >Meals</field >
- <field name="type" >ir.actions.act_window</field>
- <field name="res_model" >res.users.meal</field >
- <field name="view_mode" >tree,kanban,form</field >
- <field name="view_type" >form</field >
- <field name="help" type= "html">
- <p class="oe_view_nocontent_create" >
- Click to define a new meal.
- </p>
- </field>
- </record>
- <record id= "dietfacts_meal_form_view" model= "ir.ui.view">
- <field name="model">res.users.meal</field >
- <field name="arch" type= "xml">
- <form>
- <group>
- <field name="name"/>
- <field name="meal_date"/>
- <field name="user_id"/>
- <field name="totalcalories"/>
- <field name="largemeal"/>
- <field name="notes"/>
- </group>
- <notebook>
- <page name="mealitems" string="Meal Items">
- <field name="item_ids" widget="one2many_list">
- <tree editable="bottom">
- <field name = "item_id" />
- <field name = "calories"/>
- <field name = "servings" />
- <field name = "notes"/>
- </tree>
- </field>
- </page>
- </notebook>
- </form>
- </field>
- </record>
- <record id= "dietfacts_meal_tree_view" model= "ir.ui.view">
- <field name="model">res.users.meal</field >
- <field name="arch" type= "xml">
- <tree>
- <field name="name"/>
- <field name="meal_date"/>
- <field name="user_id"/>
- <field name="totalcalories" sum="Total Calories"/>
- </tree>
- </field>
- </record>
- <menuitem action= "product.product_template_action_dietfacts"
- id="menu_product_template_action_dietfacts"
- parent="base.menu_sales" sequence= "14" />
- <menuitem action= "meal_action_dietfacts"
- id="menu_meal_action_dietfacts"
- parent="base.menu_sales" sequence= "15" />
- <record id="nutrient_action_dietfacts" model= "ir.actions.act_window" >
- <field name="name" >Nutrients</field >
- <field name="type" >ir.actions.act_window</field>
- <field name="res_model" >product.nutrient</field >
- <field name="view_mode" >tree,kanban,form</field >
- <field name="view_type" >form</field >
- <field name="help" type= "html">
- <p class="oe_view_nocontent_create" >
- Click to define a new nutrient.
- </p>
- </field>
- </record>
- <menuitem action= "nutrient_action_dietfacts"
- id="menu_nutrient_action_dietfacts"
- parent="base.menu_sales" sequence= "15" />
- <template id= "product.nutrition">
- <t t-call="report.html_container" >
- <t t-foreach ="docs" t-as ="o">
- <t t-call ="report.external_layout">
- <div class="page" >
- <div class="oe_structure" />
- <h1>Nutrition Report</h1>
- <h2>Product Name: <span t-field="o.name"/></h2>
- <p>Calories: <span t-field="o.calories"/></p>
- <p>Nutrition Score: <span t-field="o.nutrition_score"/></p>
- <h3>Nutrition Details</h3>
- <t t-foreach="o.nutrient_ids" t-as="line">
- <div class="row">
- <div class="col-xs-6">
- <span t-field="line.nutrient_id.name"/>
- </div>
- <div class="col-xs-2">
- <span t-field="line.value"/>
- </div>
- <div class="col-xs-4">
- <span t-field="line.nutrient_id.uom_id.name"/>
- </div>
- </div>
- </t>
- </div>
- </t>
- </t>
- </t>
- </template>
- <report id="dietfacts_product" model="product.template"
- string="Nutrition Products"
- report_type="qweb-pdf"
- name="product.nutrition"
- file="product.nutrition"/>
- </data>
- </openerp>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement