Compare commits
2 Commits
14.0
...
14.0-_comp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
947d287c13 | ||
|
|
a7ee151f15 |
@@ -6,4 +6,4 @@ from odoo import SUPERUSER_ID, api
|
|||||||
|
|
||||||
def post_init_hook(cr, registry):
|
def post_init_hook(cr, registry):
|
||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
env["account.move.line"].update_matching_number()
|
# env["account.move.line"].update_matching_number()
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ from odoo import SUPERUSER_ID, api
|
|||||||
|
|
||||||
def migrate(cr, version):
|
def migrate(cr, version):
|
||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
env["account.move.line"].update_matching_number()
|
# env["account.move.line"].update_matching_number()
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
from psycopg2 import IntegrityError
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
from odoo.osv import expression
|
||||||
from odoo.tools import float_is_zero
|
from odoo.tools import float_is_zero
|
||||||
from odoo.tools.misc import format_date
|
from odoo.tools.misc import format_date
|
||||||
from odoo.osv import expression
|
|
||||||
from datetime import timedelta
|
|
||||||
from odoo.exceptions import UserError
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -220,7 +222,7 @@ class AccountMove(models.Model):
|
|||||||
if self.is_purchase_document(include_receipts=True):
|
if self.is_purchase_document(include_receipts=True):
|
||||||
tax_lock_date = self.company_id.tax_lock_date
|
tax_lock_date = self.company_id.tax_lock_date
|
||||||
if invoice_date and tax_lock_date and has_tax and invoice_date <= tax_lock_date:
|
if invoice_date and tax_lock_date and has_tax and invoice_date <= tax_lock_date:
|
||||||
invoice_date = tax_lock_date + timedelta(days=1)
|
invoice_date = tax_lock_date + timedelta(days=1)
|
||||||
date = invoice_date
|
date = invoice_date
|
||||||
return date
|
return date
|
||||||
|
|
||||||
@@ -264,13 +266,20 @@ class AccountMoveLine(models.Model):
|
|||||||
def _compute_matching_number(self):
|
def _compute_matching_number(self):
|
||||||
# TODO maybe it will be better to have the same maching_number for
|
# TODO maybe it will be better to have the same maching_number for
|
||||||
# all partial so it will be easier to group by
|
# all partial so it will be easier to group by
|
||||||
super()._compute_matching_number()
|
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.matching_number == "P":
|
try:
|
||||||
record.matching_number = ", ".join([
|
super(AccountMoveLine, record)._compute_matching_number()
|
||||||
"a%d" % pr.id
|
if record.matching_number == "P":
|
||||||
for pr in record.matched_debit_ids + record.matched_credit_ids
|
record.matching_number = ", ".join([
|
||||||
])
|
"a%d" % pr.id
|
||||||
|
for pr in record.matched_debit_ids + record.matched_credit_ids
|
||||||
|
])
|
||||||
|
except IntegrityError as error:
|
||||||
|
_logger.info(
|
||||||
|
f"unable to update matching number for line ID {record.id},"
|
||||||
|
"{record.display_name}"
|
||||||
|
)
|
||||||
|
_logger.info(error)
|
||||||
|
|
||||||
def _get_computed_name(self):
|
def _get_computed_name(self):
|
||||||
# This is useful when you want to have the product code in a dedicated
|
# This is useful when you want to have the product code in a dedicated
|
||||||
|
|||||||
Reference in New Issue
Block a user