[IMP] product_contract: Add posibility to compute date_start of line using confirmation date_start

With these changes, we allow the contract line start date to be computed
using the order confirmation date. When the product is configured with
any of the options set in contract_start_date_method other than manual,
the start date will be calculated based on the established date and the
selected period.

Additionally, we can force the month in which we will work in case the
frequency is yearly, quarterly, or semesterly.

Is not added support for daily, weekly or monthlylastday in this commit.
This commit is contained in:
Carlos Roca
2024-08-29 15:05:37 +02:00
parent 88d2cb9a2f
commit 9e8129290a
16 changed files with 1133 additions and 109 deletions

View File

@@ -52,6 +52,12 @@ To use this module, you need to:
product
3. Define default recurrence rules
Known issues / Roadmap
======================
- There's no support right now for computing the start date for the
following recurrent types: daily, weekly and monthlylastday.
Bug Tracker
===========
@@ -80,6 +86,7 @@ Contributors
- Ernesto Tejeda
- Pedro M. Baeza
- Carlos Roca
- David Jaen <david.jaen.revert@gmail.com>

View File

@@ -9,16 +9,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-10 03:15+0000\n"
"PO-Revision-Date: 2020-06-17 11:28+0000\n"
"POT-Creation-Date: 2024-08-30 12:54+0000\n"
"PO-Revision-Date: 2024-08-30 15:06+0200\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"
"X-Generator: Poedit 3.0.1\n"
#. module: product_contract
#: model_terms:ir.ui.view,arch_db:product_contract.contract_contract_customer_form_view
@@ -26,6 +26,17 @@ msgid "<span class=\"o_stat_text\">Sale Orders</span>"
msgstr "<span class=\"o_stat_text\">Pedidos de Venta</span>"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__4
msgid "April"
msgstr "Abril"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__8
msgid "August"
msgstr "Agosto"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__is_auto_renew
#: model:ir.model.fields,field_description:product_contract.field_product_product__is_auto_renew
#: model:ir.model.fields,field_description:product_contract.field_product_template__is_auto_renew
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__is_auto_renew
@@ -39,19 +50,36 @@ msgstr "Auto-renovación"
msgid "Automatically Create Contracts At Sale Order Confirmation"
msgstr "Crear Contratos Automáticamente en la Confirmación del Pedido de Venta"
#. module: product_contract
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
msgid "Cancel"
msgstr "Cancelar"
#. module: product_contract
#: model:ir.model,name:product_contract.model_res_company
msgid "Companies"
msgstr "Compañías"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__company_id
msgid "Company"
msgstr "Compañía"
#. module: product_contract
#: model:ir.model,name:product_contract.model_res_config_settings
msgid "Config Settings"
msgstr "Configuraciones"
#. module: product_contract
#: model:ir.actions.act_window,name:product_contract.product_contract_configurator_action
msgid "Configure a contract"
msgstr "Configurar un contrato"
#. module: product_contract
#: model:ir.model,name:product_contract.model_contract_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_id
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_id
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
#: model_terms:ir.ui.view,arch_db:product_contract.product_template_form_contract_view
msgid "Contract"
msgstr "Contrato"
@@ -67,11 +95,13 @@ msgid "Contract Line"
msgstr "Línea de Contrato"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_line_id
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_line_id
msgid "Contract Line to replace"
msgstr "Línea de Contrato a Reemplazar"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_template_id
#: model:ir.model.fields,field_description:product_contract.field_product_product__property_contract_template_id
#: model:ir.model.fields,field_description:product_contract.field_product_template__property_contract_template_id
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_template_id
@@ -103,24 +133,41 @@ msgid "Create Contracts"
msgstr "Crear Contratos"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__create_uid
msgid "Created by"
msgstr "Creado por"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__create_date
msgid "Created on"
msgstr "Creado el"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__date_end
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__date_end
msgid "Date End"
msgstr "Fecha de Finalización"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__date_start
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__date_start
msgid "Date Start"
msgstr "Fecha de Inicio"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__termination_notice_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__daily
msgid "Day(s)"
msgstr "Días"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__12
msgid "December"
msgstr "Diciembre"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_product__default_qty
#: model:ir.model.fields,field_description:product_contract.field_product_template__default_qty
@@ -128,6 +175,70 @@ msgid "Default Quantity"
msgstr "Cantidad Predeterminada"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__display_name
msgid "Display Name"
msgstr "Nombre Para Mostrar"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__end_this
msgid "End of current period"
msgstr "Final de este periodo"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__end_next
msgid "End of next period"
msgstr "Final del siguiente periodo"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__2
msgid "February"
msgstr "Febrero"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__5
msgid "Fifth month"
msgstr "Quinto mes"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_quarterly__1
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__1
msgid "First month"
msgstr "Primer mes"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_product__force_month_quarterly
#: model:ir.model.fields,field_description:product_contract.field_product_product__force_month_semesterly
#: model:ir.model.fields,field_description:product_contract.field_product_product__force_month_yearly
#: model:ir.model.fields,field_description:product_contract.field_product_template__force_month_quarterly
#: model:ir.model.fields,field_description:product_contract.field_product_template__force_month_semesterly
#: model:ir.model.fields,field_description:product_contract.field_product_template__force_month_yearly
msgid "Force Month"
msgstr "Forzar mes"
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_product__force_month_quarterly
#: model:ir.model.fields,help:product_contract.field_product_template__force_month_quarterly
msgid "Force the month to be used inside the quarter"
msgstr "Forzar el mes usado en el trimestre"
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_product__force_month_semesterly
#: model:ir.model.fields,help:product_contract.field_product_template__force_month_semesterly
msgid "Force the month to be used inside the semester"
msgstr "Forzar el mes usado en el semestre"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__4
msgid "Fourth month"
msgstr "Cuarto mes"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__id
msgid "ID"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__recurring_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_product__recurring_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_template__recurring_rule_type
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__recurring_rule_type
@@ -135,6 +246,7 @@ msgid "Invoice Every"
msgstr "Factura Cada"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__recurring_invoicing_type
#: model:ir.model.fields,field_description:product_contract.field_product_product__recurring_invoicing_type
#: model:ir.model.fields,field_description:product_contract.field_product_template__recurring_invoicing_type
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__recurring_invoicing_type
@@ -150,17 +262,56 @@ msgid "Is a contract"
msgstr "Es un contrato"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__1
msgid "January"
msgstr "Enero"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__7
msgid "July"
msgstr "Julio"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__6
msgid "June"
msgstr "Junio"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__write_uid
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__write_date
msgid "Last Updated on"
msgstr "Última actualización el"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__manual
msgid "Manual"
msgstr "Manual"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__3
msgid "March"
msgstr "Marzo"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__5
msgid "May"
msgstr "Mayo"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__termination_notice_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__monthly
msgid "Month(s)"
msgstr "Meses"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__monthlylastday
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__monthlylastday
msgid "Month(s) last day"
msgstr "Mes (es) último día"
@@ -169,35 +320,65 @@ msgstr "Mes (es) último día"
msgid "Need Contract Creation"
msgstr "Necesita Creación de Contrato"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__11
msgid "November"
msgstr "Noviembre"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__10
msgid "October"
msgstr "Octubre"
#. module: product_contract
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
msgid "Ok"
msgstr "Vale"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__partner_id
msgid "Partner"
msgstr "Contacto"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_invoicing_type__post-paid
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_invoicing_type__post-paid
msgid "Post-paid"
msgstr "Pospago"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_invoicing_type__pre-paid
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_invoicing_type__pre-paid
msgid "Pre-paid"
msgstr "Pagado por Adelantado"
#. module: product_contract
#: model:ir.model,name:product_contract.model_product_template
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__product_id
msgid "Product"
msgstr "Producto"
#. module: product_contract
#: model:ir.model,name:product_contract.model_product_contract_configurator
msgid "Product Contract Configurator Wizard"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__product_uom_qty
msgid "Quantity"
msgstr "Cantidad"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__quarterly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__quarterly
msgid "Quarter(s)"
msgstr ""
msgstr "Trimestre(s)"
#. module: product_contract
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
#: model_terms:ir.ui.view,arch_db:product_contract.view_order_form
msgid "Recurrence Invoicing"
msgstr "Facturación Recurrente"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__auto_renew_interval
#: model:ir.model.fields,field_description:product_contract.field_product_product__auto_renew_interval
#: model:ir.model.fields,field_description:product_contract.field_product_template__auto_renew_interval
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__auto_renew_interval
@@ -205,6 +386,7 @@ msgid "Renew Every"
msgstr "Renovar cada"
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__auto_renew_interval
#: model:ir.model.fields,help:product_contract.field_product_product__auto_renew_interval
#: model:ir.model.fields,help:product_contract.field_product_template__auto_renew_interval
#: model:ir.model.fields,help:product_contract.field_sale_order_line__auto_renew_interval
@@ -212,6 +394,7 @@ msgid "Renew every (Days/Week/Month/Year)"
msgstr "Renovar cada (días / semana / mes / año)"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__auto_renew_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_product__auto_renew_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_template__auto_renew_rule_type
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__auto_renew_rule_type
@@ -253,18 +436,36 @@ msgid "Sales Orders"
msgstr "Pedidos de Ventas"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__semesterly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__semesterly
msgid "Semester(s)"
msgstr ""
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_quarterly__2
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__2
msgid "Second month"
msgstr "Segundo mes"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__semesterly
msgid "Semester(s)"
msgstr "Semestre(s)"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__9
msgid "September"
msgstr "Septiembre"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__6
msgid "Sixth month"
msgstr "Sexto mes"
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__recurring_rule_type
#: model:ir.model.fields,help:product_contract.field_product_product__recurring_rule_type
#: model:ir.model.fields,help:product_contract.field_product_template__recurring_rule_type
#: model:ir.model.fields,help:product_contract.field_sale_order_line__recurring_rule_type
msgid "Specify Interval for automatic invoice generation."
msgstr "Especifique el intervalo para la generación automática de facturas."
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__auto_renew_rule_type
#: model:ir.model.fields,help:product_contract.field_product_product__auto_renew_rule_type
#: model:ir.model.fields,help:product_contract.field_product_template__auto_renew_rule_type
#: model:ir.model.fields,help:product_contract.field_sale_order_line__auto_renew_rule_type
@@ -272,6 +473,7 @@ msgid "Specify Interval for automatic renewal."
msgstr "Especifique Intervalo para renovación automática."
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__recurring_invoicing_type
#: model:ir.model.fields,help:product_contract.field_product_product__recurring_invoicing_type
#: model:ir.model.fields,help:product_contract.field_product_template__recurring_invoicing_type
#: model:ir.model.fields,help:product_contract.field_sale_order_line__recurring_invoicing_type
@@ -280,6 +482,24 @@ msgstr ""
"Especifique si la fecha del proceso es 'desde' o 'hasta' la fecha de "
"facturación"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_start_date_method
#: model:ir.model.fields,field_description:product_contract.field_product_product__contract_start_date_method
#: model:ir.model.fields,field_description:product_contract.field_product_template__contract_start_date_method
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_start_date_method
msgid "Start Date Method"
msgstr "Método fecha de inicio"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__start_this
msgid "Start of current period"
msgstr "Inicio del periodo actual"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__start_next
msgid "Start of next period"
msgstr "Inicio del siguiente periodo"
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_product__termination_notice_interval
#: model:ir.model.fields,field_description:product_contract.field_product_template__termination_notice_interval
@@ -293,19 +513,99 @@ msgid "Termination Notice type"
msgstr "Tipo de aviso de Terminación"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_quarterly__3
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__3
msgid "Third month"
msgstr "Tercer mes"
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__contract_start_date_method
#: model:ir.model.fields,help:product_contract.field_product_product__contract_start_date_method
#: model:ir.model.fields,help:product_contract.field_product_template__contract_start_date_method
#: model:ir.model.fields,help:product_contract.field_sale_order_line__contract_start_date_method
msgid ""
"This field allows to define how the start date of the contract will\n"
" be calculated:\n"
"\n"
" - Manual: The start date will be selected by the user, by default "
"will be the\n"
" date of sale confirmation.\n"
" - Start of current period: The start date will be the first day of "
"the actual\n"
" period selected on 'Invoicing Every' field. Example: If we are on "
"2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be "
"2024/01/01.\n"
" - End of current period: The start date will be the last day of the "
"actual\n"
" period selected on 'Invoicing Every' field. Example: If we are on "
"2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be "
"2024/12/31.\n"
" - Start of next period: The start date will be the first day of the "
"next\n"
" period selected on 'Invoicing Every' field. Example: If we are on "
"2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be "
"2025/01/01.\n"
" - End of next period: The start date will be the last day of the "
"actual\n"
" period selected on 'Invoicing Every' field. Example: If we are on "
"2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be "
"2025/12/31.\n"
" "
msgstr ""
"Este campo permite definir cómo se calculará la fecha de inicio \n"
" del contrato:\n"
"\n"
" - Manual: La fecha de inicio será seleccionada por el usuario, por "
"defecto \n"
" será la fecha de confirmación de la venta.\n"
" - Inicio del periodo actual: La fecha de inicio será el primer día "
"del periodo \n"
" actual seleccionado en el campo 'Facturación cada'. Ejemplo: Si "
"estamos en \n"
" 2024/08/27 y el periodo seleccionado es 'Año(s)', la fecha de inicio "
"será \n"
" 2024/01/01.\n"
" - Fin del periodo actual: La fecha de inicio será el último día del "
"periodo \n"
" actual seleccionado en el campo 'Facturación cada'. Ejemplo: Si "
"estamos \n"
" en 2024/08/27 y el periodo seleccionado es 'Año(s)', la fecha de "
"inicio \n"
" será 2024/12/31.\n"
" - Inicio del siguiente periodo: La fecha de inicio será el primer "
"día del \n"
" siguiente periodo seleccionado en el campo 'Facturación cada'. "
"Ejemplo: \n"
" Si estamos en 2024/08/27 y el periodo seleccionado es 'Año(s)', la "
"fecha \n"
" de inicio será 2025/01/01.\n"
" - Fin del siguiente periodo: La fecha de inicio será el último día "
"del siguiente \n"
" periodo seleccionado en el campo 'Facturación cada'. Ejemplo: Si "
"estamos en \n"
" 2024/08/27 y el periodo seleccionado es 'Año(s)', la fecha de inicio "
"será \n"
" 2025/12/31.\n"
" "
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__termination_notice_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__weekly
msgid "Week(s)"
msgstr "Semanas"
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__yearly
msgid "Year(s)"
msgstr "Años"
@@ -325,9 +625,25 @@ msgid ""
"You must specify a contract template for '%(product_name)s' product in "
"'%(company_name)s' company."
msgstr ""
"Debes especificar una plantilla de contrato para el producto "
"'%(product_name)s' en la empresa '%(company_name)s'."
#~ msgid "Display Name"
#~ msgstr "Nombre Para Mostrar"
#. module: product_contract
#. odoo-python
#: code:addons/product_contract/models/sale_order_line.py:0
#, python-format
msgid ""
"{product}\n"
" - Recurrency: {recurring_rule}\n"
" - Invoicing Type: {invoicing_type}\n"
" - Date: {date_text}\n"
" "
msgstr ""
"{product}\n"
" - Periodicidad: {recurring_rule}\n"
" - Tipo de facturación: {invoicing_type}\n"
" - Fecha: {date_text}\n"
" "
#~ msgid "Product Template"
#~ msgstr "Plantilla de producto"

