mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX] fix according to functionnal tests
This commit is contained in:
@@ -138,7 +138,8 @@ class EasyReconcileBase(models.AbstractModel):
|
||||
|
||||
def last_period(mlines):
|
||||
period_ids = [ml['period_id'] for ml in mlines]
|
||||
return max(period_ids, key=attrgetter('date_stop'))
|
||||
periods = self.env['account.period'].browse(period_ids)
|
||||
return max(periods, key=attrgetter('date_stop'))
|
||||
|
||||
def last_date(mlines):
|
||||
return max(mlines, key=itemgetter('date'))
|
||||
@@ -193,11 +194,11 @@ class EasyReconcileBase(models.AbstractModel):
|
||||
period_id = self.env['account.period'].find(dt=date)[0]
|
||||
if self.analytic_account_id:
|
||||
rec_ctx['analytic_id'] = self.analytic_account_id.id
|
||||
ml_obj.with_context(rec_ctx).reconcile(
|
||||
line_ids,
|
||||
line_rs = ml_obj.browse(line_ids)
|
||||
line_rs.with_context(rec_ctx).reconcile(
|
||||
type='auto',
|
||||
writeoff_acc_id=writeoff_account_id,
|
||||
writeoff_period_id=period_id,
|
||||
writeoff_period_id=period_id.id,
|
||||
writeoff_journal_id=self.journal_id.id
|
||||
)
|
||||
return True, True
|
||||
@@ -229,12 +230,12 @@ class EasyReconcileBase(models.AbstractModel):
|
||||
period_id = self.env['account.period'].find(dt=date)[0]
|
||||
if self.analytic_account_id:
|
||||
rec_ctx['analytic_id'] = self.analytic_account_id.id
|
||||
ml_obj.with_context(rec_ctx).reconcile_partial(
|
||||
line_ids,
|
||||
line_rs = ml_obj.browse(line_ids)
|
||||
line_rs.with_context(rec_ctx).reconcile(
|
||||
type='manual',
|
||||
writeoff_acc_id=writeoff_account_id,
|
||||
writeoff_period_id=period_id,
|
||||
writeoff_journal_id=self.journal_id.id,
|
||||
writeoff_period_id=period_id.id,
|
||||
writeoff_journal_id=self.journal_id.id
|
||||
)
|
||||
return True, False
|
||||
return False, False
|
||||
|
||||
@@ -136,7 +136,7 @@ The lines should have the same amount (with the write-off) and the same referenc
|
||||
<field name="income_exchange_account_id" groups="base.group_multi_currency"/>
|
||||
<field name="expense_exchange_account_id" groups="base.group_multi_currency"/>
|
||||
<field name="journal_id" attrs="{'required':[('write_off','>',0)]}"/>
|
||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="analytic_account_id" domain="[('type', '!=', 'view')]" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="date_base_on"/>
|
||||
</form>
|
||||
</field>
|
||||
@@ -156,7 +156,7 @@ The lines should have the same amount (with the write-off) and the same referenc
|
||||
<field name="income_exchange_account_id" groups="base.group_multi_currency"/>
|
||||
<field name="expense_exchange_account_id" groups="base.group_multi_currency"/>
|
||||
<field name="journal_id" attrs="{'required':[('write_off','>',0)]}"/>
|
||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="analytic_account_id" domain="[('type', '!=', 'view')]" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="date_base_on"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -38,13 +38,13 @@ class EasyReconcileHistory(models.Model):
|
||||
for reconcile in self.reconcile_ids:
|
||||
move_lines = reconcile.mapped('line_id')
|
||||
move_line_ids.extend(move_lines.ids)
|
||||
self.reconcile_line_ids = move_line_ids
|
||||
self.reconcile_line_ids = (6, 0, move_line_ids)
|
||||
|
||||
move_line_ids = []
|
||||
for reconcile in self.reconcile_partial_ids:
|
||||
move_lines = reconcile.mapped('line_partial_ids')
|
||||
move_line_ids.extend(move_lines.ids)
|
||||
self.partial_line_ids = move_line_ids
|
||||
self.partial_line_ids = (6, 0, move_line_ids)
|
||||
|
||||
easy_reconcile_id = fields.Many2one(
|
||||
'account.easy.reconcile',
|
||||
|
||||
@@ -54,7 +54,6 @@ class EasyReconcileSimple(models.AbstractModel):
|
||||
if not check:
|
||||
continue
|
||||
reconciled, dummy = self._reconcile_lines(
|
||||
self,
|
||||
[credit_line, debit_line],
|
||||
allow_partial=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user