summaryrefslogtreecommitdiff
path: root/addons/account_check_printing/models/account_move.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/account_check_printing/models/account_move.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/account_check_printing/models/account_move.py')
-rw-r--r--addons/account_check_printing/models/account_move.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/account_check_printing/models/account_move.py b/addons/account_check_printing/models/account_move.py
new file mode 100644
index 00000000..c5c8dcb6
--- /dev/null
+++ b/addons/account_check_printing/models/account_move.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+
+from odoo import models, fields, api
+
+
+class AccountMove(models.Model):
+ _inherit = 'account.move'
+
+ preferred_payment_method_id = fields.Many2one(
+ string="Preferred Payment Method",
+ comodel_name='account.payment.method',
+ compute='_compute_preferred_payment_method_idd',
+ store=True,
+ )
+
+ @api.depends('partner_id')
+ def _compute_preferred_payment_method_idd(self):
+ for move in self:
+ partner = move.partner_id
+ # take the payment method corresponding to the move's company
+ move.preferred_payment_method_id = partner.with_company(move.company_id).property_payment_method_id