View File

@@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-30 12:54+0000\n"
"PO-Revision-Date: 2024-08-30 12:54+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -19,6 +21,17 @@ msgid "<span class=\"o_stat_text\">Sale Orders</span>"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__4
msgid "April"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__8
msgid "August"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__is_auto_renew
#: model:ir.model.fields,field_description:product_contract.field_product_product__is_auto_renew
#: model:ir.model.fields,field_description:product_contract.field_product_template__is_auto_renew
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__is_auto_renew
@@ -32,19 +45,36 @@ msgstr ""
msgid "Automatically Create Contracts At Sale Order Confirmation"
msgstr ""
#. module: product_contract
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
msgid "Cancel"
msgstr ""
#. module: product_contract
#: model:ir.model,name:product_contract.model_res_company
msgid "Companies"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__company_id
msgid "Company"
msgstr ""
#. module: product_contract
#: model:ir.model,name:product_contract.model_res_config_settings
msgid "Config Settings"
msgstr ""
#. module: product_contract
#: model:ir.actions.act_window,name:product_contract.product_contract_configurator_action
msgid "Configure a contract"
msgstr ""
#. module: product_contract
#: model:ir.model,name:product_contract.model_contract_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_id
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_id
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
#: model_terms:ir.ui.view,arch_db:product_contract.product_template_form_contract_view
msgid "Contract"
msgstr ""
@@ -60,11 +90,13 @@ msgid "Contract Line"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_line_id
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_line_id
msgid "Contract Line to replace"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_template_id
#: model:ir.model.fields,field_description:product_contract.field_product_product__property_contract_template_id
#: model:ir.model.fields,field_description:product_contract.field_product_template__property_contract_template_id
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_template_id
@@ -96,24 +128,41 @@ msgid "Create Contracts"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__create_uid
msgid "Created by"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__create_date
msgid "Created on"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__date_end
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__date_end
msgid "Date End"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__date_start
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__date_start
msgid "Date Start"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__termination_notice_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__daily
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__daily
msgid "Day(s)"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__12
msgid "December"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_product__default_qty
#: model:ir.model.fields,field_description:product_contract.field_product_template__default_qty
@@ -121,6 +170,70 @@ msgid "Default Quantity"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__display_name
msgid "Display Name"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__end_this
msgid "End of current period"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__end_next
msgid "End of next period"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__2
msgid "February"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__5
msgid "Fifth month"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_quarterly__1
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__1
msgid "First month"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_product__force_month_quarterly
#: model:ir.model.fields,field_description:product_contract.field_product_product__force_month_semesterly
#: model:ir.model.fields,field_description:product_contract.field_product_product__force_month_yearly
#: model:ir.model.fields,field_description:product_contract.field_product_template__force_month_quarterly
#: model:ir.model.fields,field_description:product_contract.field_product_template__force_month_semesterly
#: model:ir.model.fields,field_description:product_contract.field_product_template__force_month_yearly
msgid "Force Month"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_product__force_month_quarterly
#: model:ir.model.fields,help:product_contract.field_product_template__force_month_quarterly
msgid "Force the month to be used inside the quarter"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_product__force_month_semesterly
#: model:ir.model.fields,help:product_contract.field_product_template__force_month_semesterly
msgid "Force the month to be used inside the semester"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__4
msgid "Fourth month"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__id
msgid "ID"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__recurring_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_product__recurring_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_template__recurring_rule_type
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__recurring_rule_type
@@ -128,6 +241,7 @@ msgid "Invoice Every"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__recurring_invoicing_type
#: model:ir.model.fields,field_description:product_contract.field_product_product__recurring_invoicing_type
#: model:ir.model.fields,field_description:product_contract.field_product_template__recurring_invoicing_type
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__recurring_invoicing_type
@@ -143,17 +257,56 @@ msgid "Is a contract"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__1
msgid "January"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__7
msgid "July"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__6
msgid "June"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__write_uid
msgid "Last Updated by"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__write_date
msgid "Last Updated on"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__manual
msgid "Manual"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__3
msgid "March"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__5
msgid "May"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__termination_notice_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__monthly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__monthly
msgid "Month(s)"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__monthlylastday
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__monthlylastday
msgid "Month(s) last day"
msgstr ""
@@ -162,35 +315,65 @@ msgstr ""
msgid "Need Contract Creation"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__11
msgid "November"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__10
msgid "October"
msgstr ""
#. module: product_contract
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
msgid "Ok"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__partner_id
msgid "Partner"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_invoicing_type__post-paid
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_invoicing_type__post-paid
msgid "Post-paid"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_invoicing_type__pre-paid
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_invoicing_type__pre-paid
msgid "Pre-paid"
msgstr ""
#. module: product_contract
#: model:ir.model,name:product_contract.model_product_template
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__product_id
msgid "Product"
msgstr ""
#. module: product_contract
#: model:ir.model,name:product_contract.model_product_contract_configurator
msgid "Product Contract Configurator Wizard"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__product_uom_qty
msgid "Quantity"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__quarterly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__quarterly
msgid "Quarter(s)"
msgstr ""
#. module: product_contract
#: model_terms:ir.ui.view,arch_db:product_contract.product_contract_configurator_form
#: model_terms:ir.ui.view,arch_db:product_contract.view_order_form
msgid "Recurrence Invoicing"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__auto_renew_interval
#: model:ir.model.fields,field_description:product_contract.field_product_product__auto_renew_interval
#: model:ir.model.fields,field_description:product_contract.field_product_template__auto_renew_interval
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__auto_renew_interval
@@ -198,6 +381,7 @@ msgid "Renew Every"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__auto_renew_interval
#: model:ir.model.fields,help:product_contract.field_product_product__auto_renew_interval
#: model:ir.model.fields,help:product_contract.field_product_template__auto_renew_interval
#: model:ir.model.fields,help:product_contract.field_sale_order_line__auto_renew_interval
@@ -205,6 +389,7 @@ msgid "Renew every (Days/Week/Month/Year)"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__auto_renew_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_product__auto_renew_rule_type
#: model:ir.model.fields,field_description:product_contract.field_product_template__auto_renew_rule_type
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__auto_renew_rule_type
@@ -245,19 +430,37 @@ msgstr ""
msgid "Sales Orders"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_quarterly__2
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__2
msgid "Second month"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__semesterly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__semesterly
msgid "Semester(s)"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_yearly__9
msgid "September"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__6
msgid "Sixth month"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__recurring_rule_type
#: model:ir.model.fields,help:product_contract.field_product_product__recurring_rule_type
#: model:ir.model.fields,help:product_contract.field_product_template__recurring_rule_type
#: model:ir.model.fields,help:product_contract.field_sale_order_line__recurring_rule_type
msgid "Specify Interval for automatic invoice generation."
msgstr ""
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__auto_renew_rule_type
#: model:ir.model.fields,help:product_contract.field_product_product__auto_renew_rule_type
#: model:ir.model.fields,help:product_contract.field_product_template__auto_renew_rule_type
#: model:ir.model.fields,help:product_contract.field_sale_order_line__auto_renew_rule_type
@@ -265,12 +468,31 @@ msgid "Specify Interval for automatic renewal."
msgstr ""
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__recurring_invoicing_type
#: model:ir.model.fields,help:product_contract.field_product_product__recurring_invoicing_type
#: model:ir.model.fields,help:product_contract.field_product_template__recurring_invoicing_type
#: model:ir.model.fields,help:product_contract.field_sale_order_line__recurring_invoicing_type
msgid "Specify if process date is 'from' or 'to' invoicing date"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_contract_configurator__contract_start_date_method
#: model:ir.model.fields,field_description:product_contract.field_product_product__contract_start_date_method
#: model:ir.model.fields,field_description:product_contract.field_product_template__contract_start_date_method
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line__contract_start_date_method
msgid "Start Date Method"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__start_this
msgid "Start of current period"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__contract_start_date_method__start_next
msgid "Start of next period"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,field_description:product_contract.field_product_product__termination_notice_interval
#: model:ir.model.fields,field_description:product_contract.field_product_template__termination_notice_interval
@@ -284,19 +506,51 @@ msgid "Termination Notice type"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_quarterly__3
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__force_month_semesterly__3
msgid "Third month"
msgstr ""
#. module: product_contract
#: model:ir.model.fields,help:product_contract.field_product_contract_configurator__contract_start_date_method
#: model:ir.model.fields,help:product_contract.field_product_product__contract_start_date_method
#: model:ir.model.fields,help:product_contract.field_product_template__contract_start_date_method
#: model:ir.model.fields,help:product_contract.field_sale_order_line__contract_start_date_method
msgid ""
"This field allows to define how the start date of the contract will\n"
" be calculated:\n"
"\n"
" - Manual: The start date will be selected by the user, by default will be the\n"
" date of sale confirmation.\n"
" - Start of current period: The start date will be the first day of the actual\n"
" period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be 2024/01/01.\n"
" - End of current period: The start date will be the last day of the actual\n"
" period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be 2024/12/31.\n"
" - Start of next period: The start date will be the first day of the next\n"
" period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be 2025/01/01.\n"
" - End of next period: The start date will be the last day of the actual\n"
" period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27\n"
" and the period selected is 'Year(s)' the start date will be 2025/12/31.\n"
" "
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__termination_notice_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__weekly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__weekly
msgid "Week(s)"
msgstr ""
#. module: product_contract
#: model:ir.model.fields.selection,name:product_contract.selection__product_contract_configurator__auto_renew_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__auto_renew_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__product_template__recurring_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__auto_renew_rule_type__yearly
#: model:ir.model.fields.selection,name:product_contract.selection__sale_order_line__recurring_rule_type__yearly
msgid "Year(s)"
msgstr ""
@@ -316,3 +570,15 @@ msgid ""
"You must specify a contract template for '%(product_name)s' product in "
"'%(company_name)s' company."
msgstr ""
#. module: product_contract
#. odoo-python
#: code:addons/product_contract/models/sale_order_line.py:0
#, python-format
msgid ""
"{product}\n"
" - Recurrency: {recurring_rule}\n"
" - Invoicing Type: {invoicing_type}\n"
" - Date: {date_text}\n"
" "
msgstr ""

View File

@@ -61,6 +61,73 @@ class ProductTemplate(models.Model):
string="Renewal type",
help="Specify Interval for automatic renewal.",
)
contract_start_date_method = fields.Selection(
[
("manual", "Manual"),
("start_this", "Start of current period"),
("end_this", "End of current period"),
("start_next", "Start of next period"),
("end_next", "End of next period"),
],
"Start Date Method",
default="manual",
help="""This field allows to define how the start date of the contract will
be calculated:
- Manual: The start date will be selected by the user, by default will be the
date of sale confirmation.
- Start of current period: The start date will be the first day of the actual
period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27
and the period selected is 'Year(s)' the start date will be 2024/01/01.
- End of current period: The start date will be the last day of the actual
period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27
and the period selected is 'Year(s)' the start date will be 2024/12/31.
- Start of next period: The start date will be the first day of the next
period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27
and the period selected is 'Year(s)' the start date will be 2025/01/01.
- End of next period: The start date will be the last day of the actual
period selected on 'Invoicing Every' field. Example: If we are on 2024/08/27
and the period selected is 'Year(s)' the start date will be 2025/12/31.
""",
)
force_month_yearly = fields.Selection(
[
("1", "January"),
("2", "February"),
("3", "March"),
("4", "April"),
("5", "May"),
("6", "June"),
("7", "July"),
("8", "August"),
("9", "September"),
("10", "October"),
("11", "November"),
("12", "December"),
],
"Force Month",
)
force_month_quarterly = fields.Selection(
[
("1", "First month"),
("2", "Second month"),
("3", "Third month"),
],
"Force Month",
help="Force the month to be used inside the quarter",
)
force_month_semesterly = fields.Selection(
[
("1", "First month"),
("2", "Second month"),
("3", "Third month"),
("4", "Fourth month"),
("5", "Fifth month"),
("6", "Sixth month"),
],
"Force Month",
help="Force the month to be used inside the semester",
)
def write(self, vals):
if "is_contract" in vals and vals["is_contract"] is False:

