File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -112,11 +112,22 @@ def _prepare_invoice(self):
112
112
invoice_vals = super ()._prepare_invoice ()
113
113
if self .fiscal_operation_id :
114
114
# O caso Brasil se caracteriza por ter a Operação Fiscal
115
+ document_type_id = (
116
+ self .order_line [0 ].fiscal_operation_line_id .document_type_id .id
117
+ if self .order_line
118
+ and self .order_line [0 ].fiscal_operation_line_id .document_type_id
119
+ else (
120
+ self .fiscal_operation_id .document_type_ids [0 ].document_type_id .id
121
+ if self .fiscal_operation_id
122
+ and self .fiscal_operation_id .document_type_ids
123
+ else self .company_id .document_type_id .id
124
+ )
125
+ )
115
126
invoice_vals .update (
116
127
{
117
128
"ind_final" : self .ind_final ,
118
129
"fiscal_operation_id" : self .fiscal_operation_id .id ,
119
- "document_type_id" : self . company_id . document_type_id . id ,
130
+ "document_type_id" : document_type_id ,
120
131
}
121
132
)
122
133
return invoice_vals
You can’t perform that action at this time.
0 commit comments