[IMP] CSS lunch

bzr revid: fp@tinyerp.com-20121031102307-d4s8sq9v32poebzj
This commit is contained in:
Fabien Pinckaers 2012-10-31 11:23:07 +01:00
parent 73c7c2f2c0
commit a692a21546
7 changed files with 105 additions and 100 deletions

View File

@ -35,7 +35,7 @@ Category for the product.
'data': ['security/groups.xml','lunch_view.xml','wizard/lunch_validation_view.xml','wizard/lunch_cancel_view.xml','lunch_report.xml',
'report/report_lunch_order_view.xml',
'security/ir.model.access.csv',],
'css':['static/src/css/lunch_style.css'],
'css':['static/src/css/lunch.css'],
'demo': ['lunch_demo.xml',],
'test': [],
'installable': True,

View File

@ -126,19 +126,16 @@ class lunch_order(osv.Model):
return True
return False
def _default_alerts_get(self,cr,uid,arg,context=None):
""" get the alerts to display on the order form """
alert_ref = self.pool.get('lunch.alert')
alert_ids = alert_ref.search(cr,uid,[('lunch_active','=',True)],context=context)
alert_msg=""
alert_msg = []
for alert in alert_ref.browse(cr,uid,alert_ids,context=context):
if self.can_display_alert(alert):
if alert.active_from==alert.active_to:
#the alert is executing all the day
alert_msg+="! "
alert_msg+=alert.message
alert_msg+='\n'
alert_msg.append(alert.message)
elif alert.active_from<alert.active_to:
#the alert is executing from ... to ...
now = datetime.utcnow()
@ -153,10 +150,8 @@ class lunch_order(osv.Model):
min_from = int((alert.active_from-hour_from)*60)
from_alert = datetime.strptime(str(hour_from)+":"+str(min_from),"%H:%M")
if mynow.time()>=from_alert.time() and mynow.time()<=to_alert.time():
alert_msg+="! "
alert_msg+=alert.message
alert_msg+='\n'
return alert_msg
alert_msg.append(alert.message)
return '\n'.join(alert_msg)
def onchange_price(self,cr,uid,ids,order_line_ids,context=None):
""" Onchange methode that refresh the total price of order"""
@ -228,7 +223,7 @@ class lunch_order(osv.Model):
for key,value in categories.items():
text_xml+="""
<div class="oe_lunch_30pc">
<div class="oe_lunch_title">%s</div>
<h2>%s</h2>
""" % (key,)
i = 0
for val in value:
@ -237,20 +232,20 @@ class lunch_order(osv.Model):
function_name = "add_preference_"+str(val.id)
text_xml+= '''
<div class="oe_lunch_vignette">
<div class="oe_group_text_button oe_inline">
<div class="oe_lunch_text"> %s </div>
<div class="oe_lunch_button">
<button name="%s" class="oe_link oe_i" type="object" string="+"></button>
<button name="%s" class="oe_link" type="object" string="Add"></button>
</div>
<span class="oe_lunch_button">
<button name="%s" class="oe_link oe_i oe_button_plus" type="object" string="+"></button><button name="%s" class="oe_link oe_button_add" type="object" string=" Add"></button>
</span>
<div class="oe_group_text_button">
<div class="oe_lunch_text">
%s
<span class="oe_tag">%.2f %s</span>
</div>
</div>
<span class="oe_tag">%.2f %s</span>
<br/>
<div class="oe_lunch_note">
<div class="oe_grey">
%s
</div>
</div>
''' % (val['product_name'],function_name, function_name, val['price'] or 0.0, currency['name'], val['note'] or '')
''' % (function_name, function_name, val['product_name'], val['price'] or 0.0, currency['name'], val['note'] or '')
text_xml+= ('''</div>''')
text_xml+= ('''</div>''')
# ADD into ARCH xml

View File

@ -1,13 +1,13 @@
<?xml version="1.0"?>
<openerp>
<data>
<!--Menu and Title-->
<menuitem id='menu_lunch' name='Lunch' />
<menuitem name="Lunch Menu" parent="menu_lunch" id="menu_lunch_title" sequence="50" />
<menuitem name="Administrate Orders" parent="menu_lunch" id="menu_lunch_admin" sequence="51" groups="group_lunch_manager"/>
<!--Menu and Title-->
<menuitem id='menu_lunch' name='Lunch' />
<menuitem name="Lunch Menu" parent="menu_lunch" id="menu_lunch_title" sequence="50" />
<menuitem name="Administrate Orders" parent="menu_lunch" id="menu_lunch_admin" sequence="51" groups="group_lunch_manager"/>
<menuitem name="Administrate Cash Moves" parent="menu_lunch" id="menu_lunch_cash" sequence="52" groups="group_lunch_manager"/>
<menuitem name="Configuration" parent="menu_lunch" id="menu_lunch_config" sequence="53" groups="group_lunch_manager"/>
<menuitem name="Configuration" parent="menu_lunch" id="menu_lunch_config" sequence="53" groups="group_lunch_manager"/>
<!--View Search to group by Supplier and time-->
<record model="ir.ui.view" id="supplier_group_by_month_search_view">
<field name="name">Search</field>
@ -74,8 +74,8 @@
</field>
</record>
<!--Action for Your Orders-->
<record model="ir.actions.act_window" id="action_lunch_order_form">
<!--Action for Your Orders-->
<record model="ir.actions.act_window" id="action_lunch_order_form">
<field name="name">Your Orders</field>
<field name="res_model">lunch.order</field>
<field name="view_mode">form</field>
@ -199,7 +199,7 @@
<menuitem name="Products" parent="menu_lunch_config" id="menu_lunch_products" action="action_lunch_products" />
<!--Action for Product categories-->
<record model="ir.actions.act_window" id="action_lunch_product_categories">
<record model="ir.actions.act_window" id="action_lunch_product_categories">
<field name="name">Product Categories</field>
<field name="res_model">lunch.product.category</field>
<field name="view_mode">tree,form</field>
@ -285,10 +285,10 @@
</record>
<record model="ir.ui.view" id="orders_form_view">
<field name="name">Orders Form</field>
<field name="model">lunch.order</field>
<field name="arch" type="xml">
<form string='Orders Form' version='7.0'>
<field name="name">Lunch Order</field>
<field name="model">lunch.order</field>
<field name="arch" type="xml">
<form string='Orders Form' version='7.0' class="oe_lunch">
<header>
<field name='state' widget='statusbar' statusbar_visible='new,confirmed'/>
</header>
@ -303,8 +303,7 @@
<field name='date'/>
</group>
</group>
<field name='alerts' class='oe_small_textarea' attrs="{'invisible': [('state','!=','new')]}"/>
<separator name='pref' string='Favorites'/>
<field name='alerts' attrs="{'invisible': [('state','!=','new')]}" class="oe_inline oe_lunch_alert"/>
<div name="preferences">
</div>
<separator string='Your order'/>
@ -322,9 +321,9 @@
</group>
<br/><br/>
</sheet>
</form>
</field>
</record>
</form>
</field>
</record>
<!--View for Products-->
<record model="ir.ui.view" id="products_tree_view">

View File

@ -0,0 +1,3 @@
lunch.css: lunch.sass
sass -t expanded lunch.sass lunch.css

View File

@ -0,0 +1,37 @@
@charset "utf-8";
.openerp .oe_lunch .oe_lunch_alert textarea {
background-color: #ffc7c7;
padding: 10px;
height: 1em;
margin-bottom: 20px;
}
.openerp .oe_lunch button.oe_button_add {
position: relative;
top: -2px;
left: 3px;
}
.openerp .oe_lunch button.oe_button_plus {
margin: -2px;
}
.openerp .oe_lunch .oe_lunch_30pc {
width: 30%;
display: inline-block;
vertical-align: top;
}
.openerp .oe_lunch .oe_lunch_30pc + .oe_lunch_30pc {
padding-left: 5%;
}
.openerp .oe_lunch h2 {
color: #7c7bad;
}
.openerp .oe_lunch .oe_lunch_button {
float: right;
}
.openerp .oe_lunch .oe_lunch_vignette {
border-bottom: 1px solid #dddddd;
padding-top: 5px;
padding-bottom: 5px;
}
.openerp .oe_lunch .oe_group_text_button {
margin-bottom: 3px;
}

View File

@ -0,0 +1,32 @@
@charset "utf-8"
.openerp
.oe_lunch
.oe_lunch_alert
textarea
background-color: #ffc7c7
padding: 10px
height: 1em
margin-bottom: 20px
button.oe_button_add
position: relative
top: -2px
left: 3px
button.oe_button_plus
margin: -2px
.oe_lunch_30pc
width: 30%
display: inline-block
vertical-align: top
.oe_lunch_30pc + .oe_lunch_30pc
padding-left: 5%
h2
color: #7C7BAD
.oe_lunch_button
float: right
.oe_lunch_vignette
border-bottom: 1px solid #dddddd
padding-top: 5px
padding-bottom: 5px
.oe_group_text_button
margin-bottom: 3px

View File

@ -1,61 +0,0 @@
.openerp .oe_lunch_view {
}
.openerp .oe_lunch_30pc {
width: 33%;
display: inline-block;
vertical-align: top;
}
.openerp .oe_lunch_title {
font-weight: bold;
font-size: 17px;
margin-left: 10px;
color: #7C7BAD;
}
.openerp .oe_lunch_vignette {
padding: 8px;
min-height: 50px;
border: 1px solid;
border-color: grey;
margin-right: 12px;
margin-bottom: 5px;
-moz-border-radius: 15px;
border-radius: 15px;
box-shadow: grey 1.5px 1.5px 1.5px;
}
.openerp .oe_small_textarea>textarea {
min-height: 20px;
height: 20px;
color: red;
}
.openerp .oe_lunch_button {
margin: 0px;
padding: 0px;
text-align: right;
width: 29%;
min-width: 55px;
max-width: 30%;
display: inline-block;
}
.openerp .oe_lunch_note {
margin: 0px;
padding: 0px;
margin-top: 4px;
text-align: left;
font-style: italic;
color: #686464;
display: inline-block;
}
.openerp .oe_lunch_text {
font-size: 15px;
font-style: bold;
width: 69%;
max-width: 70%;
display: inline-block;
}