[MERGE ]Merge res log changes

bzr revid: sbh@tinyerp.com-20120514115624-zv5a5r93hlnifwn1
This commit is contained in:
Sbh (Openerp) 2012-05-14 17:26:24 +05:30
commit 06e150dd9e
7 changed files with 57 additions and 21 deletions

View File

@ -127,6 +127,7 @@ class account_bank_statement(osv.osv):
_order = "date desc, id desc"
_name = "account.bank.statement"
_description = "Bank Statement"
_inherit = ['mail.thread']
_columns = {
'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement
'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}, select=True),
@ -364,7 +365,7 @@ class account_bank_statement(osv.osv):
'name': st_number,
'balance_end_real': st.balance_end
}, context=context)
self.log(cr, uid, st.id, _('Statement %s is confirmed, journal items are created.') % (st_number,))
self.message_append_note(cr, uid, ids, body=_('Statement %s is confirmed, journal items are created.') % (st_number,), context=context)
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
def button_cancel(self, cr, uid, ids, context=None):

View File

@ -1002,7 +1002,7 @@ class account_invoice(osv.osv):
if obj_inv.type in ('out_invoice', 'out_refund'):
ctx = self.get_log_context(cr, uid, context=ctx)
message = _("Invoice '%s' is validated.") % name
self.log(cr, uid, inv_id, message, context=ctx)
self.message_append_note(cr, uid, ids, body=message, context=context)
return True
def action_cancel(self, cr, uid, ids, *args):
@ -1232,7 +1232,7 @@ class account_invoice(osv.osv):
# TODO: use currency's formatting function
msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining)") % \
(name, pay_amount, code, invoice.amount_total, code, total, code)
self.log(cr, uid, inv_id, msg)
self.message_append_note(cr, uid, ids, body=msg, context=context)
self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
# Update the stored value (fields.function), so we write to trigger recompute

View File

@ -127,8 +127,6 @@ class crm_claim(crm.crm_case, osv.osv):
for l in self.browse(cr, uid, ids):
# When coming from draft override date and stage otherwise just set state
if l.state == 'draft':
message = _("The claim '%s' has been opened.") % l.name
self.log(cr, uid, l.id, message)
stage_id = self.stage_find(cr, uid, l.section_id.id or False, [('sequence','>',0)])
if stage_id:
self.stage_set(cr, uid, [l.id], stage_id)

View File

@ -44,6 +44,7 @@ class project_scrum_sprint(osv.osv):
_name = 'project.scrum.sprint'
_description = 'Project Scrum Sprint'
_order = 'date_start desc'
_inherit = ['mail.thread']
def _compute(self, cr, uid, ids, fields, arg, context=None):
res = {}.fromkeys(ids, 0.0)
progress = {}
@ -71,28 +72,27 @@ class project_scrum_sprint(osv.osv):
def button_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
self.cancel_send_note(cr, uid, ids, context=None)
return True
def button_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'draft'}, context=context)
self.draft_send_note(cr, uid, ids, context=None)
return True
def button_open(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'open'}, context=context)
for (id, name) in self.name_get(cr, uid, ids):
message = _("The sprint '%s' has been opened.") % (name,)
self.log(cr, uid, id, message)
self.open_send_note(cr, uid, ids, context=None)
return True
def button_close(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'done'}, context=context)
for (id, name) in self.name_get(cr, uid, ids):
message = _("The sprint '%s' has been closed.") % (name,)
self.log(cr, uid, id, message)
self.close_send_note(cr, uid, ids, context=None)
return True
def button_pending(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'pending'}, context=context)
self.pending_send_note(cr, uid, ids, context=None)
return True
_columns = {
@ -138,6 +138,39 @@ class project_scrum_sprint(osv.osv):
v['date_stop'] = (datetime.now() + relativedelta(days=int(proj.sprint_size or 14))).strftime('%Y-%m-%d')
return {'value':v}
# ----------------------------------------
# OpenChatter methods and notifications
# ----------------------------------------
def create(self, cr, uid, vals, context=None):
obj_id = super(project_scrum_sprint, self).create(cr, uid, vals, context)
self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
def draft_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been set to <b>draft</b>."), context=context)
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>created</b>."), context=context)
def open_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>opened</b>."), context=context)
def pending_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been set to <b>pending</b>."), context=context)
def cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>cancelled</b>."), context=context)
def close_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been <b>closed</b>."), context=context)
project_scrum_sprint()
class project_scrum_product_backlog(osv.osv):

View File

@ -232,7 +232,8 @@
<field name="model">project.scrum.sprint</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Scrum Sprint">
<form string="Scrum Sprint" layout="manual">
<sheet layout="auto">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="project_id" on_change="onchange_project_id(project_id)"/>
@ -307,6 +308,10 @@
<button type="object" string="Close" name="button_close" states="open,pending" icon="terp-dialog-close"/>
<button type="object" string="Set to Draft" name="button_draft" states="cancel,done" icon="gtk-convert"/>
</group>
</sheet>
<div class="oe_form_sheet_width">
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</form>
</field>
</record>

View File

@ -24,6 +24,7 @@ from tools.translate import _
class backlog_sprint_assign(osv.osv_memory):
_name = 'project.scrum.backlog.assign.sprint'
_description = 'Assign sprint to backlogs'
_inherit = ['mail.thread']
_columns = {
'sprint_id': fields.many2one('project.scrum.sprint', 'Sprint', required=True, help="Select Sprint to assign backlog."),
'state_open': fields.boolean('Open Backlog', help="Change the state of product backlogs to open if its in draft state"),
@ -55,12 +56,12 @@ class backlog_sprint_assign(osv.osv_memory):
'remaining_hours':backlog.expected_hours,
})
message = _("Product Backlog '%s' is converted into Task %d.") %(backlog.name, task_id)
self.log(cr, uid, backlog.id, message)
self.message_append_note(cr, uid, ids, body=message, context=context)
if data.state_open and backlog.state == "draft":
backlog_obj.write(cr, uid, backlog.id, {'state':'open'})
sprint = sprint_obj.browse(cr, uid, data.sprint_id.id, context=context)
message = _("Product Backlog '%s' is assigned to sprint %s") %(backlog.name, sprint.name)
self.log(cr, uid, backlog.id, message)
self.message_append_note(cr, uid, ids, body=message, context=context)
backlog_obj.write(cr, uid, backlog_ids, {'sprint_id': data.sprint_id.id}, context=context)
return {'type': 'ir.actions.act_window_close'}

View File

@ -290,8 +290,6 @@ class purchase_order(osv.osv):
for line in po.order_line:
if line.state=='draft':
todo.append(line.id)
message = _("Purchase order '%s' is confirmed.") % (po.name,)
self.log(cr, uid, po.id, message)
# current_name = self.name_get(cr, uid, ids)[0][1]
self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context)
for id in ids:
@ -327,9 +325,7 @@ class purchase_order(osv.osv):
# Deleting the existing instance of workflow for PO
wf_service.trg_delete(uid, 'purchase.order', p_id, cr)
wf_service.trg_create(uid, 'purchase.order', p_id, cr)
for (id,name) in self.name_get(cr, uid, ids):
message = _("Purchase order '%s' has been set in draft state.") % name
self.log(cr, uid, id, message)
self.draft_send_note(cr, uid, ids, context=None)
return True
def action_invoice_create(self, cr, uid, ids, context=None):
@ -433,8 +429,7 @@ class purchase_order(osv.osv):
for (id, name) in self.name_get(cr, uid, ids):
wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_cancel', cr)
message = _("Purchase order '%s' is cancelled.") % name
self.log(cr, uid, id, message)
self.cancel_send_note(cr, uid, ids, context)
return True
def _prepare_order_picking(self, cr, uid, order, context=None):
@ -688,6 +683,9 @@ class purchase_order(osv.osv):
def invoice_done_send_note(self, cr, uid, ids, context=None):
self.message_append_note(cr, uid, ids, body=_("Invoice <b>paid</b>."), context=context)
def draft_send_note(self, cr, uid, ids, context=None):
return self.message_append_note(cr, uid, ids, body=_("Purchase Order has been set to <b>draft</b>."), context=context)
def cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):