[MERGE] Sync with trunk

bzr revid: tde@openerp.com-20140403122027-3w055e5olf23dzw9
This commit is contained in:
Thibault Delavallée 2014-04-03 14:20:27 +02:00
commit 1380f597a2
16 changed files with 190 additions and 111 deletions

View File

@ -543,33 +543,40 @@ class account_analytic_account(osv.osv):
'nodestroy': True,
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
def on_change_template(self, cr, uid, ids, template_id, date_start=False, fix_price_invoices=False, invoice_on_timesheets=False, recurring_invoices=False, context=None):
if not template_id:
return {}
obj_analytic_line = self.pool.get('account.analytic.invoice.line')
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
template = self.browse(cr, uid, template_id, context=context)
invoice_line_ids = []
for x in template.recurring_invoice_line_ids:
invoice_line_ids.append((0, 0, {
'product_id': x.product_id.id,
'uom_id': x.uom_id.id,
'name': x.name,
'quantity': x.quantity,
'price_unit': x.price_unit,
'analytic_account_id': x.analytic_account_id and x.analytic_account_id.id or False,
}))
res['value']['fix_price_invoices'] = template.fix_price_invoices
res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
res['value']['hours_qtt_est'] = template.hours_qtt_est
res['value']['amount_max'] = template.amount_max
res['value']['to_invoice'] = template.to_invoice.id
res['value']['pricelist_id'] = template.pricelist_id.id
res['value']['recurring_invoices'] = template.recurring_invoices
res['value']['recurring_interval'] = template.recurring_interval
res['value']['recurring_rule_type'] = template.recurring_rule_type
res['value']['recurring_invoice_line_ids'] = invoice_line_ids
if not fix_price_invoices:
res['value']['fix_price_invoices'] = template.fix_price_invoices
res['value']['amount_max'] = template.amount_max
if not invoice_on_timesheets:
res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
res['value']['hours_qtt_est'] = template.hours_qtt_est
if template.to_invoice.id:
res['value']['to_invoice'] = template.to_invoice.id
if template.pricelist_id.id:
res['value']['pricelist_id'] = template.pricelist_id.id
if not recurring_invoices:
invoice_line_ids = []
for x in template.recurring_invoice_line_ids:
invoice_line_ids.append((0, 0, {
'product_id': x.product_id.id,
'uom_id': x.uom_id.id,
'name': x.name,
'quantity': x.quantity,
'price_unit': x.price_unit,
'analytic_account_id': x.analytic_account_id and x.analytic_account_id.id or False,
}))
res['value']['recurring_invoices'] = template.recurring_invoices
res['value']['recurring_interval'] = template.recurring_interval
res['value']['recurring_rule_type'] = template.recurring_rule_type
res['value']['recurring_invoice_line_ids'] = invoice_line_ids
return res
def onchange_recurring_invoices(self, cr, uid, ids, recurring_invoices, date_start=False, context=None):

View File

@ -38,6 +38,9 @@
<field name="partner_id" position="attributes">
<attribute name="attrs">{'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]}</attribute>
</field>
<field name="template_id" position="attributes">
<attribute name="on_change">on_change_template(template_id, date_start, fix_price_invoices, invoice_on_timesheets, recurring_invoices)</attribute>
</field>
<xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">
</xpath>
<xpath expr='//separator[@name="description"]' position='before'>

View File

@ -203,7 +203,7 @@ class account_analytic_account(osv.osv):
}, string='Currency', type='many2one', relation='res.currency'),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
if not template_id:
return {}
res = {'value':{}}
@ -213,7 +213,8 @@ class account_analytic_account(osv.osv):
to_dt = datetime.strptime(template.date, tools.DEFAULT_SERVER_DATE_FORMAT)
timedelta = to_dt - from_dt
res['value']['date'] = datetime.strftime(datetime.now() + timedelta, tools.DEFAULT_SERVER_DATE_FORMAT)
res['value']['date_start'] = fields.date.today()
if not date_start:
res['value']['date_start'] = fields.date.today()
res['value']['quantity_max'] = template.quantity_max
res['value']['parent_id'] = template.parent_id and template.parent_id.id or False
res['value']['description'] = template.description

