[IMP] Improved portal autofollow system in sale orders and invoices. Minor fixes in views.
bzr revid: vta@openerp.com-20121120074552-f8h64e3d2jcc03bm
This commit is contained in:
parent
36a37823dc
commit
c4d1a21007
|
@ -435,7 +435,7 @@
|
|||
</notebook>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers"/>
|
||||
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
|
||||
<field name="message_ids" widget="mail_thread" placeholder="Share a note..."/>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
</notebook>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers"/>
|
||||
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
|
||||
<field name="message_ids" widget="mail_thread" placeholder="Share a note..."/>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_card oe_kanban_global_click">
|
||||
<div class="oe_kanban_content">
|
||||
<div>
|
||||
<h1><a type="open"><field name="name"/></a></h1>
|
||||
<div class="oe_left">
|
||||
<h1><field name="name"/></h1>
|
||||
<field name="partner_id"/> <br/>
|
||||
<field name="version_id"/>
|
||||
</div>
|
||||
|
@ -30,31 +30,56 @@
|
|||
</t>
|
||||
<field name="categ_ids"/>
|
||||
</div>
|
||||
<div class="oe_right">
|
||||
Creation: <field name="create_date"/>
|
||||
<span class="oe_kanban_highlight">
|
||||
<t t-set="priority" t-value="record.priority.raw_value || 5"/>
|
||||
<a type="object" name="set_priority" args="['3']" t-if="priority gt 3" title="Normal Priority">
|
||||
<img src="/web/static/src/img/icons/star-off.png" width="16" height="16"/>
|
||||
</a>
|
||||
<a type="object" name="set_priority" args="['5']" t-if="priority lte 3" title="Normal Priority">
|
||||
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 3 ? 'on' : 'off'}.png" width="16" height="16"/>
|
||||
</a>
|
||||
<a type="object" name="set_priority" args="['2']" title="High Priority">
|
||||
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 2 ? 'on' : 'off'}.png" width="16" height="16"/>
|
||||
</a>
|
||||
<a type="object" name="set_priority" args="['1']" title="Highest Priority">
|
||||
<img t-attf-src="/web/static/src/img/icons/star-#{priority == 1 ? 'on' : 'off'}.png" width="16" height="16"/>
|
||||
</a>
|
||||
</span>
|
||||
<t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())">
|
||||
<span t-attf-class="oe_kanban_status oe_kaban_status_red"> </span>
|
||||
</t>
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
|
||||
</div>
|
||||
<t t-if="record.stage_id.raw_value[1] == 'Analysis' or record.stage_id.raw_value[1] == 'Specification'">
|
||||
<div class="oe_text_right" style="color:blue;">
|
||||
<h1><field name="stage_id" readonly="1"/></h1>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="record.stage_id.raw_value[1] == 'Design' or record.stage_id.raw_value[1] == 'Development' or record.stage_id.raw_value[1] == 'Testing'">
|
||||
<div class="oe_text_right" style="color:#c7ffd5;">
|
||||
<h1><field name="stage_id" readonly="1"/></h1>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="record.stage_id.raw_value[1] == 'Merge'">
|
||||
<div class="oe_text_right" style="color:red;">
|
||||
<h1><field name="stage_id" readonly="1"/></h1>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="record.stage_id.raw_value[1] == 'done'">
|
||||
<div class="oe_text_right" style="color:black;">
|
||||
<h1><field name="stage_id" readonly="1"/></h1>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="record.stage_id.raw_value[1] == 'Cancelled'">
|
||||
<div class="oe_text_right" style="color:gray;">
|
||||
<h1><field name="stage_id" readonly="1"/></h1>
|
||||
</div>
|
||||
</t>
|
||||
<div class="oe_clear"></div>
|
||||
<div class="oe_right">
|
||||
Creation: <field name="create_date"/>
|
||||
<span class="oe_kanban_highlight">
|
||||
<t t-set="priority" t-value="record.priority.raw_value || 5"/>
|
||||
<a type="object" name="set_priority" args="['3']" t-if="priority gt 3" title="Normal Priority">
|
||||
<img src="/web/static/src/img/icons/star-off.png" width="16" height="16"/>
|
||||
</a>
|
||||
<a type="object" name="set_priority" args="['5']" t-if="priority lte 3" title="Normal Priority">
|
||||
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 3 ? 'on' : 'off'}.png" width="16" height="16"/>
|
||||
</a>
|
||||
<a type="object" name="set_priority" args="['2']" title="High Priority">
|
||||
<img t-attf-src="/web/static/src/img/icons/star-#{priority lte 2 ? 'on' : 'off'}.png" width="16" height="16"/>
|
||||
</a>
|
||||
<a type="object" name="set_priority" args="['1']" title="Highest Priority">
|
||||
<img t-attf-src="/web/static/src/img/icons/star-#{priority == 1 ? 'on' : 'off'}.png" width="16" height="16"/>
|
||||
</a>
|
||||
</span>
|
||||
<t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())">
|
||||
<span t-attf-class="oe_kanban_status oe_kaban_status_red"> </span>
|
||||
</t>
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_clear"></div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
|
|
|
@ -19,4 +19,5 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import account_invoice
|
||||
import account_invoice
|
||||
import sale
|
|
@ -30,7 +30,7 @@ This module adds sale menu and features to your portal if sale and portal are in
|
|||
========================================================================================
|
||||
""",
|
||||
'author': 'OpenERP SA',
|
||||
'depends': ['sale_stock','portal'],
|
||||
'depends': ['sale','portal'],
|
||||
'data': [
|
||||
'security/portal_security.xml',
|
||||
'portal_sale_view.xml',
|
||||
|
|
|
@ -21,50 +21,12 @@
|
|||
|
||||
from osv import fields,osv
|
||||
|
||||
class mail_mail(osv.osv):
|
||||
_inherit = 'mail.mail'
|
||||
class account_invoice(osv.osv):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
def _postprocess_sent_message(self, cr, uid, mail, context=None):
|
||||
if mail.model == 'account.invoice':
|
||||
so_obj = self.pool.get('sale.order')
|
||||
inv_obj = self.pool.get('account.invoice')
|
||||
|
||||
inv_follower_ids = inv_obj.read(cr, uid, mail.res_id, ['message_follower_ids'], context=context)['message_follower_ids']
|
||||
|
||||
cr.execute('SELECT rel.order_id FROM sale_order_invoice_rel AS rel WHERE rel.invoice_id='+str(mail.res_id))
|
||||
so_invoice_ids = cr.fetchall()
|
||||
so_follower_ids = []
|
||||
for so_invoice_id in so_invoice_ids:
|
||||
order_id, = so_invoice_id
|
||||
so_follower_ids += so_obj.read(cr, uid, order_id, ['message_follower_ids'], context=context)['message_follower_ids']
|
||||
|
||||
partner_ids = list(set(so_follower_ids).difference(set(inv_follower_ids)))
|
||||
|
||||
if partner_ids:
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
user_obj = self.pool.get('res.users')
|
||||
group_obj = self.pool.get('res.groups')
|
||||
|
||||
document = inv_obj.browse(cr, uid, mail.res_id, context=context)
|
||||
group_ids = []
|
||||
for partner in partner_obj.browse(cr, uid, partner_ids, context=context):
|
||||
for user_id in partner.user_ids:
|
||||
group_ids += user_id.groups_id
|
||||
if group_ids:
|
||||
for group_id in group_ids:
|
||||
if group_id.is_portal == True:
|
||||
inv_obj.message_subscribe(cr, uid, [mail.res_id], partner_ids, context=context)
|
||||
mail_values = {
|
||||
'email_from': 'vta@openerp.com',
|
||||
'email_to': 'falcobolger@gmail.com',
|
||||
'subject': 'Invitation to follow %s' % document.name_get()[0][1],
|
||||
'body_html': 'You have been invited to follow %s' % document.name_get()[0][1],
|
||||
'auto_delete': True,
|
||||
}
|
||||
mail_id = self.create(cr, uid, mail_values, context=context)
|
||||
self.send(cr, uid, [mail_id], recipient_ids=[partner['id']], context=context)
|
||||
group_ids = []
|
||||
|
||||
return super(mail_mail, self)._postprocess_sent_message(cr, uid, mail=mail, context=context)
|
||||
|
||||
mail_mail()
|
||||
def invoice_validate(self, cr, uid, ids, context=None):
|
||||
# fetch the partner's id and subscribe the partner to the sale order
|
||||
partner = self.browse(cr, uid, ids[0], context=context)['partner_id']
|
||||
if partner.id not in self.browse(cr, uid, ids[0], context=context)['message_follower_ids']:
|
||||
self.message_subscribe(cr, uid, ids, [partner.id], context=context)
|
||||
return super(account_invoice, self).invoice_validate(cr, uid, ids, context=context)
|
|
@ -61,13 +61,10 @@
|
|||
action="action_order_tree5" sequence="10"/>
|
||||
<menuitem name="Sales Orders" id="portal_sales_orders" parent="portal.portal_orders"
|
||||
action="action_order_form" sequence="20"/>
|
||||
<menuitem name="Delivery Orders" id="portal_delivery" parent="portal.portal_orders"
|
||||
action="action_picking_tree" sequence="30"/>
|
||||
|
||||
<menuitem name="Invoices" id="portal_invoices" parent="portal.portal_orders"
|
||||
action="action_invoice_tree1" sequence="40"/>
|
||||
action="action_invoice_tree1" sequence="30"/>
|
||||
<menuitem name="Credit Notes" id="portal_payments" parent="portal.portal_orders"
|
||||
action="action_vendor_receipt" sequence="50"/>
|
||||
action="action_vendor_receipt" sequence="40"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
<field name="priority"/>
|
||||
<label for="project_id"/>
|
||||
<div>
|
||||
<field name="project_id" required="True" on_change="on_change_project(project_id)" class="oe_inline" context="{'default_use_issues':1}"/>
|
||||
<field name="project_id" on_change="on_change_project(project_id)" class="oe_inline" context="{'default_use_issues':1}"/>
|
||||
<button name="case_escalate" string="Escalate" type="object" states="draft,open,pending" class="oe_inline"/>
|
||||
</div>
|
||||
<label for="task_id"/>
|
||||
|
|
|
@ -310,7 +310,7 @@
|
|||
</notebook>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers"/>
|
||||
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
|
||||
<field name="message_ids" widget="mail_thread" placeholder="Share a message..."/>
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue