mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 02:32:00 +02:00
Initial commit: Sale packages
This commit is contained in:
commit
14e3d26998
6469 changed files with 2479670 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from werkzeug import urls
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class PaymentLinkWizard(models.TransientModel):
|
||||
_inherit = 'payment.link.wizard'
|
||||
_description = 'Generate Sales Payment Link'
|
||||
|
||||
def _get_payment_provider_available(self, res_model, res_id, **kwargs):
|
||||
""" Select and return the providers matching the criteria.
|
||||
|
||||
:param str res_model: active model
|
||||
:param int res_id: id of 'active_model' record
|
||||
:return: The compatible providers
|
||||
:rtype: recordset of `payment.provider`
|
||||
"""
|
||||
if res_model == 'sale.order':
|
||||
kwargs['sale_order_id'] = res_id
|
||||
return super()._get_payment_provider_available(**kwargs)
|
||||
|
||||
def _get_additional_link_values(self):
|
||||
""" Override of `payment` to add `sale_order_id` to the payment link values.
|
||||
|
||||
The other values related to the sales order are directly read from the sales order.
|
||||
|
||||
Note: self.ensure_one()
|
||||
|
||||
:return: The additional payment link values.
|
||||
:rtype: dict
|
||||
"""
|
||||
res = super()._get_additional_link_values()
|
||||
if self.res_model != 'sale.order':
|
||||
return res
|
||||
|
||||
# Order-related fields are retrieved in the controller
|
||||
return {
|
||||
'sale_order_id': self.res_id,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue