[FIX] Typo regarding MP comments

This commit is contained in:
Joel Grand-Guillaume
2013-01-21 17:07:58 +01:00
parent 117fa448dd
commit f35e1ba6c7
2 changed files with 13 additions and 11 deletions

View File

@@ -51,9 +51,9 @@ Summary of constraints are:
* Remove the possibility to modify or delete a move line related to an * Remove the possibility to modify or delete a move line related to an
invoice or a bank statement, no matter what the status of the move invoice or a bank statement, no matter what the status of the move
(draft, validated or posted). This is usefule in standard context but (draft, validated or posted). This is useful in a standard context but
moreover if you're using : account_default_draft_move. This way you ensure even more if you're using `account_default_draft_move`. This way you ensure
user cannot make mistake even in draft, he must pass through the that the user cannot make mistakes even in draft state, he must pass through the
parent object to make his modification. parent object to make his modification.
""", """,

View File

@@ -48,7 +48,7 @@ class AccountMoveLine(orm.Model):
if line.invoice: if line.invoice:
err_msg = _('Invoice name (id): %s (%s)') % (line.invoice.name, str(line.invoice.id)) err_msg = _('Invoice name (id): %s (%s)') % (line.invoice.name, str(line.invoice.id))
raise osv.except_osv( raise osv.except_osv(
_('Error!'), _('Error'),
_('You cannot do this on an entry generated by an invoice. You must ' _('You cannot do this on an entry generated by an invoice. You must '
'change the related invoice directly.\n%s.') % err_msg) 'change the related invoice directly.\n%s.') % err_msg)
return True return True
@@ -58,18 +58,19 @@ class AccountMoveLine(orm.Model):
if line.statement_id: if line.statement_id:
err_msg = _('Bank statement name (id): %s (%s)') % (line.statement_id.name, str(line.statement_id.id)) err_msg = _('Bank statement name (id): %s (%s)') % (line.statement_id.name, str(line.statement_id.id))
raise osv.except_osv( raise osv.except_osv(
_('Error!'), _('Error'),
_('You cannot do this on an entry generated by a bank statement. ' _('You cannot do this on an entry generated by a bank statement. '
'You must change the related bank statement directly.\n%s.') % err_msg) 'You must change the related bank statement directly.\n%s.') % err_msg)
return True return True
def unlink(self, cr, uid, ids, context=None, check=True): def unlink(self, cr, uid, ids, context=None, check=True):
""" Add the verification of: """ Add the following checks:
- Is the move related to an invoice - Is the move related to an invoice
- Is the move related to a bank statement - Is the move related to a bank statement
In that case, we forbid the move to be deleted even if draft. We should In that case, we forbid the move to be deleted even if draft. We should
never delete directly a move line related or generated by another object. never delete directly a move line related or generated by another object.
This is mandatory if you use the all move in draft (module: account_default_draft_move) This is mandatory if you use the module setting all moves in draft
(module: account_default_draft_move)
""" """
if not context.get('from_parent_object', False): if not context.get('from_parent_object', False):
self._check_invoice_related_move(cr, uid, ids, context=context) self._check_invoice_related_move(cr, uid, ids, context=context)
@@ -77,12 +78,13 @@ class AccountMoveLine(orm.Model):
return super(AccountMoveLine, self).unlink(cr, uid, ids, context=context, check=check) return super(AccountMoveLine, self).unlink(cr, uid, ids, context=context, check=check)
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
""" Add the verification of: """ Add the following checks:
- Is the move related to an invoice - Is the move related to an invoice
- Is the move related to a bank statement - Is the move related to a bank statement
In that case, we forbid the move to be modified even if draft. We should In that case, we forbid the move to be modified even if draft. We should
never update directly a move line related or generated by another object. never update directly a move line related or generated by another object.
This is mandatory if you use the all move in draft (module: account_default_draft_move) This is mandatory if you use the module setting all moves in draft
(module: account_default_draft_move)
""" """
if not context.get('from_parent_object', False): if not context.get('from_parent_object', False):
self._check_invoice_related_move(cr, uid, ids, context=context) self._check_invoice_related_move(cr, uid, ids, context=context)
@@ -137,7 +139,7 @@ class AccountInvoice(orm.Model):
def action_cancel(self, cr, uid, ids, context=None): def action_cancel(self, cr, uid, ids, context=None):
"""Override the method to add the key 'from_parent_object' in """Override the method to add the key 'from_parent_object' in
the context. This is to allow to delete move line related to invoice the context. This is to allow to delete move line related to invoice
through the buton cancel.""" through the cancel button."""
if context is None: if context is None:
context = {} context = {}
context['from_parent_object'] = True context['from_parent_object'] = True
@@ -158,7 +160,7 @@ class AccountBankStatement(orm.Model):
def button_cancel(self, cr, uid, ids, context=None): def button_cancel(self, cr, uid, ids, context=None):
"""Override the method to add the key 'from_parent_object' in """Override the method to add the key 'from_parent_object' in
the context. This is to allow to delete move line related to bank statement the context. This is to allow to delete move line related to bank statement
through the buton cancel.""" through the cancel button."""
if context is None: if context is None:
context = {} context = {}
context['from_parent_object'] = True context['from_parent_object'] = True