View File

@ -27,7 +27,7 @@
</group>
<group>
<field name="type" invisible="context.get('default_type', False)"/>
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
<field name="template_id" on_change="on_change_template(template_id, date_start)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
<field name="code"/>
<field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract'])]}"/>
<field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','&lt;&gt;','view')]}"/>

View File

@ -115,8 +115,8 @@ class account_analytic_account(osv.osv):
digits_compute=dp.get_precision('Account')),
}
def on_change_template(self, cr, uid, id, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, context=context)
def on_change_template(self, cr, uid, id, template_id, date_start=False, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, date_start=date_start, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['charge_expenses'] = template.charge_expenses

View File

@ -37,7 +37,7 @@ This is a complete document management system.
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['knowledge'],
'depends': ['knowledge', 'mail'],
'data': [
'security/document_security.xml',
'document_view.xml',

View File

@ -235,7 +235,6 @@
<field name="partner_id"/>
<field name="type"/>
</tree>
</field>
</record>
@ -244,6 +243,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.attachment</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new document.

View File

@ -207,8 +207,8 @@ class account_analytic_account(osv.osv):
'use_timesheets': fields.boolean('Timesheets', help="Check this field if this project manages timesheets"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_timesheets'] = template.use_timesheets

View File

@ -89,5 +89,36 @@
<!-- Add menu entry in Settings/Email -->
<menuitem name="Messages" id="menu_mail_message" parent="base.menu_email" action="action_view_mail_message"/>
<record model="ir.ui.view" id="view_document_file_kanban">
<field name="name">ir.attachment kanban</field>
<field name="model">ir.attachment</field>
<field name="arch" type="xml">
<kanban>
<field name="file_type_icon"/>
<field name="url"/>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div t-attf-class="oe_attachment" t-if="record.file_type_icon.value != 'webimage'">
<img t-att-src="'/mail/static/src/img/mimetypes/' + record.file_type_icon.value + '.png'"></img>
<div class='oe_name'><t t-raw='record.name.value' />bb</div>
</div>
<div t-attf-class="oe_attachment oe_preview" t-if="record.file_type_icon.value == 'webimage'">
<img t-att-src="kanban_image('ir.attachment', 'datas', record.id.value)" class="oe_kanban_image"/>
<div class='oe_name'><t t-raw='record.name.value' />aa</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="base.action_attachment" model="ir.actions.act_window">
<field name="view_mode">kanban,form</field>
</record>
</data>
</openerp>
</openerp>

View File

@ -318,7 +318,7 @@
.openerp .oe_mail .oe_msg_composer .oe_recipients input{
vertical-align: middle;
}
.openerp .oe_mail .oe_attachment{
.oe_attachment{
display: inline-block;
width: 100px;
margin: 4px 2px;
@ -328,7 +328,7 @@
text-align: center;
vertical-align: top;
}
.openerp .oe_mail .oe_attachment .oe_name{
.oe_attachment .oe_name{
display: inline-block;
max-width: 100%;
padding: 1px 3px;
@ -341,10 +341,10 @@
border-radius: 3px;
}
.openerp .oe_mail .oe_attachment.oe_preview{
.oe_attachment.oe_preview{
background: url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAJ0lEQVQYV2MsLS39z4AGLCws0IUYGIeCwrVr12J45sSJE5ieGQIKAbuZKf/EMCs7AAAAAElFTkSuQmCC );
}
.openerp .oe_mail .oe_attachment .oe_progress_bar{
.oe_attachment .oe_progress_bar{
display: none;
position: absolute;
top: 18px;
@ -364,7 +364,7 @@
-o-animation: oe_mail_attach_loading_anim 0.75s infinite linear;
animation: oe_mail_attach_loading_anim 0.75s infinite linear;
}
.openerp .oe_mail .oe_attachment.oe_uploading .oe_progress_bar{
.oe_attachment.oe_uploading .oe_progress_bar{
display: block;
}
@-webkit-keyframes oe_mail_attach_loading_anim{
@ -387,7 +387,7 @@
50% { background: #009123 }
100% { background: #4BBD00 }
}
.openerp .oe_mail .oe_attachment.oe_preview .oe_name{
.oe_attachment.oe_preview .oe_name{
position: absolute;
bottom: 0px;
margin: 3px;
@ -405,14 +405,14 @@
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.openerp .oe_mail .oe_attachment.oe_preview:hover .oe_name{
.oe_attachment.oe_preview:hover .oe_name{
opacity: 1;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.openerp .oe_mail .oe_attachment img{
.oe_attachment img{
position: absolute;
width: 48px;
height: 48px;
@ -420,7 +420,7 @@
left: 50%;
margin-left: -24px;
}
.openerp .oe_mail .oe_attachment.oe_preview img{
.oe_attachment.oe_preview img{
display: block;
position: relative;
margin:0px;

View File

@ -223,7 +223,7 @@ class project(osv.osv):
'res_model': 'ir.attachment',
'type': 'ir.actions.act_window',
'view_id': False,
'view_mode': 'tree,form',
'view_mode': 'kanban,form',
'view_type': 'form',
'limit': 80,
'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
@ -1202,8 +1202,8 @@ class account_analytic_account(osv.osv):
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_tasks'] = template.use_tasks

View File

@ -530,8 +530,8 @@ class account_analytic_account(osv.Model):
'use_issues': fields.boolean('Issues', help="Check this field if this project manages issues"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_issues'] = template.use_issues

View File

@ -273,8 +273,8 @@ class account_analytic_account(osv.osv):
'use_phases': fields.boolean('Phases', help="Check this field if you plan to use phase-based scheduling"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['use_phases'] = template.use_phases

View File

@ -19,13 +19,46 @@
#
##############################################################################
import datetime
import werkzeug
from openerp import tools
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.addons.website.models.website import slug
from openerp.osv.orm import browse_record
from openerp.tools.translate import _
from openerp import SUPERUSER_ID
import werkzeug
class QueryURL(object):
def __init__(self, path='', path_args=None, **args):
self.path = path
self.args = args
self.path_args = set(path_args or [])
def __call__(self, path=None, path_args=None, **kw):
path = path or self.path
for k, v in self.args.items():
kw.setdefault(k, v)
path_args = set(path_args or []).union(self.path_args)
paths, fragments = [], []
for key, value in kw.items():
if value and key in path_args:
if isinstance(value, browse_record):
paths.append((key, slug(value)))
else:
paths.append((key, value))
elif value:
if isinstance(value, list) or isinstance(value, set):
fragments.append(werkzeug.url_encode([(key, item) for item in value]))
else:
fragments.append(werkzeug.url_encode([(key, value)]))
for key, value in paths:
path += '/' + key + '/%s' % value
if fragments:
path += '?' + '&'.join(fragments)
return path
class WebsiteBlog(http.Controller):
@ -37,15 +70,17 @@ class WebsiteBlog(http.Controller):
groups = blog_post_obj.read_group(request.cr, request.uid, [], ['name', 'create_date'],
groupby="create_date", orderby="create_date asc", context=request.context)
for group in groups:
group['date'] = "%s_%s" % (group['__domain'][0][2], group['__domain'][1][2])
begin_date = datetime.datetime.strptime(group['__domain'][0][2], tools.DEFAULT_SERVER_DATETIME_FORMAT).date()
end_date = datetime.datetime.strptime(group['__domain'][1][2], tools.DEFAULT_SERVER_DATETIME_FORMAT).date()
group['date_begin'] = '%s' % datetime.date.strftime(begin_date, tools.DEFAULT_SERVER_DATE_FORMAT)
group['date_end'] = '%s' % datetime.date.strftime(end_date, tools.DEFAULT_SERVER_DATE_FORMAT)
return groups
@http.route([
'/blog',
'/blog/page/<int:page>',
], type='http', auth="public", website=True, multilang=True)
def blogs(self, page=1):
BYPAGE = 60
def blogs(self, page=1, **post):
cr, uid, context = request.cr, request.uid, request.context
blog_obj = request.registry['blog.post']
total = blog_obj.search(cr, uid, [], count=True, context=context)
@ -53,13 +88,15 @@ class WebsiteBlog(http.Controller):
url='/blog',
total=total,
page=page,
step=BYPAGE,
step=self._blog_post_per_page,
)
bids = blog_obj.search(cr, uid, [], offset=(page-1)*BYPAGE, limit=BYPAGE, context=context)
blogs = blog_obj.browse(cr, uid, bids, context=context)
post_ids = blog_obj.search(cr, uid, [], offset=(page-1)*self._blog_post_per_page, limit=self._blog_post_per_page, context=context)
posts = blog_obj.browse(cr, uid, post_ids, context=context)
blog_url = QueryURL('', ['blog', 'tag'])
return request.website.render("website_blog.latest_blogs", {
'blogs': blogs,
'pager': pager
'posts': posts,
'pager': pager,
'blog_url': blog_url,
})
@http.route([
@ -67,12 +104,8 @@ class WebsiteBlog(http.Controller):
'/blog/<model("blog.blog"):blog>/page/<int:page>',
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>',
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/page/<int:page>',
'/blog/<model("blog.blog"):blog>/date/<string(length=21):date>',
'/blog/<model("blog.blog"):blog>/date/<string(length=21):date>/page/<int:page>',
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>',
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>/page/<int:page>',
], type='http', auth="public", website=True, multilang=True)
def blog(self, blog=None, tag=None, date=None, page=1, **opt):
def blog(self, blog=None, tag=None, page=1, **opt):
""" Prepare all values to display the blog.
:param blog: blog currently browsed.
@ -91,7 +124,7 @@ class WebsiteBlog(http.Controller):
- 'tag': current tag, if tag_id
- 'nav_list': a dict [year][month] for archives navigation
"""
BYPAGE = 10
date_begin, date_end = opt.get('date_begin'), opt.get('date_end')
cr, uid, context = request.cr, request.uid, request.context
blog_post_obj = request.registry['blog.post']
@ -102,28 +135,26 @@ class WebsiteBlog(http.Controller):
blog_ids = blog_obj.search(cr, uid, [], order="create_date asc", context=context)
blogs = blog_obj.browse(cr, uid, blog_ids, context=context)
path_filter = ""
domain = []
if blog:
path_filter += "%s" % blog.id
domain += [("id", "in", [post.id for post in blog.blog_post_ids])]
domain += [('blog_id', '=', blog.id)]
if tag:
path_filter += 'tag/%s' % tag.id
domain += [("id", "in", [post.id for post in tag.blog_post_ids])]
if date:
path_filter += "date/%s" % date
domain += [("create_date", ">=", date.split("_")[0]), ("create_date", "<=", date.split("_")[1])]
domain += [('tag_ids', 'in', tag.id)]
if date_begin and date_end:
domain += [("create_date", ">=", date_begin), ("create_date", "<=", date_end)]
blog_url = QueryURL('', ['blog', 'tag'], blog=blog, tag=tag, date_begin=date_begin, date_end=date_end)
post_url = QueryURL('', ['blogpost'], tag_id=tag and tag.id or None, date_begin=date_begin, date_end=date_end)
blog_post_ids = blog_post_obj.search(cr, uid, domain, order="create_date asc", context=context)
blog_posts = blog_post_obj.browse(cr, uid, blog_post_ids, context=context)
pager = request.website.pager(
url="/blog/%s" % path_filter,
url=blog_url(),
total=len(blog_posts),
page=page,
step=self._blog_post_per_page,
scope=BYPAGE
)
pager_begin = (page - 1) * self._blog_post_per_page
pager_end = page * self._blog_post_per_page
@ -141,15 +172,16 @@ class WebsiteBlog(http.Controller):
'blog_posts': blog_posts,
'pager': pager,
'nav_list': self.nav_list(),
'path_filter': path_filter,
'date': date,
'blog_url': blog_url,
'post_url': post_url,
'date': date_begin,
}
return request.website.render("website_blog.blog_post_short", values)
@http.route([
'/blogpost/<model("blog.post"):blog_post>',
], type='http', auth="public", website=True, multilang=True)
def blog_post(self, blog_post, tag=None, date=None, page=1, enable_editor=None, **post):
def blog_post(self, blog_post, tag_id=None, page=1, enable_editor=None, **post):
""" Prepare all values to display the blog.
:param blog_post: blog post currently browsed. If not set, the user is
@ -173,6 +205,7 @@ class WebsiteBlog(http.Controller):
- 'tag': current tag, if tag_id
- 'nav_list': a dict [year][month] for archives navigation
"""
date_begin, date_end = post.get('date_begin'), post.get('date_end')
pager_url = "/blogpost/%s" % blog_post.id
@ -187,6 +220,12 @@ class WebsiteBlog(http.Controller):
pager_end = page * self._post_comment_per_page
blog_post.website_message_ids = blog_post.website_message_ids[pager_begin:pager_end]
tag = None
if tag_id:
tag = request.registry['blog.tag'].browse(request.cr, request.uid, int(tag_id), context=request.context)
post_url = QueryURL('', ['blogpost'], blogpost=blog_post, tag_id=tag_id, date_begin=date_begin, date_end=date_end)
blog_url = QueryURL('', ['blog', 'tag'], blog=blog_post.blog_id, tag=tag, date_begin=date_begin, date_end=date_end)
cr, uid, context = request.cr, request.uid, request.context
blog_obj = request.registry['blog.blog']
blog_ids = blog_obj.search(cr, uid, [], context=context)
@ -196,22 +235,19 @@ class WebsiteBlog(http.Controller):
tag_ids = tag_obj.search(cr, uid, [], context=context)
tags = tag_obj.browse(cr, uid, tag_ids, context=context)
MONTHS = [None, _('January'), _('February'), _('March'), _('April'),
_('May'), _('June'), _('July'), _('August'), _('September'),
_('October'), _('November'), _('December')]
values = {
'blog': blog_post.blog_id,
'blogs': blogs,
'tags': tags,
'tag': tag and request.registry['blog.tag'].browse(cr, uid, int(tag), context=context) or None,
'tag': tag,
'blog_post': blog_post,
'main_object': blog_post,
'pager': pager,
'nav_list': self.nav_list(),
'enable_editor': enable_editor,
'date': date,
'date_name': date and "%s %s" % (MONTHS[int(date.split("-")[1])], date.split("-")[0]) or None
'date': date_begin,
'post_url': post_url,
'blog_url': blog_url,
}
return request.website.render("website_blog.blog_post_complete", values)

View File

@ -43,45 +43,45 @@
<section data-snippet-id="title" class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1>Latest Blogs</h1>
<h1>Latest Posts</h1>
</div>
</div>
</section>
<section class="container">
<div class="row">
<t t-set="count" t-value="0"/>
<t t-foreach="blogs" t-as="blog">
<t t-foreach="posts" t-as="post">
<div class="col-md-4">
<h4>
<a t-attf-href="/blogpost/#{ slug(blog) }?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&amp;' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog.name"></a>
<span t-if="not blog.website_published" class="text-warning">
<a t-attf-href="#{blog_url('', ['blogpost'], blogpost=post)}" t-field="post.name"></a>
<span t-if="not post.website_published" class="text-warning">
&amp;nbsp;
<span class="fa fa-warning" title="Not published"/>
</span>
</h4>
<div class="text-muted">
<span class="fa fa-calendar"> <span t-field="blog.create_date"/> &amp;nbsp;</span>
<span class="fa fa-calendar"> <span t-field="post.create_date"/> &amp;nbsp;</span>
<span class="fa fa-folder-open"> In
<a t-attf-href="/blog/#{ slug(blog.blog_id) }">
<span t-field="blog.blog_id"/>
<a t-attf-href="#{blog_url(blog=post.blog_id)}">
<span t-field="post.blog_id"/>
</a> &amp;nbsp;
</span>
</div>
<div class="text-muted fa fa-tags">
<span t-field="blog.website_meta_keywords"/>
<span t-if="editable and not blog.website_meta_keywords" class="label label-danger">
<span t-field="post.website_meta_keywords"/>
<span t-if="editable and not post.website_meta_keywords" class="label label-danger">
No keywords defined!
</span>
</div>
<div class="text-muted" t-if="len(blog.message_ids) &gt; 0">
<div class="text-muted" t-if="len(post.message_ids) &gt; 0">
<span class="fa fa-comment-o">
<a t-attf-href="/blogpost/#{ slug(blog) }/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&amp;' or ''}#{ date and 'date=%s' % date or ''}#comments">
<t t-if="len(blog.message_ids) &lt;= 1" ><t t-esc="len(blog.message_ids)"/> comment</t>
<t t-if="len(blog.message_ids) > 1"><t t-esc="len(blog.message_ids)"/> comments</t>
<a t-attf-href="#{blog_url('', ['blogpost'], blogpost=post)}#comments">
<t t-if="len(post.message_ids) &lt;= 1" ><t t-esc="len(post.message_ids)"/> comment</t>
<t t-if="len(post.message_ids) > 1"><t t-esc="len(post.message_ids)"/> comments</t>
</a>
</span>
</div>
<div class="text-muted mb16" t-field="blog.website_meta_description"/>
<div class="text-muted mb16" t-field="post.website_meta_description"/>
</div>
<t t-set="count" t-value="count+1"/>
<div class="clearfix" t-if="(count % 3) == 0"/>
@ -110,12 +110,12 @@
<t t-foreach="blog_posts" t-as="blog_post">
<div t-att-data-publish="blog_post.website_published and 'on' or 'off'">
<h2 class="text-center">
<a t-attf-href="/blogpost/#{ slug(blog_post) }/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&amp;' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog_post.name"></a>
<a t-attf-href="#{post_url(blogpost=blog_post)}" t-field="blog_post.name"></a>
</h2>
<p class="post-meta text-muted text-center" name='blog_post_data'>
<span class="fa fa-calendar oe_date"> <span t-field="blog_post.create_date"/> &amp;nbsp;</span>
<span t-if="len(blog_post.message_ids) &gt; 0" class="fa fa-comment-o">
<a t-attf-href="/blogpost/#{ slug(blog_post) }/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&amp;' or ''}#{ date and 'date=%s' % date or ''}#comments">
<a t-attf-href="#{post_url(blogpost=blog_post)}#comments">
<t t-if="len(blog_post.message_ids) &lt;= 1" ><t t-esc="len(blog_post.message_ids)"/> comment</t>
<t t-if="len(blog_post.message_ids) > 1"><t t-esc="len(blog_post.message_ids)"/> comments</t>
</a>
@ -145,7 +145,7 @@
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
<span class="fa fa-tags"/>
<t t-foreach="blog_post.tag_ids" t-as="tag">
<a t-attf-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }" t-esc="tag.name"/> &amp;nbsp;
<a t-attf-href="#{blog_url(tag=tag)}" t-esc="tag.name"/> &amp;nbsp;
</t>
</p>
</xpath>
@ -210,10 +210,9 @@
<div class="row">
<div class="col-sm-9">
<ol class="breadcrumb">
<li><a t-attf-href="/blog/#{ slug(blog) }"><span t-field="blog.name"/></a></li>
<li t-if="tag"><a t-attf-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }"><span t-field="tag.name"/></a></li>
<li t-if="tag and date"><a t-attf-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }/date/#{ date }" t-esc="date_name"/></li>
<li t-if="not tag and date"><a t-attf-href="/blog/#{ slug(blog) }/date/#{ date }" t-esc="date_name"/></li>
<li><a t-attf-href="#{blog_url(tag=None, date_begin=None, date_end=None)}"><span t-field="blog.name"/></a></li>
<li t-if="tag"><a t-attf-href="#{blog_url(date_begin=None, date_end=None)}"><span t-field="tag.name"/></a></li>
<li t-if="date"><a t-attf-href="#{blog_url(tag=None)}" t-esc="date"/></li>
<li class="active"><span t-field="blog_post.name"/></li>
</ol>
</div><div class="col-sm-3">
@ -266,7 +265,7 @@
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
<span class="fa fa-tags"/>
<t t-foreach="blog_post.tag_ids" t-as="tag">
<a t-attf-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }" t-esc="tag.name"/> &amp;nbsp;
<a t-attf-href="#{blog_url(tag=tag)}" t-esc="tag.name"/> &amp;nbsp;
</t>
</p>
</xpath>
@ -307,9 +306,9 @@
<section class="mt32">
<h4>Tags</h4>
<ul class="nav nav-pills nav-stacked">
<t t-foreach="tags" t-as="tag_id">
<li t-att-class="tag and tag_id.id == tag.id and 'active' or None" style="display: inline-block;">
<a t-attf-href="/blog/#{ slug(blog) }/tag/#{ slug(tag_id) }"><span t-field="tag_id.name"/></a>
<t t-foreach="tags" t-as="nav_tag">
<li t-att-class="tag and tag.id == nav_tag.id and 'active' or None" style="display: inline-block;">
<a t-attf-href="#{blog_url(tag=nav_tag)}"><span t-field="nav_tag.name"/></a>
</li>
</t>
</ul>
@ -325,8 +324,8 @@
<h4>Archives</h4>
<ul class="nav nav-pills nav-stacked">
<t t-foreach="nav_list" t-as="months">
<li t-att-class="months['date'] == date and 'active' or None">
<a t-ignore="True" t-attf-href="/blog/#{ slug(blog) }/#{ tag and 'tag/%s/' % slug(tag) or '' }date/#{ months['date'] }"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
<li t-att-class="months['date_begin'] == date and 'active' or None">
<a t-ignore="True" t-attf-href="#{blog_url(date_begin=months['date_begin'], date_end=months['date_end'])}"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
</li>
</t>
</ul>
@ -387,7 +386,7 @@
<ul class="nav nav-pills nav-stacked">
<t t-foreach="blogs" t-as="nav_blog">
<li t-att-class="nav_blog.id == blog.id and 'active' or ''">
<a t-attf-href="/blog/#{ slug(nav_blog) }">
<a t-attf-href="#{blog_url(blog=nav_blog)}">
<span t-field="nav_blog.name"/>
</a>
</li>

View File

@ -25,12 +25,14 @@ from openerp.addons.website.models.website import slug
class event_track_tag(osv.osv):
_name = "event.track.tag"
_order = 'name'
_columns = {
'name': fields.char('Event Track Tag')
}
class event_tag(osv.osv):
_name = "event.tag"
_order = 'name'
_columns = {
'name': fields.char('Event Tag')
}