mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] account_spread_cost_revenue: Skip creating a template
Bug fix: Duplicate spread creation when clicking 'Create Move' Error Steps: 1. Create a spread template. 2. Create a vendor bill and select the same account as the template, then confirm it. 3. Go to 'Spread Costs/Revenues' and click 'create move' on line. 4. It creates a new move and a new template. (It should not create a new template)
This commit is contained in:
@@ -135,6 +135,9 @@ class AccountMoveLine(models.Model):
|
||||
return False
|
||||
return True
|
||||
|
||||
# Skip create new template when create move on spread lines
|
||||
if self.env.context.get("skip_create_template"):
|
||||
return
|
||||
for line in self:
|
||||
if line.spread_check == "linked":
|
||||
continue
|
||||
|
||||
@@ -40,7 +40,9 @@ class AccountInvoiceSpreadLine(models.Model):
|
||||
def create_move(self):
|
||||
"""Button to manually create a move from a spread line entry."""
|
||||
self.ensure_one()
|
||||
self.create_and_reconcile_moves()
|
||||
self.with_context(
|
||||
skip_create_template=True,
|
||||
).create_and_reconcile_moves()
|
||||
|
||||
def _create_moves(self):
|
||||
if self.filtered(lambda l: l.move_id):
|
||||
|
||||
Reference in New Issue
Block a user