mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[WIP] add proper search for period.
This commit is contained in:
committed by
Stefan Rijnhart
parent
98fb49aea2
commit
6ef58a47e7
@@ -28,13 +28,15 @@ class AccountMoveLine(orm.Model):
|
||||
|
||||
def create(self, cr, uid, vals, context=None, check=True):
|
||||
"""If requested, override period from date."""
|
||||
ctx = context.copy() or {}
|
||||
if (('override_period_from_date' in ctx or
|
||||
'period_id' not in vals) and 'date' in vals):
|
||||
period_model = self.pool['account.period']
|
||||
period_ids = period_search
|
||||
## BE CAREFULL, ALSO CHECK COMPANY
|
||||
vals['period_id'] = period_ids[0]
|
||||
ctx = context.copy() or {}
|
||||
if (('override_period_from_date' in ctx or
|
||||
'period_id' not in vals) and 'date' in vals):
|
||||
period_model = self.pool['account.period']
|
||||
search_date = 'date' in vals and vals['date'] or None
|
||||
period_ids = period_model.find(
|
||||
cr, uid, dt=search_date, context=ctx)
|
||||
if period_ids:
|
||||
vals['period_id'] = period_ids[0]
|
||||
return super(AccountMoveLine, self).create(
|
||||
cr, uid, vals, context=context, check=check)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user