mirror of
https://gitlab.com/flectra-community/bank-payment.git
synced 2024-11-22 05:32:05 +00:00
23 lines
792 B
Python
23 lines
792 B
Python
# Copyright 2015 Tecnativa - Pedro M. Baeza
|
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
from flectra import models
|
|
|
|
|
|
class StockRule(models.Model):
|
|
_inherit = "stock.rule"
|
|
|
|
def _prepare_purchase_order(self, company_id, origins, values):
|
|
"""Propagate payment mode on MTO/drop shipping."""
|
|
res = super()._prepare_purchase_order(company_id, origins, values)
|
|
values = values[0]
|
|
partner = values["supplier"].name
|
|
if partner:
|
|
res["payment_mode_id"] = partner.with_company(
|
|
self.company_id.id
|
|
).supplier_payment_mode_id.id
|
|
res["supplier_partner_bank_id"] = self.env[
|
|
"purchase.order"
|
|
]._get_default_supplier_partner_bank(partner)
|
|
return res
|