From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- .../account_check_printing/models/account_move.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 addons/account_check_printing/models/account_move.py (limited to 'addons/account_check_printing/models/account_move.py') 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 -- cgit v1.2.3