Skip to content

Commit

Permalink
[CHG] Review
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpeiffer committed Oct 18, 2016
1 parent 1ec98ab commit 12a4c63
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion account_cutoff_base/models/account_cutoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AccountCutoff(models.Model):
_description = 'Account Cut-off'

@api.multi
@api.depends('line_ids')
@api.depends('line_ids', 'line_ids.cutoff_amount')
def _compute_total_cutoff(self):
for cutoff in self:
tamount = 0.0
Expand Down
12 changes: 6 additions & 6 deletions account_cutoff_prepaid/models/account_cutoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class AccountCutoff(models.Model):
@api.model
def _get_default_source_journals(self):
res = []
type = self._context.get('type')
cutoff_type = self._context.get('type')
mapping = {
'prepaid_expense': 'purchase',
'prepaid_revenue': 'sale',
}
if type in mapping:
if cutoff_type in mapping:
src_journals = self.env['account.journal'].search(
[('type', '=', mapping[type])])
[('type', '=', mapping[cutoff_type])])
if src_journals:
res = src_journals.ids
return res
Expand Down Expand Up @@ -154,11 +154,11 @@ def get_prepaid_lines(self):
def _inherit_default_cutoff_account_id(self):
account_id = super(AccountCutoff, self).\
_inherit_default_cutoff_account_id()
type = self._context.get('type')
cutoff_type = self._context.get('type')
company = self.env.user.company_id
if type == 'prepaid_revenue':
if cutoff_type == 'prepaid_revenue':
account_id = company.default_prepaid_revenue_account_id.id or False
elif type == 'prepaid_expense':
elif cutoff_type == 'prepaid_expense':
account_id = company.default_prepaid_expense_account_id.id or False
return account_id

Expand Down
6 changes: 3 additions & 3 deletions account_cutoff_prepaid/tests/test_account_cutoff_prepaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _create_invoice(self, date, amount, start_date, end_date):
'end_date': self._date(end_date),
})],
})
invoice.signal_workflow('invoice_open')
invoice.action_invoice_open()
self.assertEqual(amount, invoice.amount_untaxed)
return invoice

Expand All @@ -79,8 +79,8 @@ def test_0(self):
amount = self._days('04-01', '06-30')
amount_2months = self._days('05-01', '06-30')
# invoice to be spread of 3 months
self._create_invoice('01-15', amount,
start_date='04-01', end_date='06-30')
inv = self._create_invoice('01-15', amount,
start_date='04-01', end_date='06-30')
# cutoff after one month of invoice period -> 2 months cutoff
cutoff = self._create_cutoff('04-30')
cutoff.get_prepaid_lines()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_invoice_with_grouping(self):
}),
],
})
invoice.signal_workflow('invoice_open')
invoice.action_invoice_open()
self.assertTrue(invoice.move_id)
iline_res = {
(self._date('01-01'), self._date('12-31')): 2520,
Expand Down

0 comments on commit 12a4c63

Please sign in to comment.