-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
400 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<!-- Payment Term --> | ||
|
||
<record id="account_payment_term_riba" model="account.payment.term"> | ||
<field name="name">RiBA 30 Days End of Month</field> | ||
<field name="note">RiBA 30 Days End of Month</field> | ||
<field name="riba" eval="True"></field> | ||
</record> | ||
<record id="account_payment_term_line" model="account.payment.term.line"> | ||
<field name="value">balance</field> | ||
<field eval="30" name="days"/> | ||
<field eval="-1" name="days2"/> | ||
<field ref="account_payment_term_riba" name="payment_id"/> | ||
</record> | ||
|
||
<!-- banks --> | ||
|
||
<record id="res_bank_1" model="res.bank"> | ||
<field name="name">Bank</field> | ||
<field name="bic">CPHBBE75</field> | ||
</record> | ||
|
||
<record id="company_bank" model="res.partner.bank"> | ||
<field name="name">company account</field> | ||
<field name="acc_number">BE74126201326907</field> | ||
<field name="partner_id" ref="base.main_partner"></field> | ||
<field name="state">iban</field> | ||
<field name="bank_bic">CPHBBE75</field> | ||
<field name="bank" ref="res_bank_1"></field> | ||
</record> | ||
|
||
<record id="customer_bank" model="res.partner.bank"> | ||
<field name="name">customer account</field> | ||
<field name="acc_number">IT86Y0200809440000005235152</field> | ||
<field name="partner_id" ref="base.res_partner_12"></field> | ||
<field name="state">iban</field> | ||
<field name="bank_bic">CPHBBE75</field> | ||
<field name="bank" ref="res_bank_1"></field> | ||
</record> | ||
|
||
<!-- accounts --> | ||
|
||
<record id="sbf_effects" model="account.account"> | ||
<field name="code">SBF</field> | ||
<field name="name">SBF effects (test)</field> | ||
<field ref="account.cas" name="parent_id"/> | ||
<field name="type">receivable</field> | ||
<field eval="True" name="reconcile"/> | ||
<field name="user_type" ref="account.data_account_type_receivable"/> | ||
</record> | ||
|
||
<record id="riba_account" model="account.account"> | ||
<field name="code">RiBa</field> | ||
<field name="name">RiBa account (test)</field> | ||
<field ref="account.cas" name="parent_id"/> | ||
<field name="type">other</field> | ||
<field name="user_type" ref="account.data_account_type_asset"/> | ||
</record> | ||
|
||
<record id="unsolved_account" model="account.account"> | ||
<field name="code">UNSOLVED</field> | ||
<field name="name">Overdue effects account (test)</field> | ||
<field ref="account.cas" name="parent_id"/> | ||
<field name="type">receivable</field> | ||
<field eval="True" name="reconcile"/> | ||
<field name="user_type" ref="account.data_account_type_receivable"/> | ||
</record> | ||
|
||
<!-- Config --> | ||
|
||
<record id="sbf_riba_config" model="riba.configurazione"> | ||
<field name="name">Salvo Buon Fine</field> | ||
<field name="tipo">sbf</field> | ||
<field name="bank_id" eval="company_bank"></field> | ||
<field name="acceptance_journal_id" ref="account.bank_journal"></field> | ||
<field name="accreditation_journal_id" ref="account.bank_journal"></field> | ||
<field name="acceptance_account_id" ref="sbf_effects"></field> | ||
<field name="accreditation_account_id" ref="riba_account"></field> | ||
<field name="bank_account_id" ref="account.bnk"></field> | ||
<field name="bank_expense_account_id" ref="account.a_expense"></field> | ||
<field name="unsolved_journal_id" ref="account.bank_journal"></field> | ||
<field name="overdue_effects_account_id" ref="unsolved_account"></field> | ||
<field name="protest_charge_account_id" ref="account.a_expense"></field> | ||
</record> | ||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
- | ||
I call the wizards | ||
- | ||
!record {model: riba.emissione, id: riba_emissione_1, view: emissione_riba_view}: | ||
configurazione: sbf_riba_config | ||
- | ||
I run the wizards | ||
- | ||
!python {model: riba.emissione}: | | ||
invoice = self.pool['account.invoice'].browse( | ||
cr, uid, ref('account_invoice_riba'), context=context) | ||
for move_line in invoice.move_id.line_id: | ||
if move_line.account_id.id == ref('account.a_recv'): | ||
riba_move_line_id = move_line.id | ||
break | ||
action = self.crea_distinta(cr, uid, [ref("riba_emissione_1")], {"lang": 'en_US', | ||
"tz": False, "active_model": "account.move.line", "active_ids": [riba_move_line_id], | ||
"active_id": riba_move_line_id, }) | ||
riba_list_id = action['res_id'] | ||
list_pool = self.pool['riba.distinta'] | ||
list_pool.confirm(cr, uid, [riba_list_id], context=context) | ||
list = list_pool.browse(cr, uid, riba_list_id) | ||
assert (list.state == 'accepted'), ("RiBa list is not accepted, but %s" % list.state) | ||
invoice.refresh() | ||
assert (invoice.state == 'paid'), ("Invoice state is not paid, but %s" % invoice.state) | ||
accreditation_pool = self.pool['riba.accreditation'] | ||
accr_context = { | ||
"lang": 'en_US', | ||
"tz": False, | ||
"active_model": "riba.distinta", | ||
"active_ids": [riba_list_id], | ||
"active_id": riba_list_id, | ||
} | ||
accr_id = accreditation_pool.create(cr, uid, { | ||
'bank_amount': 445, | ||
'expense_amount': 5, | ||
}, context=accr_context) | ||
accreditation_pool.create_move(cr, uid, [accr_id], context=accr_context) | ||
list.refresh() | ||
assert (list.state == 'accredited'), ("RiBa list is not accredited, but %s" % list.state) | ||
# voucher payment | ||
voucher_pool = self.pool['account.voucher'] | ||
import netsvc | ||
vals = {} | ||
journal_id = voucher_pool.default_get(cr, uid, ['journal_id']).get('journal_id',None) | ||
voucher = voucher_pool.recompute_voucher_lines(cr, uid, [], ref("base.res_partner_12"), journal_id, 450.0, ref('base.EUR'), 'receipt', False) | ||
assert (voucher['value'].get('writeoff_amount') == 0.0), "Writeoff amount calculated by recompute_voucher_lines() is not 0.0" | ||
res = voucher_pool.onchange_partner_id(cr, uid, [], ref("base.res_partner_12"), journal_id, 0.0, 1, ttype='receipt', date=False) | ||
vals = { | ||
'account_id': ref('account.cash'), | ||
'amount': 450.0, | ||
'company_id': ref('base.main_company'), | ||
'journal_id': ref('account.bank_journal'), | ||
'partner_id': ref('base.res_partner_12'), | ||
'period_id': ref('account.period_8'), | ||
'type': 'receipt', | ||
} | ||
if not res['value']['line_cr_ids']: | ||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('sbf_effects'),}] | ||
del(res['value']['line_cr_ids'][0]['date_original']) | ||
del(res['value']['line_cr_ids'][0]['date_due']) | ||
res['value']['line_cr_ids'][0]['amount'] = 450.0 | ||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']] | ||
id = voucher_pool.create(cr, uid, vals) | ||
voucher_id = voucher_pool.browse(cr, uid, id) | ||
assert (voucher_id.writeoff_amount == 0.0), "Writeoff amount is not 0.0" | ||
assert (voucher_id.state=='draft'), "Voucher is not in draft state" | ||
wf_service = netsvc.LocalService("workflow") | ||
wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr) | ||
list.refresh() | ||
assert (list.state == 'paid'), ("RiBa list is not closed, but %s" % list.state) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
- | ||
I create an invoice and confirm it | ||
- | ||
!record {model: account.invoice, id: account_invoice_riba}: | ||
account_id: account.a_recv | ||
company_id: base.main_company | ||
currency_id: base.EUR | ||
invoice_line: | ||
- account_id: account.a_sale | ||
name: '[PCSC234] PC Assemble SC234' | ||
price_unit: 450.0 | ||
quantity: 1.0 | ||
product_id: product.product_product_3 | ||
uos_id: product.product_uom_unit | ||
journal_id: account.sales_journal | ||
partner_id: base.res_partner_12 | ||
payment_term: account_payment_term_riba | ||
- | ||
I call the "Confirm Draft Invoices" wizard | ||
- | ||
!record {model: account.invoice.confirm, id: account_invoice_confirm_0}: | ||
{} | ||
- | ||
I click on Confirm Invoices Button | ||
- | ||
!python {model: account.invoice.confirm}: | | ||
self.invoice_confirm(cr, uid, [ref("account_invoice_confirm_0")], {"lang": 'en_US', | ||
"tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_riba")], | ||
"type": "out_invoice", "active_id": ref("account_invoice_riba"), }) | ||
- | ||
I check the riba credit | ||
- | ||
!python {model: account.invoice}: | | ||
invoice = self.browse(cr, uid, ref('account_invoice_riba'), context=context) | ||
for move_line in invoice.move_id.line_id: | ||
if move_line.account_id.id == ref('account.a_recv'): | ||
line_ids = self.pool['account.move.line'].search(cr, uid, [ | ||
'&', | ||
'|', | ||
('riba','=','True'),('unsolved_invoice_ids','!=',False), | ||
('account_id.type','=','receivable'), | ||
('reconcile_id', '=', False), | ||
('distinta_line_ids', '=', False) | ||
], context=context) | ||
assert (len(line_ids) == 1), ( | ||
"There must be 1 riba line, %s found" % len(line_ids)) | ||
assert (line_ids[0] == move_line.id), ( | ||
"invoice riba credit line (%s) is different from found riba line (%s)" | ||
% (move_line.name, line_ids[0])) | ||
break |
Oops, something went wrong.