mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[TMP]pms_api_rest: waiting for new company corrective invoicing policy field
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from odoo import _, fields
|
from odoo import _, fields
|
||||||
|
|
||||||
from odoo.addons.base_rest import restapi
|
from odoo.addons.base_rest import restapi
|
||||||
@@ -27,7 +25,6 @@ class PmsInvoiceService(Component):
|
|||||||
)
|
)
|
||||||
def update_invoice(self, invoice_id, pms_invoice_info):
|
def update_invoice(self, invoice_id, pms_invoice_info):
|
||||||
invoice = self.env["account.move"].browse(invoice_id)
|
invoice = self.env["account.move"].browse(invoice_id)
|
||||||
company = invoice.company_id
|
|
||||||
|
|
||||||
# Build update values dict
|
# Build update values dict
|
||||||
# TODO: Missing data:
|
# TODO: Missing data:
|
||||||
@@ -73,7 +70,9 @@ class PmsInvoiceService(Component):
|
|||||||
# and the invoice stateit will be modified directly or a reverse
|
# and the invoice stateit will be modified directly or a reverse
|
||||||
# of the current invoice will be created to later create a new one
|
# of the current invoice will be created to later create a new one
|
||||||
# with the updated data.
|
# with the updated data.
|
||||||
if invoice.state != "draft" and company.corrective_invoice_policy == "strict":
|
# TODO: to create core pms correct_invoice_policy field
|
||||||
|
# if invoice.state != "draft" and company.corrective_invoice_policy == "strict":
|
||||||
|
if invoice.state != "draft":
|
||||||
# invoice create refund
|
# invoice create refund
|
||||||
# new invoice with new_vals
|
# new invoice with new_vals
|
||||||
move_reversal = (
|
move_reversal = (
|
||||||
@@ -81,7 +80,7 @@ class PmsInvoiceService(Component):
|
|||||||
.with_context(active_model="account.move", active_ids=invoice.ids)
|
.with_context(active_model="account.move", active_ids=invoice.ids)
|
||||||
.create(
|
.create(
|
||||||
{
|
{
|
||||||
"date": fields.Date.today() + datetime.timedelta(days=7),
|
"date": fields.Date.today(),
|
||||||
"reason": _("Invoice modification"),
|
"reason": _("Invoice modification"),
|
||||||
"refund_method": "modify",
|
"refund_method": "modify",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user