[REF+IMP] account_payment_order: Use native payments

The previous approach creates manually the journal entries and does all
the hard work, plus not being 100% compatible with the bank statement
reconciliation widget (requiring a patch on OCB to see blue lines).

That decision made sense on the moment it was done (v9), where the
native payment model (account.payment) was very limited, and wasn't able
to store all the needed information for the bank transaction.

Now that the limitations are gone, we can get rid off this extra model,
and generate instead `account.payment` records, using both the native
model + methods to perform the same operations.

This serves also to workaround the problem found in #966.

All the code, views and tests of main module have been adapted to this
new approach in this commit. Later commits will adapt the rest of the
modules of the suite, and add migration scripts to transit from the
previous approach to this new one.

TT39832
This commit is contained in:
Pedro M. Baeza
2022-11-06 09:11:45 +01:00
parent 55e9aff82a
commit b8d818967b
16 changed files with 121 additions and 568 deletions

View File

@@ -1,7 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_payment_order,Full access on account.payment.order to Payment Manager,model_account_payment_order,group_account_payment,1,1,1,1
access_account_payment_line,Full access on account.payment.line to Payment Manager,model_account_payment_line,group_account_payment,1,1,1,1
access_bank_payment_line,Full access on bank.payment.line to Payment Manager,model_bank_payment_line,group_account_payment,1,1,1,1
access_bank_payment_line,Full access on account.payment to Payment Manager,account.model_account_payment,group_account_payment,1,1,1,1
base.access_res_partner_bank_group_partner_manager,Full access on res.partner.bank to Account Payment group,base.model_res_partner_bank,group_account_payment,1,1,1,1
base.access_res_bank_group_partner_manager,Full access on res.bank to Account Payment group,base.model_res_bank,group_account_payment,1,1,1,1
access_account_payment_line_create,access_account_payment_line_create,model_account_payment_line_create,group_account_payment,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_account_payment_order Full access on account.payment.order to Payment Manager model_account_payment_order group_account_payment 1 1 1 1
3 access_account_payment_line Full access on account.payment.line to Payment Manager model_account_payment_line group_account_payment 1 1 1 1
4 access_bank_payment_line Full access on bank.payment.line to Payment Manager Full access on account.payment to Payment Manager model_bank_payment_line account.model_account_payment group_account_payment 1 1 1 1
5 base.access_res_partner_bank_group_partner_manager Full access on res.partner.bank to Account Payment group base.model_res_partner_bank group_account_payment 1 1 1 1
6 base.access_res_bank_group_partner_manager Full access on res.bank to Account Payment group base.model_res_bank group_account_payment 1 1 1 1
7 access_account_payment_line_create access_account_payment_line_create model_account_payment_line_create group_account_payment 1 1 1 1

View File

@@ -25,12 +25,5 @@
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
<record id="bank_payment_line_company_rule" model="ir.rule">
<field name="name">Bank payment line multi-company rule</field>
<field name="model_id" ref="model_bank_payment_line" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
</data>
</odoo>