Add option to force the posting of accounting move

This commit is contained in:
Andrea
2019-04-05 14:40:52 +02:00
committed by Andrea Stirpe
parent b60c1ab8e4
commit 1e66c61563
7 changed files with 41 additions and 7 deletions

View File

@@ -120,6 +120,9 @@ class AccountSpread(models.Model):
display_recompute_buttons = fields.Boolean(
compute='_compute_display_recompute_buttons',
string='Display Buttons Recompute')
display_move_line_auto_post = fields.Boolean(
compute='_compute_display_move_line_auto_post',
string='Display Button Auto-post lines')
@api.model
def default_get(self, fields):
@@ -195,6 +198,13 @@ class AccountSpread(models.Model):
if spread.invoice_id.state == 'draft':
spread.display_recompute_buttons = False
@api.multi
def _compute_display_move_line_auto_post(self):
for spread in self:
spread.display_move_line_auto_post = True
if spread.company_id.force_move_auto_post:
spread.display_move_line_auto_post = False
@api.multi
def _get_spread_entry_name(self, seq):
"""Use this method to customise the name of the accounting entry."""