Skip to content

Commit

Permalink
Merge pull request #2 from nbessi/nbi_fix_test_for_travis
Browse files Browse the repository at this point in the history
Fix sepa tests
  • Loading branch information
nbessi committed Jul 2, 2014
2 parents 233231b + 9ad4bf2 commit f3e8b32
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 60 deletions.
5 changes: 4 additions & 1 deletion l10n_ch_sepa/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
"author": "Camptocamp",
"depends": [
"account",
"l10n_ch"
"l10n_ch",
"l10n_ch_base_bank",
"base_iban",
"account_payment",
],
"data": [
"wizard/wiz_pain_001_view.xml",
Expand Down
4 changes: 2 additions & 2 deletions l10n_ch_sepa/base_sepa/pain_001.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _check_data(self):
raise orm.except_orm(_('ErrorCompanyBankBIC'),
_('The selected company bank account has no '
'BIC number'))
if (not cp_bank_acc.iban
if (not cp_bank_acc.state == 'iban'
and not cp_bank_acc.get_account_number()):
raise orm.except_orm(
_('ErrorCompanyBankAccNumber'),
Expand All @@ -106,7 +106,7 @@ def _check_data(self):
_('ErrorCreditorBankBIC'),
_('Creditor bank account has no BIC number for invoice %s')
% (line.name,))
if (not crd_bank_acc.iban
if (not crd_bank_acc.state == 'iban'
and not crd_bank_acc.get_account_number()):
raise orm.except_orm(
_('ErrorCompanyBankAccNumber'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<%def name="acc_id(bank_acc)">
<Id>
% if bank_acc.state == 'iban':
<IBAN>${bank_acc.iban.replace(' ', '')}</IBAN>
<IBAN>${bank_acc.acc_number.replace(' ', '')}</IBAN>
% else:
<Othr>
<Id>${bank_acc.get_account_number()}</Id>
Expand Down
53 changes: 25 additions & 28 deletions l10n_ch_sepa/test/pain001_ch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
-
!record {model: res.partner.bank, id: pain001_ch_partner_bank}:
state: 'iban'
name: 'Account'
name: 'Account'
bank: pain001_ch_bank
iban: 'CH9100767000S00023455'
acc_number: 'CH9100767000S00023455'
partner_id: base.res_partner_2

-
I create a bank account
-
!record {model: res.partner.bank, id: pain001_ch_company_bank}:
state: 'iban'
name: 'Account for company'
name: 'Account for company'
bank: pain001_ch_bank
iban: 'CH9100767000S00023455'
acc_number: 'CH9100767000S00023455'
partner_id: base.main_partner


Expand All @@ -39,39 +39,30 @@
journal: !ref {model: account.journal, search: "[('type','=','bank')]"}

-
I create an invoice on 1st January for 7000 EUR
I create an invoice on 1st January for 7000 EUR
###########################
# Creating 1 invoice #
###########################
# Creating 1 invoice #
###########################
-
!record {model: account.invoice, id: pain001_ch_account_invoice}:
!record {model: account.invoice, id: pain001_ch_account_invoice, view: account.invoice_supplier_form}:
company_id: base.main_company
journal_id: account.bank_journal
currency_id: base.EUR
account_id: account.a_pay
type : in_invoice
partner_id: base.res_partner_2
address_contact_id: base.res_partner_address_8
address_invoice_id: base.res_partner_address_8
commercial_partner_id : base.res_partner_2
reference_type: bvr
reference: 111111111111111111111111111111
reference: 111111111111111111111111111111
date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
period_id: account.period_1
#invoice_line:
partner_bank_id: pain001_ch_company_bank
check_total : 1000
-
I add an invoice line
-
!record {model: account.invoice.line, id: pain001_ch_invoice_line}:
account_id: account.a_expense
name: '[PC1] Basic PC'
price_unit: 1000.0
quantity: 1.0
product_id: product.product_product_pc1
uos_id: product.product_uom_unit
invoice_id: pain001_ch_account_invoice

invoice_line:
- account_id: account.a_expense
price_unit: 1000.0
quantity: 1.0
product_id: product.product_product_5

-
I Validate invoice by clicking on Validate button
Expand All @@ -81,8 +72,8 @@
-
I create my payment order to pay my invoice
###########################
# Doing payment order #
###########################
# Doing payment order #
###########################
-
!record {model: payment.order, id: pain001_ch_payment_order}:
#date_created
Expand Down Expand Up @@ -123,15 +114,21 @@
-
I confirm my payment order
-
!workflow {model: payment.order, action: open, ref: pain001_ch_payment_order}
!workflow {model: payment.order, action: open, ref: pain001_ch_payment_order}

-
I set country to main company
-

!record {model: res.partner, id: base.main_partner}:
country_id: base.ch

-
I use the pain001 wizard to generate the pain 001 message
-
!python {model: wizard.pain001}: |
import base64
wiz_id = self.create(cr,uid,[])
wiz_id = self.create(cr,uid,{})
wiz = self.browse(cr, uid, wiz_id)

pay_order_id = ref("pain001_ch_payment_order")
Expand Down
55 changes: 27 additions & 28 deletions l10n_ch_sepa/test/pain001_eu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
-
!record {model: res.partner.bank, id: pain001_partner_bank}:
state: 'iban'
name: 'Account'
name: 'Account'
bank: pain001_bank
iban: 'CH9100767000S00023455'
acc_number: 'CH9100767000S00023455'
partner_id: base.res_partner_2

-
I create a bank account
-
!record {model: res.partner.bank, id: pain001_company_bank}:
state: 'iban'
name: 'Account for company'
name: 'Account for company'
bank: pain001_bank
iban: 'CH9100767000S00023455'
acc_number: 'CH9100767000S00023455'
partner_id: base.main_partner


Expand All @@ -38,40 +38,32 @@
journal: !ref {model: account.journal, search: "[('type','=','bank')]"}

-
I create an invoice on 1st January for 7000 EUR
I create an invoice on 1st January for 7000 EUR
###########################
# Creating 1 invoice #
###########################
# Creating 1 invoice #
###########################
-
!record {model: account.invoice, id: pain001_account_invoice}:
!record {model: account.invoice, id: pain001_account_invoice, view: account.invoice_supplier_form}:
company_id: base.main_company
journal_id: account.bank_journal
currency_id: base.EUR
account_id: account.a_pay
type : in_invoice
partner_id: base.res_partner_2
address_contact_id: base.res_partner_address_8
address_invoice_id: base.res_partner_address_8
reference_type: bvr
reference: 111111111111111111111111111111
reference: 111111111111111111111111111111
date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
period_id: account.period_1
#invoice_line:
partner_bank_id: pain001_company_bank
check_total : 1000
-
I add an invoice line
-
!record {model: account.invoice.line, id: pain001_invoice_line}:
account_id: account.a_expense
name: '[PC1] Basic PC'
price_unit: 1000.0
quantity: 1.0
product_id: product.product_product_pc1
uos_id: product.product_uom_unit
invoice_id: pain001_account_invoice


invoice_line:
- account_id: account.a_expense
name: 'a name'
price_unit: 1000.0
quantity: 1.0
product_id: product.product_product_5
uos_id: product.product_uom_unit
journal_id: account.expenses_journal
-
I Validate invoice by clicking on Validate button
-
Expand All @@ -80,8 +72,8 @@
-
I create my payment order to pay my invoice
###########################
# Doing payment order #
###########################
# Doing payment order #
###########################
-
!record {model: payment.order, id: pain001_payment_order}:
#date_created
Expand Down Expand Up @@ -124,12 +116,19 @@
-
!workflow {model: payment.order, action: open, ref: pain001_payment_order}

-
I set country to main company
-

!record {model: res.partner, id: base.main_partner}:
country_id: base.ch

-
Use the wizard to generate the pain 001 message
-
!python {model: wizard.pain001}: |
import base64
wiz_id = self.create(cr, uid, [])
wiz_id = self.create(cr, uid, {})
wiz = self.browse(cr, uid, wiz_id)

pay_order_id = ref("pain001_payment_order")
Expand Down

0 comments on commit f3e8b32

Please sign in to comment.