flake8
This commit is contained in:
parent
b5ca9344bb
commit
8cf103cf5c
@ -29,9 +29,9 @@ class account_account_type(orm.Model):
|
|||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'partner_policy': fields.selection([
|
'partner_policy': fields.selection([
|
||||||
('optional', 'Optional'),
|
('optional', 'Optional'),
|
||||||
('always', 'Always'),
|
('always', 'Always'),
|
||||||
('never', 'Never')
|
('never', 'Never')
|
||||||
], 'Policy for partner field',
|
], 'Policy for partner field',
|
||||||
help="Set the policy for the partner field : if you select "
|
help="Set the policy for the partner field : if you select "
|
||||||
"'Optional', the accountant is free to put a partner "
|
"'Optional', the accountant is free to put a partner "
|
||||||
@ -81,16 +81,16 @@ class account_move_line(orm.Model):
|
|||||||
|
|
||||||
def create(self, cr, uid, vals, context=None, check=True):
|
def create(self, cr, uid, vals, context=None, check=True):
|
||||||
line_id = super(account_move_line, self).create(cr, uid, vals,
|
line_id = super(account_move_line, self).create(cr, uid, vals,
|
||||||
context=context,
|
context=context,
|
||||||
check=check)
|
check=check)
|
||||||
self.check_partner_required(cr, uid, line_id, vals, context=context)
|
self.check_partner_required(cr, uid, line_id, vals, context=context)
|
||||||
return line_id
|
return line_id
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None, check=True,
|
def write(self, cr, uid, ids, vals, context=None, check=True,
|
||||||
update_check=True):
|
update_check=True):
|
||||||
res = super(account_move_line, self).write(cr, uid, ids, vals,
|
res = super(account_move_line, self).write(cr, uid, ids, vals,
|
||||||
context=context,
|
context=context,
|
||||||
check=check,
|
check=check,
|
||||||
update_check=update_check)
|
update_check=update_check)
|
||||||
self.check_partner_required(cr, uid, ids, vals, context=context)
|
self.check_partner_required(cr, uid, ids, vals, context=context)
|
||||||
return res
|
return res
|
||||||
|
@ -37,7 +37,9 @@ class test_account_partner_required(common.TransactionCase):
|
|||||||
|
|
||||||
def _create_move(self, with_partner, amount=100):
|
def _create_move(self, with_partner, amount=100):
|
||||||
date = datetime.now()
|
date = datetime.now()
|
||||||
period_id = self.registry('account.period').find(self.cr, self.uid, date, context={'account_period_prefer_normal': True})[0]
|
period_id = self.registry('account.period').find(
|
||||||
|
self.cr, self.uid, date,
|
||||||
|
context={'account_period_prefer_normal': True})[0]
|
||||||
move_vals = {
|
move_vals = {
|
||||||
'journal_id': self.ref('account.sales_journal'),
|
'journal_id': self.ref('account.sales_journal'),
|
||||||
'period_id': period_id,
|
'period_id': period_id,
|
||||||
@ -45,27 +47,26 @@ class test_account_partner_required(common.TransactionCase):
|
|||||||
}
|
}
|
||||||
move_id = self.move_obj.create(self.cr, self.uid, move_vals)
|
move_id = self.move_obj.create(self.cr, self.uid, move_vals)
|
||||||
self.move_line_obj.create(self.cr, self.uid,
|
self.move_line_obj.create(self.cr, self.uid,
|
||||||
{'move_id': move_id,
|
{'move_id': move_id,
|
||||||
'name': '/',
|
'name': '/',
|
||||||
'debit': 0,
|
'debit': 0,
|
||||||
'credit': amount,
|
'credit': amount,
|
||||||
'account_id': self.ref('account.a_sale'),
|
'account_id': self.ref('account.a_sale')})
|
||||||
})
|
move_line_id = self.move_line_obj.create(
|
||||||
move_line_id = self.move_line_obj.create(self.cr, self.uid,
|
self.cr, self.uid,
|
||||||
{'move_id': move_id,
|
{'move_id': move_id,
|
||||||
'name': '/',
|
'name': '/',
|
||||||
'debit': amount,
|
'debit': amount,
|
||||||
'credit': 0,
|
'credit': 0,
|
||||||
'account_id': self.ref('account.a_recv'),
|
'account_id': self.ref('account.a_recv'),
|
||||||
'partner_id': self.ref('base.res_partner_1') if with_partner else False,
|
'partner_id': self.ref('base.res_partner_1') if with_partner else False})
|
||||||
})
|
|
||||||
return move_line_id
|
return move_line_id
|
||||||
|
|
||||||
def _set_partner_policy(self, policy, aref='account.a_recv'):
|
def _set_partner_policy(self, policy, aref='account.a_recv'):
|
||||||
account_type = self.account_obj.browse(self.cr, self.uid,
|
account_type = self.account_obj.browse(self.cr, self.uid,
|
||||||
self.ref(aref)).user_type
|
self.ref(aref)).user_type
|
||||||
self.account_type_obj.write(self.cr, self.uid, account_type.id,
|
self.account_type_obj.write(self.cr, self.uid, account_type.id,
|
||||||
{'partner_policy': policy})
|
{'partner_policy': policy})
|
||||||
|
|
||||||
def test_optional(self):
|
def test_optional(self):
|
||||||
self._create_move(with_partner=False)
|
self._create_move(with_partner=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user