[IMP] Task-849 Improvement log Message for account and mrp

bzr revid: ksa@tinyerp.co.in-20100603115642-p6dqe7d57a1adekm
This commit is contained in:
ksa (Open ERP)
2010-06-03 17:26:42 +05:30
parent 3eb13e257f
commit 51dbc8c418
2 changed files with 28 additions and 19 deletions
+13 -8
View File
@@ -862,7 +862,6 @@ class account_invoice(osv.osv):
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name})
self.pool.get('account.move').post(cr, uid, [move_id])
self._log_event(cr, uid, ids)
return True
def line_get_convert(self, cr, uid, x, part, date, context=None):
@@ -916,6 +915,7 @@ class account_invoice(osv.osv):
'WHERE account_move_line.move_id = %s ' \
'AND account_analytic_line.move_id = account_move_line.id',
(ref, move_id))
self._log_event(cr, uid, ids)
return True
def action_cancel(self, cr, uid, ids, *args):
@@ -951,13 +951,18 @@ class account_invoice(osv.osv):
return taxes.values()
def _log_event(self, cr, uid, ids, factor=1.0, name='Open Invoice'):
#TODO: implement messages system
for invoice in self.browse(cr, uid, ids):
for (id,number) in self.name_get(cr, uid, ids):
inv_number = number.split('/')[-1]
message = _('Invoice ') + " '" + _('INV/')+ inv_number + "' "+ _("Opened,")+_('journal entries')+ "' " + invoice.move_id.name + "' "+_("Created")
self.log(cr, uid, id, message)
return True
for (invoice_id,number) in self.name_get(cr, uid, ids):
invoice = self.browse(cr,uid,invoice_id)
message = ("%s %s %s %s %s %s %s") % (
_('Invoice'),
_("INV/"),
number.split('/')[-1],
_("Opened,"),
_('journal entries'),
invoice.move_id.name,
_("Created"))
self.log(cr, uid, invoice_id, message)
return True
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
+15 -11
View File
@@ -647,19 +647,23 @@ class mrp_production(osv.osv):
""" Changes the production state to Ready and location id of stock move.
@return: True
"""
for production in self.browse(cr, uid, ids):
production = self.browse(cr, uid, [production.id])[0]
s_date = datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S')
for (id,name) in self.name_get(cr, uid, ids):
message = _('Manufacturing Order ') + " '" + name + "' "+ _("scheduled the") + " "
message += s_date.strftime('%Y-%m-%d') + " " + _("for") + " " + production.product_id.default_code
self.log(cr, uid, id, message)
move_obj = self.pool.get('stock.move')
self.write(cr, uid, ids, {'state': 'ready'})
if production.move_prod_id:
move_obj.write(cr, uid, [production.move_prod_id.id],
{'location_id': production.location_dest_id.id})
for (production_id,name) in self.name_get(cr, uid, ids):
production = self.browse(cr, uid, production_id)
if production.move_prod_id:
move_obj.write(cr, uid, [production.move_prod_id.id],
{'location_id': production.location_dest_id.id})
message = ("%s %s %s %s %s %s") % (
_('Manufacturing Order '),
name,
_("scheduled the"),
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'),
_("for"),
production.product_id.default_code)
self.log(cr, uid, production_id, message)
return True
def action_production_end(self, cr, uid, ids):