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

@@ -248,7 +248,7 @@ class AccountMoveLine(models.Model):
help="When this checkbox is ticked, the auto-completion "
"process/button will ignore this line.")
def _get_line_values_from_rules(self, line, rules):
def _get_line_values_from_rules(self, rules):
"""We'll try to find out the values related to the line based on rules
setted on the profile.. We will ignore line for which already_completed
is ticked.
@@ -260,12 +260,13 @@ class AccountMoveLine(models.Model):
'account_id': 489L}}
"""
journal_obj = self.env['account.journal']
if not line.already_completed:
# Ask the rule
vals = journal_obj._find_values_from_rules(rules, line)
if vals:
vals['id'] = line['id']
return vals
for line in self:
if not line.already_completed:
# Ask the rule
vals = journal_obj._find_values_from_rules(rules, line)
if vals:
vals['id'] = line['id']
return vals
return {}
def _get_available_columns(self, move_store):
@@ -386,8 +387,7 @@ class AccountMove(models.Model):
res = False
for line in move.line_ids:
try:
res = move_line_obj._get_line_values_from_rules(
line, rules)
res = line._get_line_values_from_rules(rules)
if res:
compl_lines += 1
except ErrorTooManyPartner, exc:

View File

@@ -15,7 +15,6 @@ class ResPartner(models.Model):
bank_statement_label = fields.Char(
string='Bank Statement Label',
size=100,
help="Enter the various label found on your bank statement "
"separated by a ; If one of this label is include in the "
"bank statement line, the partner will be automatically "

View File

@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_bank_st_cmpl_user,account.move.completion.rule,model_account_move_completion_rule,account.group_account_user,1,0,0,0
access_account_bank_st_cmpl_manager,account.move.completion.rule,model_account_move_completion_rule,account.group_account_manager,1,1,1,1
access_account_bank_st_cmpl_user,account.move.completion.rule.user,model_account_move_completion_rule,account.group_account_user,1,0,0,0
access_account_bank_st_cmpl_manager,account.move.completion.rule.manager,model_account_move_completion_rule,account.group_account_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_account_bank_st_cmpl_user account.move.completion.rule account.move.completion.rule.user model_account_move_completion_rule account.group_account_user 1 0 0 0
3 access_account_bank_st_cmpl_manager account.move.completion.rule account.move.completion.rule.manager model_account_move_completion_rule account.group_account_manager 1 1 1 1

View File

@@ -15,7 +15,7 @@
groups="account.group_account_invoice"
attrs="{'invisible': ['|', ('used_for_completion','=',False), ('state','not in', ['draft'])]}"/>
</button>
<xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='credit']" position="after">
<xpath expr="//field[@name='line_ids']/tree/field[@name='credit']" position="after">
<field name="already_completed"/>
</xpath>
<xpath expr="/form/sheet/notebook" position="inside">

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>