Compare commits
2 Commits
14-product
...
14.0-_comp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
947d287c13 | ||
|
|
a7ee151f15 |
@@ -6,4 +6,4 @@ from odoo import SUPERUSER_ID, api
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
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):
|
||||
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>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from psycopg2 import IntegrityError
|
||||
|
||||
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.misc import format_date
|
||||
from odoo.osv import expression
|
||||
from datetime import timedelta
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -220,7 +222,7 @@ class AccountMove(models.Model):
|
||||
if self.is_purchase_document(include_receipts=True):
|
||||
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:
|
||||
invoice_date = tax_lock_date + timedelta(days=1)
|
||||
invoice_date = tax_lock_date + timedelta(days=1)
|
||||
date = invoice_date
|
||||
return date
|
||||
|
||||
@@ -264,13 +266,20 @@ class AccountMoveLine(models.Model):
|
||||
def _compute_matching_number(self):
|
||||
# TODO maybe it will be better to have the same maching_number for
|
||||
# all partial so it will be easier to group by
|
||||
super()._compute_matching_number()
|
||||
for record in self:
|
||||
if record.matching_number == "P":
|
||||
record.matching_number = ", ".join([
|
||||
"a%d" % pr.id
|
||||
for pr in record.matched_debit_ids + record.matched_credit_ids
|
||||
])
|
||||
try:
|
||||
super(AccountMoveLine, record)._compute_matching_number()
|
||||
if record.matching_number == "P":
|
||||
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):
|
||||
# This is useful when you want to have the product code in a dedicated
|
||||
|
||||
Reference in New Issue
Block a user