Correct after feedback

This commit is contained in:
Matthieu Dietrich
2016-04-29 15:36:28 +02:00
parent 14e1942412
commit 17bf64450d
6 changed files with 21 additions and 21 deletions

View File

@@ -39,7 +39,7 @@ class CreditPartnerStatementImporter(models.TransientModel):
partner_id = fields.Many2one(
comodel_name='res.partner',
string='Credit institute partner')
file_name = fields.Char('File Name', size=128)
file_name = fields.Char()
receivable_account_id = fields.Many2one(
comodel_name='account.account',
string='Force Receivable/Payable Account')
@@ -59,8 +59,10 @@ class CreditPartnerStatementImporter(models.TransientModel):
}
}
def _check_extension(self, filename):
(__, ftype) = os.path.splitext(filename)
@api.multi
def _check_extension(self):
self.ensure_one()
(__, ftype) = os.path.splitext(self.file_name)
if not ftype:
# We do not use osv exception we do not want to have it logged
raise Exception(_('Please use a file with an extension'))
@@ -72,7 +74,7 @@ class CreditPartnerStatementImporter(models.TransientModel):
moves = self.env['account.move']
for importer in self:
journal = importer.journal_id
ftype = self._check_extension(importer.file_name)
ftype = importer._check_extension()
moves |= journal.with_context(
file_name=importer.file_name).multi_move_import(
importer.input_statement,

View File

@@ -14,11 +14,10 @@
<field name="receivable_account_id" readonly="1"/>
<field name="commission_account_id" readonly="1"/>
</group>
<separator string="" colspan="4"/>
<group colspan="4" col="6">
<footer>
<button icon="gtk-ok" name="import_statement" string="Import statement" type="object" class="oe_highlight"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="import_statement" string="Import statement" type="object"/>
</group>
</footer>
</form>
</field>
</record>