mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] account_payment_order: Optimize also account_payment_line.payment_type
This commit is contained in:
@@ -19,7 +19,7 @@ def map_payment_type(cr):
|
||||
openupgrade.get_legacy_name('state'), 'state',
|
||||
[('done', 'uploaded'), ('sent', 'generated')],
|
||||
table='account_payment_order', write='sql')
|
||||
# Populate this missing related field
|
||||
# Populate these missing related fields
|
||||
openupgrade.logged_query(
|
||||
cr, """
|
||||
UPDATE bank_payment_line bpl
|
||||
@@ -28,6 +28,14 @@ def map_payment_type(cr):
|
||||
FROM account_payment_order apo
|
||||
WHERE bpl.order_id = apo.id""",
|
||||
)
|
||||
openupgrade.logged_query(
|
||||
cr, """
|
||||
UPDATE account_payment_line apl
|
||||
SET payment_type = apo.payment_type,
|
||||
state = apo.state
|
||||
FROM account_payment_order apo
|
||||
WHERE apl.order_id = apo.id""",
|
||||
)
|
||||
|
||||
|
||||
@openupgrade.migrate(use_env=True)
|
||||
|
||||
@@ -160,6 +160,8 @@ def populate_computed_fields(env):
|
||||
openupgrade.add_fields(env, [
|
||||
('company_currency_id', 'account.payment.order',
|
||||
'account_payment_order', 'many2one', False, 'account_payment_order'),
|
||||
('payment_type', 'account.payment.line', 'account_payment_line',
|
||||
'selection', False, 'account_payment_order'),
|
||||
('partner_id', 'bank.payment.line', 'bank_payment_line',
|
||||
'many2one', False, 'account_payment_order'),
|
||||
('payment_type', 'bank.payment.line', 'bank_payment_line',
|
||||
|
||||
Reference in New Issue
Block a user