Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] account*: Remove dependencies in demo data on tests #1391

Merged
merged 2 commits into from
Jan 15, 2025
Merged
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
14 changes: 8 additions & 6 deletions account_payment_partner/tests/test_account_payment_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,15 +572,17 @@ def test_account_move_payment_mode_id_default(self):
move_form = Form(
self.move_model.with_context(
default_name="Invoice test", default_move_type="out_invoice"
)
).with_company(self.env.ref("base.main_company").id)
)
self.assertFalse(move_form.payment_mode_id)
self.env["ir.default"].create(
{"field_id": field.id, "json_value": payment_mode.id}
)
self.env["ir.default"].with_company(
self.env.ref("base.main_company").id
).create({"field_id": field.id, "json_value": payment_mode.id})
move_form = Form(
self.move_model.with_context(
default_name="Invoice test", default_move_type="out_invoice"
)
default_name="Invoice test",
default_move_type="out_invoice",
default_company_id=self.env.ref("base.main_company").id,
).with_company(self.env.ref("base.main_company").id)
)
self.assertEqual(move_form.payment_mode_id, payment_mode)
4 changes: 2 additions & 2 deletions account_payment_purchase/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ def _onchange_purchase_auto_complete(self):
"message": _("Selected purchase order have different payment mode."),
}
return res
elif self.payment_mode_id.id != new_mode:
elif new_mode and self.payment_mode_id.id != new_mode:
self.payment_mode_id = new_mode
if old_bank and new_bank and old_bank != new_bank:
res["warning"] = {
"title": _("Warning"),
"message": _("Selected purchase order have different supplier bank."),
}
elif self.partner_bank_id.id != new_bank:
elif new_bank and self.partner_bank_id.id != new_bank:
self.partner_bank_id = new_bank
return res
Loading