Skip to content

Commit

Permalink
Merge commit 'refs/pull/96074/head' of https://github.com/odoo/odoo i…
Browse files Browse the repository at this point in the history
…nto 16.0-526
  • Loading branch information
docker-odoo committed Nov 24, 2022
2 parents 7bf7366 + fc49ffe commit 1fc2012
Show file tree
Hide file tree
Showing 26 changed files with 2,109 additions and 5 deletions.
12 changes: 8 additions & 4 deletions addons/account/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,17 +815,21 @@ def _synchronize_from_moves(self, changed_fields):
move.write(move._cleanup_write_orm_values(move, move_vals_to_write))
pay.write(move._cleanup_write_orm_values(pay, payment_vals_to_write))

@api.model
def _get_trigger_fields_to_synchronize(self):
return (
'date', 'amount', 'payment_type', 'partner_type', 'payment_reference', 'is_internal_transfer',
'currency_id', 'partner_id', 'destination_account_id', 'partner_bank_id', 'journal_id'
)

def _synchronize_to_moves(self, changed_fields):
''' Update the account.move regarding the modified account.payment.
:param changed_fields: A list containing all modified fields on account.payment.
'''
if self._context.get('skip_account_move_synchronization'):
return

if not any(field_name in changed_fields for field_name in (
'date', 'amount', 'payment_type', 'partner_type', 'payment_reference', 'is_internal_transfer',
'currency_id', 'partner_id', 'destination_account_id', 'partner_bank_id', 'journal_id'
)):
if not any(field_name in changed_fields for field_name in self._get_trigger_fields_to_synchronize()):
return

for pay in self.with_context(skip_account_move_synchronization=True):
Expand Down
9 changes: 9 additions & 0 deletions addons/account_check_printing/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ class AccountPayment(models.Model):
"or if the current numbering is wrong, you can change it in the journal configuration page.",
)
payment_method_line_id = fields.Many2one(index=True)
show_check_number = fields.Boolean(compute='_compute_show_check_number')

@api.depends('payment_method_line_id.code', 'check_number')
def _compute_show_check_number(self):
for payment in self:
payment.show_check_number = (
payment.payment_method_line_id.code == 'check_printing'
and payment.check_number
)

@api.constrains('check_number', 'journal_id')
def _constrains_check_number(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
</xpath>
<xpath expr="//field[@name='payment_method_line_id']" position="after">
<field name="check_manual_sequencing" invisible="1"/>
<field name="check_number" attrs="{'invisible': ['|', ('payment_method_code', '!=', 'check_printing'), ('check_number', '=', False)]}"/>
<field name="show_check_number" invisible="1"/>
<field name="check_number" attrs="{'invisible': [('show_check_number', '=', False)]}"/>
</xpath>
<xpath expr="//field[@name='name']" position='before'>
<widget name="web_ribbon" title="Sent" attrs="{'invisible': [('is_move_sent', '!=', True)]}"/>
Expand Down
9 changes: 9 additions & 0 deletions addons/l10n_ar/models/account_chart_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,12 @@ def _load(self, company):
company.account_purchase_tax_id = self.env['account.tax']

return res

@api.model
def _get_third_party_checks_country_codes(self):
""" Return the list of country codes for the countries where third party checks journals should be created
when installing the COA"""
res = ["AR"]
if self.sudo().env.ref('base.module_l10n_latam_check').state == 'installed':
res += super()._get_third_party_checks_country_codes()
return res
2 changes: 2 additions & 0 deletions addons/l10n_latam_check/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
60 changes: 60 additions & 0 deletions addons/l10n_latam_check/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Advanced Check Management',
'version': "1.0.0",
'category': 'Accounting/Localizations',
'summary': 'Checks Management',
'description': """
Own Checks Management
---------------------
Extends 'Check Printing Base' module to manage own checks with more features:
* allow using own checks that are not printed but filled manually by the user
* allow to use deferred or electronic checks
* printing is disabled
* check number is set manually by the user
* add an optional "Check Cash-In Date" for post-dated checks (deferred payments)
* add a menu to track own checks
Third Party Checks Management
-----------------------------
Add new "Third party check Management" feature.
There are 2 main Payment Methods additions:
* New Third Party Checks:
* allow the user create a check on the fly from a payment
* create a third party check from a customer payment
* Existing Third party check:
* allow the user to reuse a Third party check already created
* pay a vendor bill using an existing Third party check
* move an existing checks between journals (i.e. move to Rejected)
* Send/Receive again a check already used in a Vendor Bill/Customer INV
* allow the user to do mass check transfers
""",
'author': 'ADHOC SA',
'license': 'LGPL-3',
'images': [
],
'depends': [
'account_check_printing',
'base_vat',
],
'data': [
'data/account_payment_method_data.xml',
'security/ir.model.access.csv',
'views/account_payment_view.xml',
'views/account_journal_view.xml',
'wizards/account_payment_register_views.xml',
'wizards/l10n_latam_payment_mass_transfer_views.xml',
],
'installable': True,
'auto_install': False,
'application': False,
}
23 changes: 23 additions & 0 deletions addons/l10n_latam_check/data/account_payment_method_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">

<!-- third party checks -->
<record id="account_payment_method_new_third_party_checks" model="account.payment.method">
<field name="name">New Third Party Checks</field>
<field name="code">new_third_party_checks</field>
<field name="payment_type">inbound</field>
</record>

<record id="account_payment_method_in_third_party_checks" model="account.payment.method">
<field name="name">Existing Third Party Checks</field>
<field name="code">in_third_party_checks</field>
<field name="payment_type">inbound</field>
</record>

<record id="account_payment_method_out_third_party_checks" model="account.payment.method">
<field name="name">Existing Third Party Checks</field>
<field name="code">out_third_party_checks</field>
<field name="payment_type">outbound</field>
</record>

</odoo>

0 comments on commit 1fc2012

Please sign in to comment.