Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions account_billing/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def _create_billing(self, partner):
{
"partner_id": partner.id,
"bill_type": list(set(self.mapped("move_type")))[0],
"currency_id": self.mapped("currency_id")[0].id,
"billing_line_ids": [
Command.create(
{
Expand Down
18 changes: 18 additions & 0 deletions account_billing/tests/test_account_billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,21 @@ def test_7_record_rule_company_restriction(self):
[("id", "=", billing_other.id)]
)
self.assertTrue(billing_with_sudo, "Sudo should bypass company record rule")

def test_account_billing_currency(self):
inv_1 = self._create_invoice(
move_type="in_invoice",
invoice_amount=100,
currency_id=self.currency_eur_id,
partner_id=self.partner_a.id,
payment_term_id=self.payment_term.id,
auto_validate=True,
)
inv_2 = inv_1.copy()
inv_2.invoice_date = fields.Date.today()
inv_2.action_post()
invoices = inv_1 + inv_2
action = invoices.action_create_billing()
customer_billing = self.billing_model.browse(action["res_id"])
self.assertEqual(customer_billing.currency_id.id, self.currency_eur_id)
self.assertEqual(self.env.company.currency_id.id, self.currency_usd_id)