Skip to content

Commit 50cba66

Browse files
committed
[IMP] l10n_ar_sale: calculate dates for billing in arrears
1 parent 58321d9 commit 50cba66

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

l10n_ar_sale/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Argentinian Sale Total Fields",
3-
"version": "18.0.1.2.0",
3+
"version": "18.0.1.4.0",
44
"category": "Localization/Argentina",
55
"sequence": 14,
66
"author": "ADHOC SA",

l10n_ar_sale/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
##############################################################################
55
from . import sale_order
66
from . import sale_order_line
7+
from . import account_move
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
from odoo import models
3+
4+
5+
class AccountMove(models.Model):
6+
_inherit = "account.move"
7+
8+
def _set_afip_service_dates(self):
9+
super(AccountMove, self)._set_afip_service_dates()
10+
if self.env["sale.order"].is_module_installed("sale_subscription_ux"):
11+
for rec in self.filtered(lambda m: m.invoice_date and m.l10n_ar_afip_concept in ["2", "3", "4"]):
12+
so = rec.invoice_line_ids[0].sale_line_ids.order_id or False
13+
if so and so.plan_id.bill_end_period:
14+
rec.l10n_ar_afip_service_start = rec.l10n_ar_afip_service_start - so.plan_id.billing_period
15+
rec.l10n_ar_afip_service_end = rec.l10n_ar_afip_service_end - so.plan_id.billing_period

0 commit comments

Comments
 (0)