@@ -80,6 +80,7 @@ def rc_inv_vals(self, partner, account, rc_type, lines):
8080 'date' : self .date ,
8181 'origin' : self .number ,
8282 'rc_purchase_invoice_id' : self .id ,
83+ 'currency_id' : self .currency_id .id ,
8384 'name' : rc_type .self_invoice_text ,
8485 'fiscal_position_id' : None ,
8586 'rc_partner_supplier_id' : None
@@ -122,10 +123,15 @@ def rc_payment_vals(self, rc_type):
122123
123124 def rc_credit_line_vals (self , journal ):
124125 credit = debit = 0.0
126+ amount_tax = self .amount_tax
127+ if self .currency_id != self .company_id .currency_id :
128+ amount_tax = self .currency_id .with_context (
129+ date = self .date_invoice ).compute (
130+ self .amount_tax , self .company_id .currency_id )
125131 if self .type == 'in_invoice' :
126- credit = self . amount_tax
132+ credit = amount_tax
127133 else :
128- debit = self . amount_tax
134+ debit = amount_tax
129135
130136 return {
131137 'name' : self .number ,
@@ -136,17 +142,22 @@ def rc_credit_line_vals(self, journal):
136142 }
137143
138144 def rc_debit_line_vals (self , amount = None ):
145+ amount_tax = self .amount_tax
146+ if self .currency_id != self .company_id .currency_id :
147+ amount_tax = self .currency_id .with_context (
148+ date = self .date_invoice ).compute (
149+ self .amount_tax , self .company_id .currency_id )
139150 credit = debit = 0.0
140151 if self .type == 'in_invoice' :
141152 if amount :
142153 debit = amount
143154 else :
144- debit = self . amount_tax
155+ debit = amount_tax
145156 else :
146157 if amount :
147158 credit = amount
148159 else :
149- credit = self . amount_tax
160+ credit = amount_tax
150161 return {
151162 'name' : self .number ,
152163 'debit' : debit ,
0 commit comments