Skip to content
Snippets Groups Projects

16.0.1.3.0 - Fix period selection upon reversal with a specific date + QoL

Merged Houzefa Abbasbhay requested to merge topic/16.0/zouzou into branch/16.0
5 files
+ 59
15
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 9
8
@@ -17,8 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import fields, models
class AccountMove(models.Model):
@@ -21,8 +20,8 @@
from odoo import fields, models
class AccountMove(models.Model):
"""Add a period & dates onto accounting documents."""
"""Journal Entries: Add period, filled based on date."""
_inherit = "account.move"
@@ -30,4 +29,5 @@
comodel_name="account.period",
string="Period",
ondelete="restrict",
copy=False, # Do not copy; will be reset upon validation.
help="The period this accounting document is in.",
@@ -33,4 +33,5 @@
help="The period this accounting document is in.",
index=True,
states={"posted": [("readonly", True), ("required", True)]},
)
@@ -34,10 +35,10 @@
states={"posted": [("readonly", True), ("required", True)]},
)
def action_post(self):
"""Override accounting document validation to fill period."""
self.fill_period()
return super().action_post()
def _post(self, soft=True):
"""Override validation to fill period."""
ret = super()._post(soft=soft)
self.filtered(lambda move: move.state == "posted").fill_period()
return ret
def fill_period(self):
@@ -42,6 +43,6 @@
def fill_period(self):
"""Find an open period around move date, set it onto that move."""
"""Find an open period around move date, set it onto each move."""
today = fields.Date.context_today(self)
for accdoc in self:
Loading