Commit 1e77d942 authored by Cédric Bonhomme's avatar Cédric Bonhomme

New views added: product and test views. models.py has been added.

parent e1e2ffdb
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import ecologistics_storage
\ No newline at end of file
import models
#! /usr/bin/env python
# -*- coding: utf-8 -*-
{
'name': 'Ecologistics - Storage',
'version': '0.1',
'category': 'Wharehouse',
'sequence': 3,
'author': 'Cédric Bonhomme @ CRP Henri Tudor',
'maintainer': 'Cédric Bonhomme @ CRP Henri Tudor',
'category': 'Wharehouse',
'website': 'http://git.tudor.lu/ecologistics/ecologistics_storage',
'summary': 'Access to EPCIS events from a Fosstrak platform.',
'description': """
Access to EPCIS events from a Fosstrak platform
===============================================
Manage products and events collected by a Fosstrak platform..
Manage products and events collected by a Fosstrak platform.
""",
'depends': ['base'],
'init_xml' : [],
"update_xml" : ['product_view.xml'],
'data': [
'base_menu.xml'
],
'installable': True,
'init_xml': [],
'update_xml': ['views/main.xml', 'views/test1.xml', 'views/test2.xml',
'views/product.xml'],
'active': True,
'auto_install': True,
'installable': True
}
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Top menu item -->
<menuitem name="Storage"
id="menu_storage"
groups="base.group_user"
sequence="300"/>
<menuitem id="menu_storage_dashboard" parent="menu_storage" sequence="0" />
</data>
</openerp>
......@@ -7,22 +7,48 @@
#
##############################################################################
from openerp.osv import fields, osv
import time
from openerp.osv import osv, fields
class ecologistics_storage(osv.osv):
def _check_length(self, cr, uid, ids, context=None):
for record in self.browse(cr, uid, ids, context=context):
if record.value < 20:
return False
return True
class Test1(osv.osv):
_name = 'ecologistics.test'
_columns = {
'name': fields.char('Name', required=True, size=20),
'value': fields.integer('Value', required=True),
}
_defaults = {
'value': lambda self, cr, uid, context: 20,
}
_constraints = [
(_check_length, 'Length must be greater or equal than 20', ['value']),
]
class Test2(osv.osv):
_name = 'ecologistics.test2'
_columns = {
'name': fields.text('Name', required=True),
'reference': fields.many2one('ecologistics.test', 'Reference'),
}
class Product(osv.osv):
"""
"""
_name = "stock.product"
_description = "Product"
_name = "ecologistics.product"
_columns = {
'code': fields.char('Code', size=100, required=True, help="EPCIS code of the product."),
'description': fields.char('Description', size=100, required=True, help="Description of the product."),
'active': fields.boolean('Active', help="By unchecking the active field, you may hide a product without deleting it.")
}
_defaults = {
'code' : 'XXX',
'description' : 'Product description',
'active': True,
#'active': fields.boolean('Active', help="By unchecking the active field, you may hide a product without deleting it.")
}
ecologistics_storage()
\ No newline at end of file
Test1()
Test2()
Product()
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_product_tree" model="stock.product">
<field name="code">stock.product.code</field>
<field name="description">stock.product.description</field>
<field name="active">stock.product.active</field>
</record>
</data>
</openerp>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem id="ecologistics_storage_root" name="Ecologistics"/>
<menuitem id="ecologistics_storage_menu" name="Storage" parent="ecologistics_storage_root"/>
</data>
</openerp>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_form_view" model="ir.ui.view">
<field name="name">ecologistics.product.form</field>
<field name="model">ecologistics.product</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Test1 Form">
<field name="code"/>
<field name="description"/>
</form>
</field>
</record>
<record id="product_list_view" model="ir.ui.view">
<field name="name">ecologistics.product.list.view</field>
<field name="model">ecologistics.product</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Product List">
<field name="code"/>
<field name="description"/>
</tree>
</field>
</record>
<record id="product_action_list_and_form" model="ir.actions.act_window">
<field name="name">Product</field>
<field name="res_model">ecologistics.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="product_menu_test1" action="product_action_list_and_form" parent="ecologistics_storage_menu"/>
</data>
</openerp>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="test1_form_view" model="ir.ui.view">
<field name="name">ecologistics.test.form</field>
<field name="model">ecologistics.test</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Test1 Form">
<field name="name"/>
<field name="value"/>
</form>
</field>
</record>
<record id="test1_list_view" model="ir.ui.view">
<field name="name">ecologistics.test.list.view</field>
<field name="model">ecologistics.test</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Test1 List">
<field name="name"/>
<field name="value"/>
</tree>
</field>
</record>
<record id="test1_action_list_and_form" model="ir.actions.act_window">
<field name="name">Test1</field>
<field name="res_model">ecologistics.test</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="ecologistics_menu_test1" action="test1_action_list_and_form" parent="ecologistics_storage_menu"/>
</data>
</openerp>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="test2_form_view" model="ir.ui.view">
<field name="name">ecologistics.test2.form</field>
<field name="model">ecologistics.test2</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Test2 Form">
<field name="name"/>
<field name="reference"/>
</form>
</field>
</record>
<record id="test2_list_view" model="ir.ui.view">
<field name="name">ecologistics.test2.list.view</field>
<field name="model">ecologistics.test2</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Test2 List">
<field name="name"/>
<field name="reference"/>
</tree>
</field>
</record>
<record id="test2_action_list_and_form" model="ir.actions.act_window">
<field name="name">Test2</field>
<field name="res_model">ecologistics.test2</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="ecologistics_menu_test2" action="test2_action_list_and_form" parent="ecologistics_storage_menu"/>
</data>
</openerp>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment