summaryrefslogtreecommitdiff
path: root/addons/account_debit_note
diff options
context:
space:
mode:
authorAnkita Raval <anr@odoo.com>2019-10-30 06:11:02 +0000
committerJigar Vaghela <jva@odoo.com>2020-02-19 09:09:20 +0000
commitd675dbaa4c7174591e0e7c1a3caf3e76877312ce (patch)
tree40840df0a36cb9a6ba3b918835da2a40a07e3a3b /addons/account_debit_note
parent8f6bf2087e50020bfad4e336b1d4c5a98a4fa84f (diff)
[IMP] account,* : Change type field to move_type in account.move
task-id: 2028z813
Diffstat (limited to 'addons/account_debit_note')
-rw-r--r--addons/account_debit_note/tests/test_out_debit_note.py4
-rw-r--r--addons/account_debit_note/views/account_move_view.xml2
-rw-r--r--addons/account_debit_note/wizard/account_debit_note.py12
3 files changed, 9 insertions, 9 deletions
diff --git a/addons/account_debit_note/tests/test_out_debit_note.py b/addons/account_debit_note/tests/test_out_debit_note.py
index a184e3f65a2..78fcada72b8 100644
--- a/addons/account_debit_note/tests/test_out_debit_note.py
+++ b/addons/account_debit_note/tests/test_out_debit_note.py
@@ -23,7 +23,7 @@ class TestAccountDebitNote(AccountTestInvoicingCommon):
debit_note = self.env['account.move'].search([('debit_origin_id', '=', invoice.id)])
debit_note.ensure_one()
self.assertEqual(len(debit_note.invoice_line_ids), 2, "Should have copied the invoice lines")
- self.assertEqual(debit_note.type, 'out_invoice', 'Type of debit note should be the same as the original invoice')
+ self.assertEqual(debit_note.move_type, 'out_invoice', 'Type of debit note should be the same as the original invoice')
self.assertEqual(debit_note.state, 'draft', 'We should create debit notes in draft state')
def test_10_debit_note_in_refund(self):
@@ -42,5 +42,5 @@ class TestAccountDebitNote(AccountTestInvoicingCommon):
debit_note.ensure_one()
self.assertFalse(debit_note.invoice_line_ids, 'We should not copy lines by default on debit notes')
- self.assertEqual(debit_note.type, 'in_invoice', 'Type of debit note should not be refund anymore')
+ self.assertEqual(debit_note.move_type, 'in_invoice', 'Type of debit note should not be refund anymore')
self.assertEqual(debit_note.state, 'draft', 'We should create debit notes in draft state') \ No newline at end of file
diff --git a/addons/account_debit_note/views/account_move_view.xml b/addons/account_debit_note/views/account_move_view.xml
index 6deffec1c07..0a2dc555a64 100644
--- a/addons/account_debit_note/views/account_move_view.xml
+++ b/addons/account_debit_note/views/account_move_view.xml
@@ -10,7 +10,7 @@
<button name="%(action_view_account_move_debit)d" string='Add Debit Note'
type='action' groups="account.group_account_invoice"
attrs="{'invisible': ['|', '|', ('debit_origin_id', '!=', False),
- ('type', 'not in', ('out_invoice', 'in_invoice', 'out_refund', 'in_refund')), ('state', '!=', 'posted')]}"/>
+ ('move_type', 'not in', ('out_invoice', 'in_invoice', 'out_refund', 'in_refund')), ('state', '!=', 'posted')]}"/>
</button>
<div class="oe_button_box" position="inside">
<button type="object" class="oe_stat_button" name="action_view_debit_notes" icon="fa-plus" attrs="{'invisible': [('debit_note_count', '=', 0)]}">
diff --git a/addons/account_debit_note/wizard/account_debit_note.py b/addons/account_debit_note/wizard/account_debit_note.py
index af553426c12..3501599c60a 100644
--- a/addons/account_debit_note/wizard/account_debit_note.py
+++ b/addons/account_debit_note/wizard/account_debit_note.py
@@ -39,14 +39,14 @@ class AccountDebitNote(models.TransientModel):
def _compute_from_moves(self):
for record in self:
move_ids = record.move_ids
- record.move_type = move_ids[0].type if len(move_ids) == 1 or not any(m.type != move_ids[0].type for m in move_ids) else False
+ record.move_type = move_ids[0].move_type if len(move_ids) == 1 or not any(m.move_type != move_ids[0].move_type for m in move_ids) else False
record.journal_type = record.move_type in ['in_refund', 'in_invoice'] and 'purchase' or 'sale'
def _prepare_default_values(self, move):
- if move.type in ('in_refund', 'out_refund'):
- type = 'in_invoice' if move.type == 'in_refund' else 'out_invoice'
+ if move.move_type in ('in_refund', 'out_refund'):
+ type = 'in_invoice' if move.move_type == 'in_refund' else 'out_invoice'
else:
- type = move.type
+ type = move.move_type
default_values = {
'ref': '%s, %s' % (move.name, self.reason) if self.reason else move.name,
'date': self.date or move.date,
@@ -54,9 +54,9 @@ class AccountDebitNote(models.TransientModel):
'journal_id': self.journal_id and self.journal_id.id or move.journal_id.id,
'invoice_payment_term_id': None,
'debit_origin_id': move.id,
- 'type': type,
+ 'move_type': type,
}
- if not self.copy_lines or move.type in [('in_refund', 'out_refund')]:
+ if not self.copy_lines or move.move_type in [('in_refund', 'out_refund')]:
default_values['line_ids'] = [(5, 0, 0)]
return default_values