View File

@@ -67,6 +67,7 @@ class SaleOrder(models.Model):
line_to_create_contract = rec.order_line.filtered(
lambda r: not r.contract_id and r.product_id.is_contract
)
line_to_create_contract._set_contract_line_start_date()
line_to_update_contract = rec.order_line.filtered(
lambda r: r.contract_id
and r.product_id.is_contract

View File

@@ -7,6 +7,13 @@ from dateutil.relativedelta import relativedelta
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
MONTH_NB_MAPPING = {
"monthly": 1,
"quarterly": 3,
"semesterly": 6,
"yearly": 12,
}
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
@@ -22,26 +29,9 @@ class SaleOrderLine(models.Model):
string="Contract Template",
compute="_compute_contract_template_id",
)
recurring_rule_type = fields.Selection(
[
("daily", "Day(s)"),
("weekly", "Week(s)"),
("monthly", "Month(s)"),
("monthlylastday", "Month(s) last day"),
("quarterly", "Quarter(s)"),
("semesterly", "Semester(s)"),
("yearly", "Year(s)"),
],
default="monthly",
string="Invoice Every",
copy=False,
)
recurring_rule_type = fields.Selection(related="product_id.recurring_rule_type")
recurring_invoicing_type = fields.Selection(
[("pre-paid", "Pre-paid"), ("post-paid", "Post-paid")],
default="pre-paid",
string="Invoicing type",
help="Specify if process date is 'from' or 'to' invoicing date",
copy=False,
related="product_id.recurring_invoicing_type"
)
date_start = fields.Date()
date_end = fields.Date()
@@ -81,6 +71,9 @@ class SaleOrderLine(models.Model):
string="Renewal type",
help="Specify Interval for automatic renewal.",
)
contract_start_date_method = fields.Selection(
related="product_id.contract_start_date_method"
)
@api.constrains("contract_id")
def _check_contact_is_not_terminated(self):
@@ -109,15 +102,18 @@ class SaleOrderLine(models.Model):
def _get_date_end(self):
self.ensure_one()
contract_line_model = self.env["contract.line"]
date_end = (
self.date_start
+ contract_line_model.get_relative_delta(
self._get_auto_renew_rule_type(),
int(self.product_uom_qty),
contract_start_date_method = self.product_id.contract_start_date_method
date_end = False
if contract_start_date_method == "manual":
contract_line_model = self.env["contract.line"]
date_end = (
self.date_start
+ contract_line_model.get_relative_delta(
self._get_auto_renew_rule_type(),
int(self.product_uom_qty),
)
- relativedelta(days=1)
)
- relativedelta(days=1)
)
return date_end
@api.depends("product_id")
@@ -125,17 +121,16 @@ class SaleOrderLine(models.Model):
for rec in self:
if rec.product_id.is_contract:
rec.product_uom_qty = rec.product_id.default_qty
rec.recurring_rule_type = rec.product_id.recurring_rule_type
rec.recurring_invoicing_type = rec.product_id.recurring_invoicing_type
rec.date_start = rec.date_start or fields.Date.today()
contract_start_date_method = rec.product_id.contract_start_date_method
if contract_start_date_method == "manual":
rec.date_start = rec.date_start or fields.Date.today()
rec.date_end = rec._get_date_end()
rec.is_auto_renew = rec.product_id.is_auto_renew
if rec.is_auto_renew:
rec.auto_renew_interval = rec.product_id.auto_renew_interval
rec.auto_renew_rule_type = rec.product_id.auto_renew_rule_type
@api.onchange("date_start", "product_uom_qty", "recurring_rule_type")
@api.onchange("date_start", "product_uom_qty")
def onchange_date_start(self):
for rec in self.filtered("product_id.is_contract"):
rec.date_end = rec._get_date_end() if rec.date_start else False
@@ -171,7 +166,7 @@ class SaleOrderLine(models.Model):
return {
"sequence": self.sequence,
"product_id": self.product_id.id,
"name": self.name,
"name": self.name.split(":\n")[0],
"quantity": self._get_contract_line_qty(),
"uom_id": self.product_uom.id,
"price_unit": self.price_unit,
@@ -269,3 +264,107 @@ class SaleOrderLine(models.Model):
res = super()._compute_qty_to_invoice()
self.filtered("product_id.is_contract").update({"qty_to_invoice": 0.0})
return res
def _set_contract_line_start_date(self):
"""Set date start of lines using it's method and the confirmation date."""
for line in self:
if (
line.contract_start_date_method == "manual"
or line.recurring_rule_type in ["daily", "weekly", "monthlylastday"]
):
continue
is_end = "end_" in line.contract_start_date_method
today = fields.Date.today()
month_period = month = today.month
month_nb = MONTH_NB_MAPPING[line.recurring_rule_type]
# The period number is started by 0 to be able to calculate the month
period_number = (month - 1) // month_nb
if line.recurring_rule_type == "yearly":
month_period = 1
elif line.recurring_rule_type != "monthly":
# Checking quarterly and semesterly
month_period = period_number * month_nb + 1
forced_month = 0
if line.recurring_rule_type != "monthly":
forced_value = int(
line.product_id["force_month_%s" % line.recurring_rule_type]
)
if forced_value:
# When the selected period is yearly, the period_number field is
# 0, so forced_month will take the value of the forced month set
# on product.
forced_month = month_nb * period_number + forced_value
# If forced_month is set, use it, but if it isn't use the month_period
start_date = today + relativedelta(
day=1, month=forced_month or month_period
)
if is_end:
increment = month_nb - 1 if not forced_month else 0
start_date = start_date + relativedelta(months=increment, day=31)
if "_next" in line.contract_start_date_method and start_date <= today:
start_date = start_date + relativedelta(months=month_nb)
if is_end:
start_date = start_date + relativedelta(day=31)
line.date_start = start_date
@api.depends("product_id")
def _compute_name(self):
res = super()._compute_name()
for line in self:
if line.is_contract:
date_text = ""
if line.contract_start_date_method == "manual":
date_text = "%s" % line.date_start
if line.date_end:
date_text += " -> %s" % line.date_end
else:
field_info = dict(
line._fields["contract_start_date_method"].get_description(
self.env
)
)
field_selection = dict(field_info.get("selection"))
start_method_label = field_selection.get(
line.contract_start_date_method
)
date_text = "%s" % start_method_label
if (
line.recurring_rule_type != "monthly"
and line.product_id["force_month_%s" % line.recurring_rule_type]
):
field_info = dict(
self.env["product.template"]
._fields["force_month_%s" % line.recurring_rule_type]
.get_description(self.env)
)
field_selection = dict(field_info.get("selection"))
force_month_label = field_selection.get(
line.product_id["force_month_%s" % line.recurring_rule_type]
)
date_text += " (%s)" % force_month_label
field_info = dict(
self._fields["recurring_rule_type"].get_description(self.env)
)
field_selection = dict(field_info.get("selection"))
recurring_rule_label = field_selection.get(line.recurring_rule_type)
field_info = dict(
self._fields["recurring_invoicing_type"].get_description(self.env)
)
field_selection = dict(field_info.get("selection"))
invoicing_type_label = field_selection.get(
line.recurring_invoicing_type
)
line.name = _(
"""{product}:
- Recurrency: {recurring_rule}
- Invoicing Type: {invoicing_type}
- Date: {date_text}
"""
).format(
product=line.product_id.display_name,
recurring_rule=recurring_rule_label,
invoicing_type=invoicing_type_label,
date_text=date_text,
)
return res

View File

@@ -3,4 +3,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Ernesto Tejeda
- Pedro M. Baeza
- Carlos Roca
- David Jaen \<<david.jaen.revert@gmail.com>\>

View File

@@ -0,0 +1,2 @@
- There's no support right now for computing the start date for the
following recurrent types: daily, weekly and monthlylastday.

View File

@@ -380,11 +380,12 @@ invoice directly.</p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
@@ -399,8 +400,15 @@ product</li>
<li>Define default recurrence rules</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Theres no support right now for computing the start date for the
following recurrent types: daily, weekly and monthlylastday.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
@@ -408,29 +416,30 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>LasLabs</li>
<li>ACSONE SA/NV</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li>Ted Salmon &lt;<a class="reference external" href="mailto:tsalmon&#64;laslabs.com">tsalmon&#64;laslabs.com</a>&gt;</li>
<li>Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Ernesto Tejeda</li>
<li>Pedro M. Baeza</li>
<li>Carlos Roca</li>
</ul>
</li>
<li>David Jaen &lt;<a class="reference external" href="mailto:david.jaen.revert&#64;gmail.com">david.jaen.revert&#64;gmail.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />

View File

@@ -15,8 +15,6 @@ export class ProductContractConfiguratorController extends formView.Controller {
const {
product_uom_qty,
contract_id,
recurring_rule_type,
recurring_invoicing_type,
date_start,
date_end,
contract_line_id,
@@ -30,8 +28,6 @@ export class ProductContractConfiguratorController extends formView.Controller {
productContractConfiguration: {
product_uom_qty,
contract_id,
recurring_rule_type,
recurring_invoicing_type,
date_start,
date_end,
contract_line_id,

View File

@@ -29,9 +29,6 @@ patch(SaleOrderLineProductField.prototype, {
default_company_id: this.props.record.model.root.data.company_id[0],
default_product_uom_qty: this.props.record.data.product_uom_qty,
default_contract_id: this.props.record.data.contract_id[0],
default_recurring_rule_type: this.props.record.data.recurring_rule_type,
default_recurring_invoicing_type:
this.props.record.data.recurring_invoicing_type,
default_date_start: this.props.record.data.date_start,
default_date_end: this.props.record.data.date_end,
default_is_auto_renew: this.props.record.data.is_auto_renew,

View File

@@ -3,7 +3,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from dateutil.relativedelta import relativedelta
from freezegun import freeze_time
from odoo import fields
from odoo.exceptions import UserError, ValidationError
from odoo.fields import Date
from odoo.tests.common import TransactionCase
@@ -20,6 +22,7 @@ class TestSaleOrder(TransactionCase):
no_reset_password=True,
)
)
cls.partner = cls.env["res.partner"].create({"name": "Test partner"})
cls.product1 = cls.env.ref("product.product_product_1")
cls.product2 = cls.env.ref("product.product_product_2")
cls.sale = cls.env.ref("sale.sale_order_2")
@@ -370,3 +373,249 @@ class TestSaleOrder(TransactionCase):
.mapped("contract_id")
)
self.assertEqual(len(contracts), 1)
def _create_contract_product(
self, recurring_rule_type, contract_start_date_method, force_month=False
):
product = self.env["product.product"].create(
{
"name": "Contract Test",
"type": "service",
"is_contract": True,
"recurring_rule_type": recurring_rule_type,
"contract_start_date_method": contract_start_date_method,
"property_contract_template_id": self.contract_template1,
}
)
if recurring_rule_type != "monthly":
product["force_month_%s" % recurring_rule_type] = force_month
return product
def _create_and_confirm_sale(self, product):
sale = self.env["sale.order"].create(
{
"partner_id": self.partner.id,
"order_line": [
(
0,
0,
{
"product_id": product.id,
},
),
],
}
)
sale.action_confirm()
return sale
@freeze_time("2024-08-15")
def test_order_line_date_start_confirm(self):
# This start no force date
contract_month = self._create_contract_product("monthly", "start_this")
sale = self._create_and_confirm_sale(contract_month)
# The start date of the contract should be 2024-08-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-08-01"),
)
contract_quarter = self._create_contract_product("quarterly", "start_this")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-07-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-07-01"),
)
contract_semester = self._create_contract_product("semesterly", "start_this")
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2024-07-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-07-01"),
)
contract_year = self._create_contract_product("yearly", "start_this")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2024-01-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-01-01"),
)
# This end no force date
contract_month = self._create_contract_product("monthly", "end_this")
sale = self._create_and_confirm_sale(contract_month)
# The start date of the contract should be 2024-08-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-08-31"),
)
contract_quarter = self._create_contract_product("quarterly", "end_this")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-09-30
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-09-30"),
)
contract_semester = self._create_contract_product("semesterly", "end_this")
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2024-12-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-12-31"),
)
contract_year = self._create_contract_product("yearly", "end_this")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2024-12-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-12-31"),
)
# Next start no force date
contract_month = self._create_contract_product("monthly", "start_next")
sale = self._create_and_confirm_sale(contract_month)
# The start date of the contract should be 2024-09-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-09-01"),
)
contract_quarter = self._create_contract_product("quarterly", "start_next")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-10-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-10-01"),
)
contract_semester = self._create_contract_product("semesterly", "start_next")
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2025-01-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2025-01-01"),
)
contract_year = self._create_contract_product("yearly", "start_next")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2025-01-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2025-01-01"),
)
# Next end no force date
contract_month = self._create_contract_product("monthly", "end_next")
sale = self._create_and_confirm_sale(contract_month)
# The start date of the contract should be 2024-08-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-08-31"),
)
contract_quarter = self._create_contract_product("quarterly", "end_next")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-09-30
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-09-30"),
)
contract_semester = self._create_contract_product("semesterly", "end_next")
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2024-12-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-12-31"),
)
contract_year = self._create_contract_product("yearly", "end_next")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2024-12-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-12-31"),
)
# This start force month
contract_quarter = self._create_contract_product("quarterly", "start_this", "2")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-08-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-08-01"),
)
contract_semester = self._create_contract_product(
"semesterly", "start_this", "4"
)
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2024-10-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-10-01"),
)
contract_year = self._create_contract_product("yearly", "start_this", "2")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2024-02-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-02-01"),
)
# This end force month
contract_quarter = self._create_contract_product("quarterly", "end_this", "2")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-08-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-08-31"),
)
contract_semester = self._create_contract_product("semesterly", "end_this", "4")
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2024-10-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-10-31"),
)
contract_year = self._create_contract_product("yearly", "end_this", "2")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2024-02-29
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-02-29"),
)
# Next start force month
contract_quarter = self._create_contract_product("quarterly", "start_next", "2")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-11-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-11-01"),
)
contract_semester = self._create_contract_product(
"semesterly", "start_next", "4"
)
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2024-10-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-10-01"),
)
contract_year = self._create_contract_product("yearly", "start_next", "2")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2025-02-01
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2025-02-01"),
)
# Next end force month
contract_quarter = self._create_contract_product("quarterly", "end_next", "2")
sale = self._create_and_confirm_sale(contract_quarter)
# The start date of the contract should be 2024-08-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-08-31"),
)
contract_semester = self._create_contract_product("semesterly", "end_next", "4")
sale = self._create_and_confirm_sale(contract_semester)
# The start date of the contract should be 2024-10-31
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2024-10-31"),
)
contract_year = self._create_contract_product("yearly", "end_next", "2")
sale = self._create_and_confirm_sale(contract_year)
# The start date of the contract should be 2025-02-28
self.assertEqual(
sale.order_line.contract_id.contract_line_ids.date_start,
fields.Date.to_date("2025-02-28"),
)

