).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
@@ -23,11 +23,10 @@
# Init Sales
#----------------------------------------------------------
-import payment
+import account_payment
import wizard
import account_move_line
import account_invoice
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py
index 5cdc1254976..cd0e162df17 100644
--- a/addons/account_payment/__openerp__.py
+++ b/addons/account_payment/__openerp__.py
@@ -41,14 +41,14 @@
'wizard/account_payment_pay_view.xml',
'wizard/account_payment_populate_statement_view.xml',
'wizard/account_payment_create_order_view.xml',
- 'payment_view.xml',
- 'payment_workflow.xml',
- 'payment_sequence.xml',
+ 'account_payment_view.xml',
+ 'account_payment_workflow.xml',
+ 'account_payment_sequence.xml',
'account_invoice_view.xml',
- 'payment_report.xml',
-
+ 'account_payment_report.xml',
],
'demo_xml': [],
+ 'test': ['test/account_payment.yml'],
'installable': True,
'active': False,
'certificate': '0061703998541',
diff --git a/addons/account_payment/account_move_line.py b/addons/account_payment/account_move_line.py
index 07fbcbbb237..27455183afd 100644
--- a/addons/account_payment/account_move_line.py
+++ b/addons/account_payment/account_move_line.py
@@ -18,7 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
-
+from operator import itemgetter
from osv import fields, osv
from tools.translate import _
@@ -42,7 +42,7 @@ class account_move_line(osv.osv):
WHERE move_line_id = ml.id
AND po.state != 'cancel') as amount
FROM account_move_line ml
- WHERE id =ANY(%s)""" ,(ids,))
+ WHERE id IN %s""", (tuple(ids),))
r=dict(cr.fetchall())
return r
@@ -58,8 +58,10 @@ class account_move_line(osv.osv):
END - coalesce(sum(pl.amount_currency), 0)
FROM payment_line pl
INNER JOIN payment_order po ON (pl.order_id = po.id)
- WHERE move_line_id = l.id AND po.state != 'cancel')''' \
- + x[1] + str(x[2])+' ',args))
+ WHERE move_line_id = l.id
+ AND po.state != 'cancel'
+ ) %(operator)s %%s ''' % {'operator': x[1]}, args))
+ sql_args = tuple(map(itemgetter(2), args))
cr.execute(('''select id
from account_move_line l
@@ -68,7 +70,7 @@ class account_move_line(osv.osv):
where type=%s and active)
and reconcile_id is null
and credit > 0
- and ''' + where + ' and ' + query), ('payable',) )
+ and ''' + where + ' and ' + query), ('payable',)+sql_args )
res = cr.fetchall()
if not len(res):
diff --git a/addons/account_payment/payment.py b/addons/account_payment/account_payment.py
similarity index 71%
rename from addons/account_payment/payment.py
rename to addons/account_payment/account_payment.py
index 8e300f7072a..15754399927 100644
--- a/addons/account_payment/payment.py
+++ b/addons/account_payment/account_payment.py
@@ -18,42 +18,38 @@
# along with this program. If not, see .
#
##############################################################################
-
-from osv import fields
-from osv import osv
import time
-import netsvc
-import pooler
+from osv import osv, fields
+import netsvc
class payment_type(osv.osv):
_name= 'payment.type'
_description= 'Payment Type'
_columns= {
- 'name': fields.char('Name', size=64, required=True,help='Payment Type'),
- 'code': fields.char('Code', size=64, required=True,help='Specifies the Code for Payment Type'),
+ 'name': fields.char('Name', size=64, required=True, help='Payment Type'),
+ 'code': fields.char('Code', size=64, required=True, help='Specifies the Code for Payment Type'),
'suitable_bank_types': fields.many2many('res.partner.bank.type',
'bank_type_payment_type_rel',
- 'pay_type_id','bank_type_id',
+ 'pay_type_id', 'bank_type_id',
'Suitable bank types')
- }
+ }
payment_type()
-
class payment_mode(osv.osv):
_name= 'payment.mode'
_description= 'Payment Mode'
_columns= {
- 'name': fields.char('Name', size=64, required=True,help='Mode of Payment'),
+ 'name': fields.char('Name', size=64, required=True, help='Mode of Payment'),
'bank_id': fields.many2one('res.partner.bank', "Bank account",
required=True,help='Bank Account for the Payment Mode'),
'journal': fields.many2one('account.journal', 'Journal', required=True,
- domain=[('type', '=', 'cash')],help='Cash Journal for the Payment Mode'),
- 'type': fields.many2one('payment.type','Payment type',required=True,help='Select the Payment Type for the Payment Mode.'),
+ domain=[('type', '=', 'cash')], help='Cash Journal for the Payment Mode'),
+ 'type': fields.many2one('payment.type', 'Payment type', required=True, help='Select the Payment Type for the Payment Mode.'),
}
- def suitable_bank_types(self,cr,uid,payment_code=None,context={}):
+ def suitable_bank_types(self, cr, uid, payment_code=None, context={}):
"""Return the codes of the bank type that are suitable
for the given payment type code"""
if not payment_code:
@@ -66,16 +62,14 @@ class payment_mode(osv.osv):
where pm.id = %s """, [payment_code])
return [x[0] for x in cr.fetchall()]
-
payment_mode()
-
class payment_order(osv.osv):
_name = 'payment.order'
_description = 'Payment Order'
_rec_name = 'reference'
- def get_wizard(self,type):
+ def get_wizard(self, type):
logger = netsvc.Logger()
logger.notifyChannel("warning", netsvc.LOG_WARNING,
"No wizard found for the payment type '%s'." % type)
@@ -102,10 +96,10 @@ class payment_order(osv.osv):
('cancel','Cancelled'),
('done','Done')], 'State', select=True,
help='When an order is placed the state is \'Draft\'.\n Once the bank is confirmed the state is set to \'Confirmed\'.\n Then the order is paid the state is \'Done\'.'),
- 'line_ids': fields.one2many('payment.line','order_id','Payment lines',states={'done':[('readonly',True)]}),
+ 'line_ids': fields.one2many('payment.line', 'order_id', 'Payment lines', states={'done':[('readonly',True)]}),
'total': fields.function(_total, string="Total", method=True,
type='float'),
- 'user_id': fields.many2one('res.users','User', required=True, states={'done':[('readonly',True)]}),
+ 'user_id': fields.many2one('res.users', 'User', required=True, states={'done':[('readonly',True)]}),
'date_prefered': fields.selection([
('now', 'Directly'),
('due', 'Due date'),
@@ -131,10 +125,10 @@ class payment_order(osv.osv):
return True
def action_open(self, cr, uid, ids, *args):
- for order in self.read(cr,uid,ids,['reference']):
+ for order in self.read(cr, uid, ids, ['reference']):
if not order['reference']:
reference = self.pool.get('ir.sequence').get(cr, uid, 'payment.order')
- self.write(cr,uid,order['id'],{'reference':reference})
+ self.write(cr, uid, order['id'],{'reference':reference})
return True
def set_done(self, cr, uid, id, *args):
@@ -146,24 +140,13 @@ class payment_order(osv.osv):
payment_order()
-
class payment_line(osv.osv):
_name = 'payment.line'
_description = 'Payment Line'
- #~ def partner_payable(self, cr, uid, ids, name, args, context={}):
- #~ if not ids: return {}
- #~ partners= self.read(cr, uid, ids, ['partner_id'], context)
- #~ partners= dict(map(lambda x: (x['id'], x['partner_id'][0]), partners))
- #~ debit = self.pool.get('res.partner')._debit_get(cr, uid,
- #~ partners.values(), name, args, context)
- #~ for i in partners:
- #~ partners[i] = debit[partners[i]]
- #~ return partners
def translate(self, orig):
return {
-# "to_pay": "credit",
"due_date": "date_maturity",
"reference": "ref"}.get(orig, orig)
@@ -180,7 +163,7 @@ class payment_line(osv.osv):
st=ads.street and ads.street or ''
st1=ads.street2 and ads.street2 or ''
if 'zip_id' in ads:
- zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr,uid,[ads.zip_id.id])[0][1] or ''
+ zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
else:
zip=ads.zip and ads.zip or ''
city= ads.city and ads.city or ''
@@ -206,7 +189,7 @@ class payment_line(osv.osv):
st=ads.street and ads.street or ''
st1=ads.street2 and ads.street2 or ''
if 'zip_id' in ads:
- zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr,uid,[ads.zip_id.id])[0][1] or ''
+ zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
else:
zip=ads.zip and ads.zip or ''
city= ads.city and ads.city or ''
@@ -225,14 +208,14 @@ class payment_line(osv.osv):
from account_move_line ml
inner join payment_line pl
on (ml.id = pl.move_line_id)
- where pl.id =ANY(%s)""",
- (self.translate(name),ids,))
+ where pl.id IN %%s"""% self.translate(name),
+ (tuple(ids),))
res = dict(cr.fetchall())
if name == 'partner_id':
partner_name = {}
- for p_id, p_name in partner_obj.name_get(cr,uid,
- filter(lambda x:x and x != 0,res.values()),context=context):
+ for p_id, p_name in partner_obj.name_get(cr, uid,
+ filter(lambda x:x and x != 0,res.values()), context=context):
partner_name[p_id] = p_name
for id in ids:
@@ -245,61 +228,6 @@ class payment_line(osv.osv):
res.setdefault(id, (False, ""))
return res
-# def _currency(self, cursor, user, ids, name, args, context=None):
-# if not ids:
-# return {}
-# res = {}
-#
-# currency_obj = self.pool.get('res.currency')
-# account_obj = self.pool.get('account.account')
-# cursor.execute('''SELECT pl.id, ml.currency_id, ml.account_id
-# FROM account_move_line ml
-# INNER JOIN payment_line pl
-# ON (ml.id = pl.move_line_id)
-# WHERE pl.id in (''' + ','.join([str(x) for x in ids]) + ')')
-#
-# res2 = {}
-# account_ids = []
-# for payment_line_id, currency_id, account_id in cursor.fetchall():
-# res2[payment_line_id] = [currency_id, account_id]
-# account_ids.append(account_id)
-#
-# account2currency_id = {}
-# for account in account_obj.browse(cursor, user, account_ids,
-# context=context):
-# account2currency_id[account.id] = account.company_currency_id.id
-#
-# for payment_line_id in ids:
-# if res2[payment_line_id][0]:
-# res[payment_line_id] = res2[payment_line_id][0]
-# else:
-# res[payment_line_id] = \
-# account2currency_id[res2[payment_line_id][1]]
-#
-# currency_names = {}
-# for currency_id, name in currency_obj.name_get(cursor, user, res.values(),
-# context=context):
-# currency_names[currency_id] = name
-# for payment_line_id in ids:
-# res[payment_line_id] = (res[payment_line_id],
-# currency_names[res[payment_line_id]])
-# return res
-#
-# def _to_pay_currency(self, cursor, user, ids, name , args, context=None):
-# if not ids:
-# return {}
-#
-# cursor.execute('''SELECT pl.id,
-# CASE WHEN ml.amount_currency < 0
-# THEN - ml.amount_currency
-# ELSE ml.credit
-# END
-# FROM account_move_line ml
-# INNER JOIN payment_line pl
-# ON (ml.id = pl.move_line_id)
-# WHERE pl.id in (''' + ','.join([str(x) for x in ids]) + ')')
-# return dict(cursor.fetchall())
-
def _amount(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
@@ -335,15 +263,6 @@ class payment_line(osv.osv):
else:
return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
-# def select_move_lines(*a):
-# print a
-# return []
-
-# def create(self, cr, uid, vals, context):
-# print "created!!!"
-# vals['company_currency'] = self._get_currency(cr, uid, context)
-# return super(payment_line, self).create(cr, uid, vals, context)
-
def _get_ml_inv_ref(self, cr, uid, ids, *a):
res={}
for id in self.browse(cr, uid, ids):
@@ -373,42 +292,28 @@ class payment_line(osv.osv):
_columns = {
'name': fields.char('Your Reference', size=64, required=True),
- 'communication': fields.char('Communication', size=64, required=True,help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
- 'communication2': fields.char('Communication 2', size=64,help='The successor message of Communication.'),
- 'move_line_id': fields.many2one('account.move.line','Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')],help='This Entry Line will be referred for the information of the ordering customer.'),
+ 'communication': fields.char('Communication', size=64, required=True, help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
+ 'communication2': fields.char('Communication 2', size=64, help='The successor message of Communication.'),
+ 'move_line_id': fields.many2one('account.move.line', 'Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')], help='This Entry Line will be referred for the information of the ordering customer.'),
'amount_currency': fields.float('Amount in Partner Currency', digits=(16,2),
required=True, help='Payment amount in the partner currency'),
-# 'to_pay_currency': fields.function(_to_pay_currency, string='To Pay',
-# method=True, type='float',
-# help='Amount to pay in the partner currency'),
-# 'currency': fields.function(_currency, string='Currency',
-# method=True, type='many2one', obj='res.currency'),
- 'currency': fields.many2one('res.currency','Partner Currency',required=True),
- 'company_currency': fields.many2one('res.currency','Company Currency',readonly=True),
+ 'currency': fields.many2one('res.currency','Partner Currency', required=True),
+ 'company_currency': fields.many2one('res.currency', 'Company Currency', readonly=True),
'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'),
'order_id': fields.many2one('payment.order', 'Order', required=True,
ondelete='cascade', select=True),
- 'partner_id': fields.many2one('res.partner', string="Partner",required=True,help='The Ordering Customer'),
+ 'partner_id': fields.many2one('res.partner', string="Partner", required=True, help='The Ordering Customer'),
'amount': fields.function(_amount, string='Amount in Company Currency',
method=True, type='float',
help='Payment amount in the company currency'),
-# 'to_pay': fields.function(select_by_name, string="To Pay", method=True,
-# type='float', help='Amount to pay in the company currency'),
-# 'due_date': fields.function(select_by_name, string="Due date",
-# method=True, type='date'),
'ml_date_created': fields.function(_get_ml_created_date, string="Effective Date",
- method=True, type='date',help="Invoice Effective Date"),
-# 'reference': fields.function(select_by_name, string="Ref", method=True,
-# type='char'),
+ method=True, type='date', help="Invoice Effective Date"),
'ml_maturity_date': fields.function(_get_ml_maturity_date, method=True, type='date', string='Maturity Date'),
'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='many2one', relation='account.invoice', string='Invoice Ref.'),
- 'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text",help='Address of the Main Partner'),
- 'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text",help='Address of the Ordering Customer.'),
-# 'partner_payable': fields.function(partner_payable, string="Partner payable", method=True, type='float'),
-# 'value_date': fields.function(_value_date, string='Value Date',
-# method=True, type='date'),
- 'date': fields.date('Payment Date',help="If no payment date is specified, the bank will treat this payment line directly"),
- 'create_date': fields.datetime('Created' ,readonly=True),
+ 'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text", help='Address of the Main Partner'),
+ 'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text", help='Address of the Ordering Customer.'),
+ 'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"),
+ 'create_date': fields.datetime('Created' , readonly=True),
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True)
}
_defaults = {
@@ -422,13 +327,13 @@ class payment_line(osv.osv):
('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'),
]
- def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,date_prefered,date_planned,currency=False,company_currency=False,context=None):
+ def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_planned, currency=False, company_currency=False, context=None):
data={}
data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
if move_line_id:
- line = self.pool.get('account.move.line').browse(cr,uid,move_line_id)
+ line = self.pool.get('account.move.line').browse(cr, uid, move_line_id)
data['amount_currency']=line.amount_to_pay
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency,
@@ -444,7 +349,7 @@ class payment_line(osv.osv):
data['currency'] = temp
# calling onchange of partner and updating data dictionary
- temp_dict=self.onchange_partner(cr,uid,ids,line.partner_id.id,payment_type)
+ temp_dict=self.onchange_partner(cr, uid, ids, line.partner_id.id, payment_type)
data.update(temp_dict['value'])
data['reference']=line.ref
@@ -470,12 +375,12 @@ class payment_line(osv.osv):
res['amount'] = company_amount
return {'value': res}
- def onchange_partner(self,cr,uid,ids,partner_id,payment_type,context=None):
+ def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
data={}
data['info_partner']=data['bank_id']=False
if partner_id:
- part_obj=self.pool.get('res.partner').browse(cr,uid,partner_id)
+ part_obj=self.pool.get('res.partner').browse(cr, uid, partner_id)
partner=part_obj.name or ''
if part_obj.address:
@@ -485,7 +390,7 @@ class payment_line(osv.osv):
st1=ads.street2 and ads.street2 or ''
if 'zip_id' in ads:
- zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr,uid,[ads.zip_id.id])[0][1] or ''
+ zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
else:
zip=ads.zip and ads.zip or ''
city= ads.city and ads.city or ''
diff --git a/addons/account_payment/payment_report.xml b/addons/account_payment/account_payment_report.xml
similarity index 100%
rename from addons/account_payment/payment_report.xml
rename to addons/account_payment/account_payment_report.xml
diff --git a/addons/account_payment/payment_sequence.xml b/addons/account_payment/account_payment_sequence.xml
similarity index 100%
rename from addons/account_payment/payment_sequence.xml
rename to addons/account_payment/account_payment_sequence.xml
diff --git a/addons/account_payment/payment_view.xml b/addons/account_payment/account_payment_view.xml
similarity index 100%
rename from addons/account_payment/payment_view.xml
rename to addons/account_payment/account_payment_view.xml
diff --git a/addons/account_payment/payment_workflow.xml b/addons/account_payment/account_payment_workflow.xml
similarity index 100%
rename from addons/account_payment/payment_workflow.xml
rename to addons/account_payment/account_payment_workflow.xml
diff --git a/addons/account_payment/test/account_payment.yml b/addons/account_payment/test/account_payment.yml
new file mode 100644
index 00000000000..f24ad4dc443
--- /dev/null
+++ b/addons/account_payment/test/account_payment.yml
@@ -0,0 +1,145 @@
+-
+ In order to test account_payment in OpenERP I create a new record Type
+-
+-
+ Creating a payment.type record
+-
+ !record {model: payment.type, id: payment_type_t0}:
+ code: T0
+ name: TestType
+
+-
+ I created a new Bank Record
+-
+ Creating a res.partner.bank record
+-
+ !record {model: res.partner.bank, id: res_partner_bank_0}:
+ acc_number: '0001'
+ partner_id: base.res_partner_9
+ sequence: 0.0
+ state: bank
+
+-
+ I created a new Payment Mode
+-
+ Creating a payment.mode record
+-
+ !record {model: payment.mode, id: payment_mode_m0}:
+ bank_id: res_partner_bank_0
+ journal: account.bank_journal
+ name: TestMode
+ type: payment_type_t0
+
+-
+ I created a Supplier Invoice
+-
+ Creating a account.invoice record
+-
+ !record {model: account.invoice, id: account_invoice_payment}:
+ account_id: account.a_pay
+ address_contact_id: base.res_partner_address_tang
+ address_invoice_id: base.res_partner_address_tang
+ check_total: 300.0
+ company_id: base.main_company
+ currency_id: base.EUR
+ invoice_line:
+ - account_id: account.a_expense
+ name: '[PC1] Basic PC'
+ price_unit: 300.0
+ product_id: product.product_product_pc1
+ quantity: 1.0
+ uos_id: product.product_uom_unit
+ journal_id: account.expenses_journal
+ partner_id: base.res_partner_asus
+ reference_type: none
+ type: in_invoice
+
+-
+ I make the supplier invoice in Open state
+-
+ Performing a workflow action invoice_open on module account.invoice
+-
+ !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_payment}
+
+-
+ I create a new payment order
+-
+ Creating a payment.order record
+-
+ !record {model: payment.order, id: payment_order_0}:
+ date_prefered: due
+ mode: payment_mode_m0
+ reference: 2010/006
+ user_id: base.user_root
+
+
+-
+ Creating a payment.order.create record
+-
+ !record {model: payment.order.create, id: payment_order_create_0}:
+ duedate: '2010-06-04'
+
+-
+ I searched the entries using "Payment Create Order" wizard
+-
+ Performing an osv_memory action search_entries on module payment.order.create
+-
+ !python {model: payment.order.create}: |
+ self.search_entries(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US",
+ "active_model": "payment.order", "active_ids": [ref("payment_order_0")],
+ "tz": False, "active_id": ref("payment_order_0"), })
+-
+ I check that Initially Payment order is in "draft" state
+-
+ !assert {model: payment.order, id: payment_order_0}:
+ - state == 'draft'
+-
+ I pressed the confirm payment button to confirm the payment
+-
+ Performing a workflow action open on module payment.order
+-
+ !workflow {model: payment.order, action: open, ref: payment_order_0}
+-
+ I check that Payment order is in "Confirmed" state
+-
+ !assert {model: payment.order, id: payment_order_0}:
+ - state == 'open'
+-
+ I paid the payment using "Make Payments" Button
+-
+ Creating a account.payment.make.payment record
+-
+ !record {model: account.payment.make.payment, id: account_payment_make_payment_0}:
+ {}
+
+-
+ Performing an osv_memory action launch_wizard on module account.payment.make.payment
+-
+ !python {model: account.payment.make.payment}: |
+ self.launch_wizard(cr, uid, [ref("account_payment_make_payment_0")], {"lang":
+ "en_US", "active_model": "payment.order", "active_ids": [ref("payment_order_0")], "tz":
+ False, "active_id": ref("payment_order_0"), })
+
+-
+ I check that Payment order is in "Done" state
+-
+ !assert {model: payment.order, id: payment_order_0}:
+ - state == 'done'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py
index 266dcb535d8..81f5e4a570f 100644
--- a/addons/account_payment/wizard/account_payment_order.py
+++ b/addons/account_payment/wizard/account_payment_order.py
@@ -58,16 +58,16 @@ class payment_order_create(osv.osv_memory):
def create_payment(self, cr, uid, ids, context=None):
order_obj = self.pool.get('payment.order')
line_obj = self.pool.get('account.move.line')
-
- data = self.read(cr, uid, ids, [], context)[0]
- line_ids= data['entries']
+ payment_obj = self.pool.get('payment.line')
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids, [])[0]
+ line_ids = data['entries']
if not line_ids: return {}
- payment = order_obj.browse(cr, uid, data['active_id'],
- context=context)
+ payment = order_obj.browse(cr, uid, context['active_id'], context=context)
t = payment.mode and payment.mode.type.id or None
- line2bank = pool.get('account.move.line').line2bank(cr, uid,
- line_ids, t, context)
+ line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
## Finally populate the current payment with new lines:
for line in line_obj.browse(cr, uid, line_ids, context=context):
@@ -78,7 +78,7 @@ class payment_order_create(osv.osv_memory):
date_to_pay = line.date_maturity
elif payment.date_prefered == 'fixed':
date_to_pay = payment.date_planned
- pool.get('payment.line').create(cr, uid,{
+ payment_obj.create(cr, uid,{
'move_line_id': line.id,
'amount_currency': line.amount_to_pay,
'bank_id': line2bank.get(line.id),
@@ -88,13 +88,14 @@ class payment_order_create(osv.osv_memory):
'date': date_to_pay,
'currency': line.invoice and line.invoice.currency_id.id or False,
}, context=context)
- return {}
+ return {'nodestroy':True,}
def search_entries(self, cr, uid, ids, context=None):
order_obj = self.pool.get('payment.order')
line_obj = self.pool.get('account.move.line')
mod_obj = self.pool.get('ir.model.data')
-
+ if context is None:
+ context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
search_due_date = data['duedate']
payment = order_obj.browse(cr, uid, context['active_id'], context=context)
@@ -109,8 +110,7 @@ class payment_order_create(osv.osv_memory):
context.update({'line_ids': line_ids})
model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_create_payment_order_lines')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
- return {
- 'name': ('Entrie Lines'),
+ return {'name': ('Entrie Lines'),
'context': context,
'view_type': 'form',
'view_mode': 'form',
diff --git a/addons/account_payment/wizard/account_payment_pay.py b/addons/account_payment/wizard/account_payment_pay.py
index 74e1566520c..20e1e10f882 100644
--- a/addons/account_payment/wizard/account_payment_pay.py
+++ b/addons/account_payment/wizard/account_payment_pay.py
@@ -18,16 +18,13 @@
# along with this program. If not, see .
#
##############################################################################
-import time
from osv import fields, osv
class account_payment_make_payment(osv.osv_memory):
_name = 'account.payment.make.payment'
_description = 'Account make payment'
- _columns = {
- }
- def launch_wizard(self, cr, uid, ids, context):
+ def launch_wizard(self, cr, uid, ids, context=None):
"""
Search for a wizard to launch according to the type.
If type is manual. just confirm the order.
@@ -35,8 +32,8 @@ class account_payment_make_payment(osv.osv_memory):
obj_payment_order = self.pool.get('payment.order')
obj_model = self.pool.get('ir.model.data')
obj_act = self.pool.get('ir.actions.act_window')
- order= obj_payment_order.browse(cr,uid,context['active_id'],context)
- t= order.mode and order.mode.type.code or 'manual'
+ order= obj_payment_order.browse(cr, uid, context['active_id'], context)
+ t = order.mode and order.mode.type.code or 'manual'
if t == 'manual' :
obj_payment_order.set_done(cr,uid,context['active_id'],context)
return {}
@@ -49,12 +46,10 @@ class account_payment_make_payment(osv.osv_memory):
module, wizard= gw
result = mod_obj._get_id(cr, uid, module, wizard)
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
- result = act_obj.read(cr, uid, [id])[0]
+ return act_obj.read(cr, uid, [id])[0]
#result['context'] = str({'fiscalyear': data['form']['fiscalyear']})
- return result
account_payment_make_payment()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_payment/wizard/account_payment_pay_view.xml b/addons/account_payment/wizard/account_payment_pay_view.xml
index 061c152361c..566359d8b32 100644
--- a/addons/account_payment/wizard/account_payment_pay_view.xml
+++ b/addons/account_payment/wizard/account_payment_pay_view.xml
@@ -7,12 +7,14 @@
account.payment.make.payment
form
-
diff --git a/addons/account_report/__openerp__.py b/addons/account_report/__openerp__.py
index 3f0739bdb91..5cdacedce34 100644
--- a/addons/account_report/__openerp__.py
+++ b/addons/account_report/__openerp__.py
@@ -27,6 +27,7 @@
'description': """Financial and accounting reporting
Fiscal statements
Indicators
+ Add a dashboards for accountant that include Indicators reporting.
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
@@ -39,6 +40,7 @@
'account_wizard.xml',
'wizard/account_report_print_indicators_view.xml',
'wizard/account_report_print_indicators_with_pdf_view.xml',
+ 'board_account_report_view.xml',
],
'demo_xml': [],
'installable': True,
diff --git a/addons/account_report/account.py b/addons/account_report/account.py
index a3f92676111..784d95daa79 100644
--- a/addons/account_report/account.py
+++ b/addons/account_report/account.py
@@ -61,7 +61,7 @@ class account_report(osv.osv):
if key==0:
return obj.find(cr, uid, exception=False)
else:
- obj_key=obj.browse(cr,uid,obj.find(cr, uid, exception=False))
+ obj_key=obj.browse(cr, uid, obj.find(cr, uid, exception=False))
if isinstance(obj_key,list):
obj_key=obj_key[0]
key_ids=obj.search(cr,uid,[('date_stop','<',obj_key.date_start)])
@@ -69,8 +69,8 @@ class account_report(osv.osv):
return False
return key_ids[key]
- def _calc_credit(code,year=0):
- context['fiscalyear']=_calc_context(year,obj_fy)
+ def _calc_credit(code, year=0):
+ context['fiscalyear']=_calc_context(year, obj_fy)
if not context['fiscalyear']:
del context['fiscalyear']
acc = self.pool.get('account.account')
@@ -78,7 +78,7 @@ class account_report(osv.osv):
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0.0)
def _calc_debit(code,year=0):
- context['fiscalyear']=_calc_context(year,obj_fy)
+ context['fiscalyear']=_calc_context(year, obj_fy)
if not context['fiscalyear']:
del context['fiscalyear']
acc = self.pool.get('account.account')
@@ -86,7 +86,7 @@ class account_report(osv.osv):
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0.0)
def _calc_balance(code,year=0):
- context['fiscalyear']=_calc_context(year,obj_fy)
+ context['fiscalyear']=_calc_context(year, obj_fy)
if not context['fiscalyear']:
del context['fiscalyear']
acc = self.pool.get('account.account')
@@ -102,7 +102,7 @@ class account_report(osv.osv):
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0.0)
def _calc_tax_code(code,period=0):
- context['period_id']=_calc_context(period,obj_period)
+ context['period_id']=_calc_context(period, obj_period)
if not context['period_id']:
return 0.00
context['period_id']=context['period_id'][0]
@@ -145,7 +145,7 @@ class account_report(osv.osv):
def onchange_parent_id(self, cr, uid, ids, parent_id):
v={}
if parent_id:
- acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
+ acc=self.pool.get('account.report.report').browse(cr, uid, parent_id)
v['type']=acc.type
# if int(acc.style) < 6:
# v['style'] = str(int(acc.style)+1)
@@ -163,8 +163,8 @@ class account_report(osv.osv):
('other','Others')],
'Type', required=True),
'expression': fields.char('Expression', size=240, required=True),
- 'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2),help='This Value sets the limit of badness.'),
- 'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2),help='This Value sets the limit of goodness.'),
+ 'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2), help='This Value sets the limit of badness.'),
+ 'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2), help='This Value sets the limit of goodness.'),
'parent_id': fields.many2one('account.report.report', 'Parent'),
'child_ids': fields.one2many('account.report.report', 'parent_id', 'Children'),
'note': fields.text('Note'),
@@ -180,8 +180,8 @@ class account_report(osv.osv):
('very good', 'Very Good')
],
string='Status'),
- 'disp_tree':fields.boolean('Display Tree',help='When the indicators are printed, if one indicator is set with this field to True, then it will display one more graphs with all its children in tree'),
- 'disp_graph':fields.boolean('Display As Graph',help='If the field is set to True, information will be printed as a Graph, otherwise as an array.'),
+ 'disp_tree':fields.boolean('Display Tree', help='When the indicators are printed, if one indicator is set with this field to True, then it will display one more graphs with all its children in tree'),
+ 'disp_graph':fields.boolean('Display As Graph', help='If the field is set to True, information will be printed as a Graph, otherwise as an array.'),
# 'style': fields.selection(_style, 'Style', required=True),
# 'color_font' : fields.selection(_color, 'Font Color', help="Font Color for the report"),
# 'color_back' : fields.selection(_color, 'Back Color')
@@ -215,12 +215,12 @@ account_report()
class account_report_history(osv.osv):
def _calc_value(self, cr, uid, ids, name, args, context):
- acc_report_id=self.read(cr,uid,ids,['tmp','period_id'])
+ acc_report_id=self.read(cr, uid, ids, ['tmp','period_id'])
tmp_ids={}
for a in acc_report_id:
- period_val=pooler.get_pool(cr.dbname).get('account.period').read(cr,uid,[a['period_id'][0]])[0]
- period_id=pooler.get_pool(cr.dbname).get('account.period').search(cr,uid,[('date_start','<=',period_val['date_start']),('fiscalyear_id','=',period_val['fiscalyear_id'][0])])
- tmp_ids[a['id']] = pooler.get_pool(cr.dbname).get('account.report.report').read(cr,uid,[a['tmp']],context={'periods':period_id})[0]['amount']
+ period_val=pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [a['period_id'][0]])[0]
+ period_id=pooler.get_pool(cr.dbname).get('account.period').search(cr, uid, [('date_start','<=',period_val['date_start']),('fiscalyear_id','=',period_val['fiscalyear_id'][0])])
+ tmp_ids[a['id']] = pooler.get_pool(cr.dbname).get('account.report.report').read(cr, uid, [a['tmp']], context={'periods':period_id})[0]['amount']
return tmp_ids
_name = "account.report.history"
diff --git a/addons/account_report/board_account_report_view.xml b/addons/account_report/board_account_report_view.xml
new file mode 100644
index 00000000000..66c015e1974
--- /dev/null
+++ b/addons/account_report/board_account_report_view.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ board.account.report.form
+ board.board
+
+ form
+
+
+
+
+
+
+
+
diff --git a/addons/account_report_india/report/report_balance_sheet.rml b/addons/account_report_india/report/report_balance_sheet.rml
index 95a34c2f063..c540e16f58e 100644
--- a/addons/account_report_india/report/report_balance_sheet.rml
+++ b/addons/account_report_india/report/report_balance_sheet.rml
@@ -186,7 +186,7 @@
[[ '. '*(a['level']-1) ]] [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]
- [[ formatLang(abs(a['balance'])) ]]
+ [[ a['balance'] and formatLang(abs(a['balance'])) or 0.0 ]]
@@ -196,7 +196,7 @@
Balance:([[ get_currency(data['form']) ]])
- [[ formatLang(sum_dr()) ]]
+ [[ sum_dr() and formatLang(sum_dr()) or 0.0 ]]
@@ -224,7 +224,7 @@
[[ a['code'] ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]
- [[ formatLang(abs(a['balance'])) ]]
+ [[ a['balance'] and formatLang(abs(a['balance'])) or 0.0 ]]
@@ -234,7 +234,7 @@
Balance:([[ get_currency(data['form']) ]])
- [[ formatLang(sum_cr()) ]]
+ [[ sum_cr() and formatLang(sum_cr()) or 0.0 ]]
diff --git a/addons/account_report_india/report/report_balance_sheet_horizontal.rml b/addons/account_report_india/report/report_balance_sheet_horizontal.rml
index 09a2f252f80..d9b92da3856 100644
--- a/addons/account_report_india/report/report_balance_sheet_horizontal.rml
+++ b/addons/account_report_india/report/report_balance_sheet_horizontal.rml
@@ -197,7 +197,7 @@
[[ '. '*(a['level']-1) ]] [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]
- [[ formatLang(abs(a['balance'])) ]]
+ [[ a['balance'] and formatLang(abs(a['balance'])) or 0.0 ]]
[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]] [[ a['code1'] ]]
@@ -206,7 +206,7 @@
[[ '. '*(a['level1']-1) ]] [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name1'] ]]
- [[ formatLang(abs(a['balance1'])) ]]
+ [[ a['balance1'] and formatLang(abs(a['balance1'])) or 0.0 ]]
@@ -216,13 +216,13 @@
Balance:([[ get_currency(data['form']) ]])
- [[ formatLang(abs(sum_dr())) ]]
+ [[ sum_dr() and formatLang(abs(sum_dr())) or 0.0 ]]
Balance:([[ get_currency(data['form']) ]])
- [[ formatLang(abs(sum_cr())) ]]
+ [[ sum_cr() and formatLang(abs(sum_cr())) or 0.0 ]]
diff --git a/addons/account_report_india/report/report_pl_account.rml b/addons/account_report_india/report/report_pl_account.rml
index 77f3fa50ad8..6e72a198115 100644
--- a/addons/account_report_india/report/report_pl_account.rml
+++ b/addons/account_report_india/report/report_pl_account.rml
@@ -201,7 +201,7 @@
- [[ formatLang(abs(a.balance)) ]]
+ [[ a.balance and formatLang(abs(a.balance)) or 0.0 ]]
@@ -214,7 +214,7 @@
[[ final_result()['type'] == 'Net Profit C.F.B.L.' and final_result()['type'] or removeParentNode('blockTable') ]]
- [[ final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]
+ [[ final_result()['balance'] and final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or 0.0 ]]
@@ -224,7 +224,7 @@
Total:([[ get_currency(data['form']) ]])
- [[ formatLang(abs(sum_dr())) ]]
+ [[ sum_dr() and formatLang(abs(sum_dr())) or 0.0 ]]
@@ -256,7 +256,7 @@
- [[ formatLang(abs(a.balance)) ]]
+ [[ a.balance and formatLang(abs(a.balance)) or 0.0 ]]
@@ -269,7 +269,7 @@
[[ final_result()['type'] == 'Net Loss C.F.B.L.' and final_result()['type'] or removeParentNode('blockTable') ]]
- [[ final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]
+ [[ final_result()['balance'] and final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or 0.0 ]]
@@ -279,7 +279,7 @@
Total:([[ get_currency(data['form']) ]])
- [[ formatLang(abs(sum_cr())) ]]
+ [[ sum_cr() and formatLang(abs(sum_cr())) or 0.0 ]]
diff --git a/addons/account_report_india/report/report_pl_account_horizontal.rml b/addons/account_report_india/report/report_pl_account_horizontal.rml
index 0c2be18da0b..b68d375d3be 100644
--- a/addons/account_report_india/report/report_pl_account_horizontal.rml
+++ b/addons/account_report_india/report/report_pl_account_horizontal.rml
@@ -214,7 +214,7 @@
- [[ formatLang(abs(a['balance'])) ]]
+ [[ a['balance'] and formatLang(abs(a['balance'])) or 0.0 ]]
@@ -227,7 +227,7 @@
- [[ formatLang(abs(a['balance1'])) ]]
+ [[ a['balance1'] and formatLang(abs(a['balance1'])) or 0.0 ]]
@@ -240,7 +240,7 @@
[[ final_result()['type'] == 'Net Profit C.F.B.L.' and final_result()['type'] or '' ]]
- [[ final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]
+ [[ final_result()['balance'] and final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or 0.0 ]]
@@ -249,7 +249,7 @@
[[ final_result()['type'] == 'Net Loss C.F.B.L.' and final_result()['type'] or '' ]]
- [[ final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]
+ [[ final_result()['balance'] and final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or 0.0 ]]
@@ -260,13 +260,13 @@
Total:([[ get_currency(data['form']) ]])
- [[ formatLang(abs(sum_dr())) ]]
+ [[ sum_dr() and formatLang(abs(sum_dr())) or 0.0 ]]
Total:([[ get_currency(data['form']) ]])
- [[ formatLang(abs(sum_cr())) ]]
+ [[ sum_cr() and formatLang(abs(sum_cr())) or 0.0 ]]
diff --git a/addons/account_reporting/account.py b/addons/account_reporting/account.py
index 0b4a16b0dd8..c8b3273491a 100644
--- a/addons/account_reporting/account.py
+++ b/addons/account_reporting/account.py
@@ -76,7 +76,7 @@ class account_report_bs(osv.osv):
def onchange_parent_id(self, cr, uid, ids, parent_id):
v={}
if parent_id:
- acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
+ acc=self.pool.get('account.report.report').browse(cr, uid, parent_id)
v['type']=acc.type
if int(acc.style) < 6:
v['style'] = str(int(acc.style)+1)
diff --git a/addons/account_tax_include/__openerp__.py b/addons/account_tax_include/__openerp__.py
index 5bb1a2e2399..a963b0b5118 100644
--- a/addons/account_tax_include/__openerp__.py
+++ b/addons/account_tax_include/__openerp__.py
@@ -35,6 +35,7 @@ This module implement the modification on the invoice form.
'init_xml': [],
'update_xml': ['account_tax_include_view.xml'],
'demo_xml': [],
+ 'test': ['test/account_tax_include.yml'],
'installable': True,
'active': False,
'certificate': '0070514190381',
diff --git a/addons/account_tax_include/account_tax_include.py b/addons/account_tax_include/account_tax_include.py
index d84a21afff7..5cb58619a76 100644
--- a/addons/account_tax_include/account_tax_include.py
+++ b/addons/account_tax_include/account_tax_include.py
@@ -126,9 +126,9 @@ class account_invoice_line(osv.osv):
_columns = {
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
- store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
+ store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
- store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
+ store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
}
_defaults = {
diff --git a/addons/account_tax_include/test/account_tax_include.yml b/addons/account_tax_include/test/account_tax_include.yml
new file mode 100644
index 00000000000..a4b0f8531b9
--- /dev/null
+++ b/addons/account_tax_include/test/account_tax_include.yml
@@ -0,0 +1,93 @@
+
+-
+ Creating a tax record
+-
+ !record {model: account.tax, id: account_tax_a0}:
+ amount: 0.10000000000000001
+ applicable_type: 'true'
+ company_id: base.main_company
+ description: a
+ name: a
+ sequence: 1
+ type: percent
+ type_tax_use: all
+
+-
+ Creating a account invoice record with tax excluded
+-
+ !record {model: account.invoice, id: account_invoice_tax_exclude}:
+ account_id: account.a_recv
+ address_contact_id: base.res_partner_address_3000
+ address_invoice_id: base.res_partner_address_3000
+ company_id: base.main_company
+ currency_id: base.EUR
+ invoice_line:
+ - account_id: account.a_sale
+ name: '[PC1] Basic PC'
+ price_unit: 100.0
+ quantity: 1.0
+ invoice_line_tax_id:
+ - account_tax_a0
+ product_id: product.product_product_pc1
+ uos_id: product.product_uom_unit
+ journal_id: account.sales_journal
+ partner_id: base.res_partner_desertic_hispafuentes
+ price_type: tax_excluded
+ reference_type: none
+
+-
+ Performing an osv_memory action button_reset_taxes on module account.invoice
+-
+ !python {model: account.invoice}: |
+ self.button_reset_taxes(cr, uid, [ref("account_invoice_tax_exclude")], {"lang": "en_US", "tz": False,
+ "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_invoice_tree1")],
+ "type": "out_invoice", "active_id": ref("account.menu_action_invoice_tree1"),
+ })
+-
+ Check if tax is excluded in invoice
+-
+ !assert {model: account.invoice, id: account_invoice_tax_exclude, severity: error, string: price type is tax excluded}:
+ - state == "draft"
+ - amount_untaxed == 100.0
+ - amount_tax == 10.0
+ - amount_total == 110.0
+
+-
+ Creating a account invoice record with tax include
+-
+ !record {model: account.invoice, id: account_invoice_tax_include}:
+ account_id: account.a_recv
+ address_contact_id: base.res_partner_address_3000
+ address_invoice_id: base.res_partner_address_3000
+ company_id: base.main_company
+ currency_id: base.EUR
+ invoice_line:
+ - account_id: account.a_sale
+ name: '[PC1] Basic PC'
+ price_unit: 100.0
+ quantity: 1.0
+ invoice_line_tax_id:
+ - account_tax_a0
+ product_id: product.product_product_pc1
+ uos_id: product.product_uom_unit
+ journal_id: account.sales_journal
+ partner_id: base.res_partner_desertic_hispafuentes
+ price_type: tax_included
+ reference_type: none
+
+-
+ Performing an osv_memory action button_reset_taxes on module account.invoice
+-
+ !python {model: account.invoice}: |
+ self.button_reset_taxes(cr, uid, [ref("account_invoice_tax_include")], {"lang": "en_US", "tz": False,
+ "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_invoice_tree1")],
+ "type": "out_invoice", "active_id": ref("account.menu_action_invoice_tree1"),
+ })
+-
+ Check if tax is included in invoice
+-
+ !assert {model: account.invoice, id: account_invoice_tax_include, severity: error, string: price type is tax included}:
+ - state == "draft"
+ - amount_untaxed == 90.91
+ - amount_tax == 9.09
+ - amount_total == 100.00
\ No newline at end of file
diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index ed250f0aaf0..3dff856b716 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -37,7 +37,7 @@
"category" : "Generic Modules/Accounting",
"website" : "http://tinyerp.com",
"depends" : [
- "base",
+ "base",
"account"
],
"init_xml" : [
@@ -54,8 +54,12 @@
"voucher_view.xml",
"voucher_wizard.xml",
"wizard/account_voucher_open_view.xml",
-
+
],
+ "test" : [
+ "test/account_voucher.yml",
+ ],
+
'certificate': '0037580727101',
"active": False,
"installable": True,
diff --git a/addons/account_voucher/report/report_voucher.py b/addons/account_voucher/report/report_voucher.py
index 5a84969c52f..1524f972e6a 100644
--- a/addons/account_voucher/report/report_voucher.py
+++ b/addons/account_voucher/report/report_voucher.py
@@ -34,8 +34,8 @@ class report_voucher(report_sxw.rml_parse):
'get_ref' : self._get_ref
})
- def convert(self,amount, cur):
- amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
+ def convert(self, amount, cur):
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
return amt_en
def debit(self, move_ids):
diff --git a/addons/account_voucher/report/report_voucher_amount.py b/addons/account_voucher/report/report_voucher_amount.py
index 7c0cfffe317..2cb113ae4ed 100644
--- a/addons/account_voucher/report/report_voucher_amount.py
+++ b/addons/account_voucher/report/report_voucher_amount.py
@@ -31,8 +31,8 @@ class report_voucher_amount(report_sxw.rml_parse):
'convert':self.convert
})
- def convert(self,amount, cur):
- amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
+ def convert(self, amount, cur):
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
return amt_en
diff --git a/addons/account_voucher/test/account_voucher.yml b/addons/account_voucher/test/account_voucher.yml
new file mode 100644
index 00000000000..a49222c3b96
--- /dev/null
+++ b/addons/account_voucher/test/account_voucher.yml
@@ -0,0 +1,116 @@
+
+-
+ In order to check account voucher module in OpenERP I create a customer voucher
+-
+ !record {model: account.voucher, id: account_voucher_voucherforaxelor0}:
+ account_id: account.cash
+ company_id: base.main_company
+ currency_id: base.EUR
+ journal_id: account.bank_journal
+ name: Voucher for Axelor
+ narration: Basic Pc
+ payment_ids:
+ - account_id: account.a_recv
+ amount: 1000.0
+ name: Voucher for Axelor
+ partner_id: base.res_partner_desertic_hispafuentes
+ period_id: account.period_6
+ reference_type: none
+
+-
+ I check that Initially customer voucher is in the "Draft" state
+-
+ !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
+ - state == 'draft'
+-
+ I change the state of voucher to "proforma" by clicking PRO-FORMA button
+-
+ !workflow {model: account.voucher, action: open_voucher, ref: account_voucher_voucherforaxelor0}
+-
+ I check that the voucher state is now "proforma"
+-
+ !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
+ - state == 'proforma'
+-
+ I create voucher by clicking on Create button
+-
+ !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0}
+-
+ I check that the voucher state is "Waiting for re-checking"
+-
+ !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
+ - state == 'recheck'
+-
+ I clicked on Validate Button
+-
+ !workflow {model: account.voucher, action: recheck_voucher, ref: account_voucher_voucherforaxelor0}
+-
+ I check that the voucher state is "posted"
+-
+ !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
+ - state == 'posted'
+
+-
+ I check that Moves get created for this voucher
+-
+ !python {model: account.voucher}: |
+ acc_id=self.browse(cr, uid, ref("account_voucher_voucherforaxelor0"))
+ assert(acc_id.move_id)
+
+
+-
+ Now I create a Vendor Voucher
+-
+ !record {model: account.voucher, id: account_voucher_voucheraxelor0}:
+ account_id: account.cash
+ company_id: base.main_company
+ currency_id: base.EUR
+ journal_id: account.bank_journal
+ name: Voucher Axelor
+ narration: Basic PC
+ payment_ids:
+ - account_id: account.cash
+ amount: 1000.0
+ name: Voucher Axelor
+ period_id: account.period_6
+ reference_type: none
+
+-
+ I check that Initially vendor voucher is in the "Draft" state
+-
+ !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
+ - state == 'draft'
+-
+ I change the state of voucher to "proforma" by clicking PRO-FORMA button
+-
+ !workflow {model: account.voucher, action: open_voucher, ref: account_voucher_voucheraxelor0}
+-
+ I check that the voucher state is now "proforma"
+-
+ !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
+ - state == 'proforma'
+-
+ I create voucher by clicking on Create button
+-
+ !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0}
+-
+ I check that the voucher state is "Waiting for re-checking"
+-
+ !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
+ - state == 'recheck'
+-
+ I clicked on Validate Button
+-
+ !workflow {model: account.voucher, action: recheck_voucher, ref: account_voucher_voucheraxelor0}
+-
+ I check that the voucher state is "posted"
+-
+ !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
+ - state == 'posted'
+
+-
+ I check that moves get created for this voucher
+-
+ !python {model: account.voucher}: |
+ acc_id=self.browse(cr, uid, ref("account_voucher_voucheraxelor0"))
+ assert(acc_id.move_id)
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index f7ff9ad9ef1..69a5aba09e0 100644
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -212,7 +212,7 @@ class account_voucher(osv.osv):
self.write(cr, uid, ids, {'state':'posted'})
return True
- def cancel_voucher(self,cr,uid,ids,context={}):
+ def cancel_voucher(self, cr, uid, ids, context={}):
self.action_cancel(cr, uid, ids)
self.write(cr, uid, ids, {'state':'cancel'})
return True
@@ -406,7 +406,7 @@ class account_voucher(osv.osv):
'general_account_id':line.account_id.id,
'ref':ref
}
- self.pool.get('account.analytic.line').create(cr,uid,an_line)
+ self.pool.get('account.analytic.line').create(cr, uid, an_line)
self.write(cr, uid, [inv.id], {'move_id': move_id})
obj=self.pool.get('account.move').browse(cr, uid, move_id)
@@ -440,7 +440,7 @@ class account_voucher(osv.osv):
def action_number(self, cr, uid, ids, *args):
cr.execute('SELECT id, type, number, move_id, reference ' \
'FROM account_voucher ' \
- 'WHERE id =ANY(%s)',(ids,))
+ 'WHERE id IN %s',(tuple(ids),))
for (id, invtype, number, move_id, reference) in cr.fetchall():
if not number:
number = self.pool.get('ir.sequence').get(cr, uid, invtype)
@@ -568,7 +568,7 @@ class account_voucher_line(osv.osv):
'value' : {'account_id' : account_id.id, 'type' : ttype, 'amount':balance}
}
- def onchange_amount(self, cr, uid, ids,partner_id,amount, type,type1):
+ def onchange_amount(self, cr, uid, ids, partner_id, amount, type, type1):
if not amount:
return {'value' : {}}
if partner_id:
@@ -630,7 +630,7 @@ class account_voucher_line(osv.osv):
'value' : { 'type' : type , 'amount':amount}
}
- def onchange_type(self, cr, uid, ids,partner_id,amount,type,type1):
+ def onchange_type(self, cr, uid, ids, partner_id, amount, type, type1):
if partner_id:
obj = self.pool.get('res.partner')
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index 0049c5ff5de..aed57a283aa 100644
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -108,18 +108,29 @@