summaryrefslogtreecommitdiff
path: root/addons/l10n_latam_invoice_document
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/l10n_latam_invoice_document
parent8f6bf2087e50020bfad4e336b1d4c5a98a4fa84f (diff)
[IMP] account,* : Change type field to move_type in account.move
task-id: 2028z813
Diffstat (limited to 'addons/l10n_latam_invoice_document')
-rw-r--r--addons/l10n_latam_invoice_document/models/account_move.py12
-rw-r--r--addons/l10n_latam_invoice_document/models/l10n_latam_document_type.py2
-rw-r--r--addons/l10n_latam_invoice_document/wizards/account_move_reversal.py2
3 files changed, 8 insertions, 8 deletions
diff --git a/addons/l10n_latam_invoice_document/models/account_move.py b/addons/l10n_latam_invoice_document/models/account_move.py
index 71b2fbf305d..4b93a7e5764 100644
--- a/addons/l10n_latam_invoice_document/models/account_move.py
+++ b/addons/l10n_latam_invoice_document/models/account_move.py
@@ -64,7 +64,7 @@ class AccountMove(models.Model):
def post(self):
for rec in self.filtered(lambda x: x.l10n_latam_use_documents and (not x.name or x.name == '/')):
- if rec.type in ('in_receipt', 'out_receipt'):
+ if rec.move_type in ('in_receipt', 'out_receipt'):
raise UserError(_('We do not accept the usage of document types on receipts yet. '))
return super().post()
@@ -94,11 +94,11 @@ class AccountMove(models.Model):
raise ValidationError(_('The document number on the following invoices is not correct %s.' % (
without_number.ids)))
- @api.constrains('type', 'l10n_latam_document_type_id')
+ @api.constrains('move_type', 'l10n_latam_document_type_id')
def _check_invoice_type_document_type(self):
for rec in self.filtered('l10n_latam_document_type_id.internal_type'):
internal_type = rec.l10n_latam_document_type_id.internal_type
- invoice_type = rec.type
+ invoice_type = rec.tmove_ype
if internal_type in ['debit_note', 'invoice'] and invoice_type in ['out_refund', 'in_refund']:
raise ValidationError(_('You can not use a %s document type with a refund invoice') % internal_type)
elif internal_type == 'credit_note' and invoice_type in ['out_invoice', 'in_invoice']:
@@ -106,13 +106,13 @@ class AccountMove(models.Model):
def _get_l10n_latam_documents_domain(self):
self.ensure_one()
- if self.type in ['out_refund', 'in_refund']:
+ if self.move_type in ['out_refund', 'in_refund']:
internal_types = ['credit_note']
else:
internal_types = ['invoice', 'debit_note']
return [('internal_type', 'in', internal_types), ('country_id', '=', self.company_id.country_id.id)]
- @api.depends('journal_id', 'partner_id', 'company_id', 'type')
+ @api.depends('journal_id', 'partner_id', 'company_id', 'move_type')
def _compute_l10n_latam_available_document_types(self):
self.l10n_latam_available_document_type_ids = False
for rec in self.filtered(lambda x: x.journal_id and x.l10n_latam_use_documents and x.partner_id):
@@ -165,7 +165,7 @@ class AccountMove(models.Model):
bills because the uniqueness must be per partner """
for rec in self.filtered(lambda x: x.is_purchase_document() and x.l10n_latam_use_documents):
domain = [
- ('type', '=', rec.type),
+ ('move_type', '=', rec.move_type),
# by validating name we validate l10n_latam_document_type_id
('name', '=', rec.name),
('company_id', '=', rec.company_id.id),
diff --git a/addons/l10n_latam_invoice_document/models/l10n_latam_document_type.py b/addons/l10n_latam_invoice_document/models/l10n_latam_document_type.py
index a21eafcf8f8..72de31e5ebc 100644
--- a/addons/l10n_latam_invoice_document/models/l10n_latam_document_type.py
+++ b/addons/l10n_latam_invoice_document/models/l10n_latam_document_type.py
@@ -23,7 +23,7 @@ class L10nLatamDocumentType(models.Model):
report_name = fields.Char('Name on Reports', help='Name that will be printed in reports, for example "CREDIT NOTE"')
internal_type = fields.Selection(
[('invoice', 'Invoices'), ('debit_note', 'Debit Notes'), ('credit_note', 'Credit Notes')], index=True,
- help='Analog to odoo account.move.type but with more options allowing to identify the kind of document we are'
+ help='Analog to odoo account.move.move_type but with more options allowing to identify the kind of document we are'
' working with. (not only related to account.move, could be for documents of other models like stock.picking)')
def _format_document_number(self, document_number):
diff --git a/addons/l10n_latam_invoice_document/wizards/account_move_reversal.py b/addons/l10n_latam_invoice_document/wizards/account_move_reversal.py
index d7b202af62a..e962a0c6a5d 100644
--- a/addons/l10n_latam_invoice_document/wizards/account_move_reversal.py
+++ b/addons/l10n_latam_invoice_document/wizards/account_move_reversal.py
@@ -38,7 +38,7 @@ class AccountMoveReversal(models.TransientModel):
if record.l10n_latam_use_documents:
refund = record.env['account.move'].new({
- 'type': record._reverse_type_map(record.move_ids.type),
+ 'move_type': record._reverse_type_map(record.move_ids.move_type),
'journal_id': record.move_ids.journal_id.id,
'partner_id': record.move_ids.partner_id.id,
'company_id': record.move_ids.company_id.id,