34
34
# US-822 counterpart for BS account
35
35
'ye_pl_cp_for_bs_debit_bal_account': fields.many2one('account.account',
36
'Counterpart for B/S debit balance'),
36
'Counterpart for B/S debit balance',
37
domain=['|', ('user_type.code', 'in', ('income', 'expense', 'equity')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
37
38
'ye_pl_cp_for_bs_credit_bal_account': fields.many2one('account.account',
38
'Counterpart for B/S credit balance'),
39
'Counterpart for B/S credit balance',
40
domain=['|', ('user_type.code', 'in', ('income', 'expense')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
40
42
# US-822 PL/BS matrix of dev2/dev3 accounts"
41
43
'ye_pl_pos_credit_account': fields.many2one('account.account',
42
'Credit Account for P&L>0 (Income account)'),
44
'Credit Account for P&L>0 (Income account)',
45
domain=[('user_type.code', '=', 'income')]),
43
46
'ye_pl_pos_debit_account': fields.many2one('account.account',
44
47
'Debit Account for P&L>0 (B/S account)',
45
48
domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
47
50
'Credit Account P&L<0 (B/S account)',
48
51
domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
49
52
'ye_pl_ne_debit_account': fields.many2one('account.account',
50
'Debit Account P&L<0 (Expense account)'),
53
'Debit Account P&L<0 (Expense account)',
54
domain=[('user_type.code', '=', 'expense')]),
329
333
create state valid JI in its CCY/JE
331
name = "EOY-%d-%s-%s-%s" % (fy_year, account_code,
332
instance_rec.code, ccy_code, )
335
name = 'Balance move to 0'
335
338
'account_id': account_id,
473
476
create state valid JI in its CCY/JE
475
name = self._book_pl_results_seqnum_pattern % (fy_year,
476
instance_rec.code, cpy_rec.currency_id.name, )
479
481
'account_id': account_rec.id,
573
575
create draft CCY/JE to log JI into
575
name = "IB-%d-%s-%s-%s" % (fy_year, account_code,
577
name = "IB-%d-%s-%s-%s" % (fy_year + 1, account_code,
576
578
instance_rec.code, ccy_code, )
596
598
create state valid JI in its CCY/JE
599
name = "IB-%d-%s-%s-%s" % (fy_year, account_code,
600
instance_rec.code, ccy_code, )
600
default_name = 'Balance report / Previous Fiscal Year'
603
603
'account_id': account_id,
607
607
'document_date': posting_date,
608
608
'instance_id': instance_rec.id,
609
609
'journal_id': journal_id,
610
'name': name or default_name,
611
611
'period_id': period_id,
612
612
'source_date': posting_date,
713
713
if not cr.rowcount:
716
re_account_found_in_bs = False
717
716
je_by_acc_ccy = {} # JE/ ACC/CCY, key: (acc_id, ccy_id), value: JE id
718
717
for account_id, account_code, ccy_id, ccy_code, \
719
718
balance_currency, balance in cr.fetchall():
733
732
account_id=account_id, account_code=account_code,
734
733
balance_currency=balance_currency, balance=balance, je_id=je_id)
736
if not re_account_found_in_bs:
737
# Regular/Equity account result entry for P&L
739
# invert balance amount to debit or credit amount after account dispatch
742
je_id = je_by_acc_ccy.get(
743
(re_account_rec.id, cpy_rec.currency_id.id, ), False)
745
je_id = create_journal_entry(ccy_id=ccy_id,
746
ccy_code=cpy_rec.currency_id.name,
747
account_id=re_account_rec.id,
748
account_code=re_account_rec.code)
749
create_journal_item(ccy_id=cpy_rec.currency_id.id,
735
# Regular/Equity account result entry for P&L
736
# => invert balance amount to debit or credit amount after account dispatch
737
je_id = je_by_acc_ccy.get(
738
(re_account_rec.id, cpy_rec.currency_id.id, ), False)
740
je_id = create_journal_entry(ccy_id=ccy_id,
750
741
ccy_code=cpy_rec.currency_id.name,
751
account_id=re_account_rec.id, account_code=re_account_rec.code,
752
balance_currency=pl_balance, balance=pl_balance, je_id=je_id,
753
name="P&L Result report / Previous Fiscal Year")
742
account_id=re_account_rec.id,
743
account_code=re_account_rec.code)
744
create_journal_item(ccy_id=cpy_rec.currency_id.id,
745
ccy_code=cpy_rec.currency_id.name,
746
account_id=re_account_rec.id, account_code=re_account_rec.code,
747
balance_currency=pl_balance, balance=pl_balance, je_id=je_id,
748
name="P&L Result report / Previous Fiscal Year")
755
750
def update_fy_state(self, cr, uid, fy_id, reopen=False, context=None):
756
751
def hq_close_post_entries(period_ids):