View File

@@ -36,6 +36,19 @@
</group>
<group>
<field name="is_auto_renew" />
<field name="contract_start_date_method" required="True" />
<field
name="force_month_yearly"
invisible="contract_start_date_method == 'manual' or recurring_rule_type != 'yearly'"
/>
<field
name="force_month_quarterly"
invisible="contract_start_date_method == 'manual' or recurring_rule_type != 'quarterly'"
/>
<field
name="force_month_semesterly"
invisible="contract_start_date_method == 'manual' or recurring_rule_type != 'semesterly'"
/>
</group>
<group>
<group invisible="is_auto_renew == False">

View File

@@ -71,7 +71,7 @@
<field name="date_start" required="is_contract" />
</group>
<group invisible="not is_contract">
<field name="date_end" required="is_contract" />
<field name="date_end" />
</group>
<group invisible="not is_contract">
<field name="is_auto_renew" />
@@ -114,8 +114,13 @@
/>
<field name="recurring_rule_type" optional="hide" />
<field name="recurring_invoicing_type" optional="hide" />
<field name="date_start" optional="hide" required="is_contract" />
<field name="date_end" required="is_contract" optional="hide" />
<field name="contract_start_date_method" column_invisible="1" />
<field
name="date_start"
optional="hide"
required="is_contract and contract_start_date_method == 'manual'"
/>
<field name="date_end" optional="hide" />
<field name="is_auto_renew" optional="hide" />
<field
name="auto_renew_interval"
@@ -131,7 +136,6 @@
required="is_auto_renew"
optional="hide"
/>
<field name="date_end" column_invisible="parent.is_contract == False" />
</xpath>
</field>
</record>

View File

@@ -20,24 +20,9 @@ class ProductContractConfigurator(models.TransientModel):
string="Contract Template",
compute="_compute_contract_template_id",
)
recurring_rule_type = fields.Selection(
[
("daily", "Day(s)"),
("weekly", "Week(s)"),
("monthly", "Month(s)"),
("monthlylastday", "Month(s) last day"),
("quarterly", "Quarter(s)"),
("semesterly", "Semester(s)"),
("yearly", "Year(s)"),
],
default="monthly",
string="Invoice Every",
)
recurring_rule_type = fields.Selection(related="product_id.recurring_rule_type")
recurring_invoicing_type = fields.Selection(
[("pre-paid", "Pre-paid"), ("post-paid", "Post-paid")],
default="pre-paid",
string="Invoicing type",
help="Specify if process date is 'from' or 'to' invoicing date",
related="product_id.recurring_invoicing_type"
)
date_start = fields.Date()
date_end = fields.Date()
@@ -75,6 +60,9 @@ class ProductContractConfigurator(models.TransientModel):
string="Renewal type",
help="Specify Interval for automatic renewal.",
)
contract_start_date_method = fields.Selection(
related="product_id.contract_start_date_method"
)
@api.depends("product_id", "company_id")
def _compute_contract_template_id(self):
@@ -88,10 +76,9 @@ class ProductContractConfigurator(models.TransientModel):
for rec in self:
if rec.product_id.is_contract:
rec.product_uom_qty = rec.product_id.default_qty
rec.recurring_rule_type = rec.product_id.recurring_rule_type
rec.recurring_invoicing_type = rec.product_id.recurring_invoicing_type
rec.date_start = rec.date_start or fields.Date.today()
contract_start_date_method = rec.product_id.contract_start_date_method
if contract_start_date_method == "manual":
rec.date_start = rec.date_start or fields.Date.today()
rec.date_end = rec._get_date_end()
rec.is_auto_renew = rec.product_id.is_auto_renew
if rec.is_auto_renew:
@@ -118,7 +105,7 @@ class ProductContractConfigurator(models.TransientModel):
)
return date_end
@api.onchange("date_start", "product_uom_qty", "recurring_rule_type")
@api.onchange("date_start", "product_uom_qty")
def _onchange_date_start(self):
for rec in self.filtered("product_id.is_contract"):
rec.date_end = rec._get_date_end() if rec.date_start else False

View File

@@ -14,17 +14,27 @@
<separator colspan="4" string="Recurrence Invoicing" />
<group>
<field name="recurring_rule_type" />
<field name="date_start" required="1" />
<field name="is_auto_renew" />
<field name="contract_start_date_method" />
<field
name="date_start"
required="contract_start_date_method == 'manual'"
invisible="contract_start_date_method != 'manual'"
/>
<field name="is_auto_renew" invisible="not date_end" />
</group>
<group>
<field name="recurring_invoicing_type" />
<field name="date_end" required="1" />
<field
name="date_end"
invisible="contract_start_date_method != 'manual'"
/>
<label
for="auto_renew_interval"
invisible="not is_auto_renew"
invisible="not is_auto_renew or contract_start_date_method != 'manual'"
/>
<div invisible="not is_auto_renew">
<div
invisible="not is_auto_renew or contract_start_date_method != 'manual'"
>
<field
name="auto_renew_interval"
class="oe_inline"