Skip to content
Extraits de code Groupes Projets
Valider bd4c4cd7 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament Validation de Rémi - Le Filament
Parcourir les fichiers

[add] estimated_date_invoice

parent 4af1ebd4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,7 +2,7 @@
# © 2018 Le Filament (http://www.le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
from odoo import api, fields, models
class SaleOrder(models.Model):
......@@ -12,6 +12,19 @@ class SaleOrder(models.Model):
confirmation_date = fields.Datetime(readonly=False)
estimated_date_invoice = fields.Date("Date de facturation prévisionnelle")
# ------------------------------------------------------
# Onchange
# ------------------------------------------------------
@api.onchange("estimated_date_invoice")
def _onchange_estimated_date_invoice(self):
"""Update order lines with estimated invoice date from sale order"""
if self.estimated_date_invoice:
for line in self.order_line:
line.estimated_date_invoice = self.estimated_date_invoice
# ------------------------------------------------------
# Override parent
# ------------------------------------------------------
def _prepare_invoice(self):
values = super(SaleOrder, self)._prepare_invoice()
values.update(
......
......@@ -11,7 +11,11 @@ class SaleOrderLine(models.Model):
insurances = fields.Many2many(
"ecozimut.insurance", ondelete="cascade", string="Assurances", index=True
)
estimated_date_invoice = fields.Date("Date de facturation prévisionnelle")
# ------------------------------------------------------
# Onchange
# ------------------------------------------------------
@api.onchange("product_id")
def product_id_change(self):
res = super(SaleOrderLine, self).product_id_change()
......@@ -19,3 +23,13 @@ class SaleOrderLine(models.Model):
if not line.insurances:
line.insurances = line.product_id.insurances
return res
# ------------------------------------------------------
# Override parent
# ------------------------------------------------------
def _timesheet_create_task_prepare_values(self, project):
values = super()._timesheet_create_task_prepare_values()
values['date_end'] = self.estimated_date_invoice
values['date_deadline'] = self.estimated_date_invoice
return values
<odoo>
<data>
<!-- Form view -->
<record id="view_sales_order_auto_done_setting" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
......@@ -12,6 +12,7 @@
</field>
</record>
<!-- Form view -->
<record id="ecozimut_businessDeveloper_view" model="ir.ui.view">
<field name="name">ecozimut.businessDeveloper.view</field>
<field name="model">sale.order</field>
......@@ -31,6 +32,11 @@
widget="many2many_tags"
optional="show"
/>
<field
name="estimated_date_invoice"
string="Prévi factu"
optional="show"
/>
</xpath>
<field name="payment_term_id" position="after">
<field name="estimated_date_invoice" />
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter