diff --git a/purchase_requisition_proposal/__manifest__.py b/purchase_requisition_proposal/__manifest__.py index d737c00a2..60f74b3a1 100644 --- a/purchase_requisition_proposal/__manifest__.py +++ b/purchase_requisition_proposal/__manifest__.py @@ -23,7 +23,6 @@ "views/purchase_order.xml", "views/sale_order.xml", "views/purchase_requisition.xml", - "views/purchase_requisition_proposal.xml", "views/purchase_requisition_type.xml", "wizard/wizard_requisition_proposal.xml", "views/ir_config.xml", diff --git a/purchase_requisition_proposal/data/data.xml b/purchase_requisition_proposal/data/data.xml index d4ac48d5b..f4b5395fc 100644 --- a/purchase_requisition_proposal/data/data.xml +++ b/purchase_requisition_proposal/data/data.xml @@ -27,9 +27,84 @@ Requistion Call: Send by email + ${object.company_id.name} Call for Proposals (Ref ${object.name or 'n/a' }) + ${','.join([str(partner.id) for partner in object.company_to_call_ids.partner_id]} + +
+

+ Dear collaborator,

+ ${object.company_id.name} have a new Call for Proposals: ${object.name}.
+ The Agreement Deadline is ${format_date(object.date_end)}. +

+ Do not hesitate to contact us if you have any questions. +

+

+ + + + + + + + + +
ProductsQuantityPriceSchedule Date
+ + + % for line in object.line_ids: + + + + + + + % endfor + +
${line.product_id.display_name}${line.product_qty} ${line.product_uom_id.name} + ${line.price_unit} + ${format_date(line.schedule_date)}
+

+ Best regards, + % if user.signature: +
+ ${user.signature | safe} + % endif +
+

+
+
+ ${(object.name or '').replace('/','-')} + ${object.company_id.lang} + +
+ + + Requistion Call: Send Result by email + ${object.company_id.name} Call for Proposals (Ref ${object.name or 'n/a' }) + >${object.company_id.name} Closed Call for Proposals (Ref ${object.name or 'n/a' }) ${','.join([str(partner.id) for partner in object.company_to_call_ids.partner_id]} @@ -37,60 +112,64 @@

Dear collaborator,

- ${object.company_id.name} have a new Call for Proposals: ${object.name}.
- The Agreement Deadline is ${format_date(object.date_end)}. -

- Do not hesitate to contact us if you have any questions. + The Call ${object.name} from ${object.company_id.name} is now closed.
+ Please find the selected proposals below:

+ % for line in object.line_ids: +

${line.product_id.display_name}

+
    +
  • Schedule Date: ${format_date(line.schedule_date)}
  • +
  • Quantity: ${line.product_qty} ${line.product_uom_id.name}
  • +
  • Unit Price: ${line.price_unit}
  • +
+ + % for prop in line.proposal_line_ids: - - + + - + >Planned Quantity +
ProductsSchedule DateProposalCompany QuantityPricePlanned Date
- % for line in object.line_ids: - + % if prop.qty_planned: +
- - + + + >${prop.partner_id.name} - +
${line.product_id.display_name}
${prop.name} ${format_date(line.schedule_date)} ${line.product_qty} ${line.product_uom_id.name} - ${line.price_unit} + >${prop.qty_planned} ${prop.product_uom_id.name} + ${prop.date_planned}
+
+ % endif + % endfor % endfor

+ Thank you for your participation. +
Best regards, % if user.signature:
@@ -104,4 +183,5 @@ ${object.company_id.lang} + diff --git a/purchase_requisition_proposal/i18n/fr.po b/purchase_requisition_proposal/i18n/fr.po index c705ec78c..5d7faa528 100644 --- a/purchase_requisition_proposal/i18n/fr.po +++ b/purchase_requisition_proposal/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-16 22:50+0000\n" -"PO-Revision-Date: 2023-01-16 23:55+0100\n" +"POT-Creation-Date: 2023-02-24 14:52+0000\n" +"PO-Revision-Date: 2023-02-24 15:54+0100\n" "Last-Translator: \n" "Language-Team: \n" "Language: fr\n" @@ -19,6 +19,7 @@ msgstr "" #. module: purchase_requisition_proposal #: model:mail.template,report_name:purchase_requisition_proposal.mail_template_requisition_proposal +#: model:mail.template,report_name:purchase_requisition_proposal.mail_template_result_proposal msgid "${(object.name or '').replace('/','-')}" msgstr "" @@ -28,43 +29,60 @@ msgid "${object.company_id.name} Call for Proposals (Ref ${object.name or 'n/a' msgstr "${object.company_id.name} Appel d'Offres (Ref ${object.name or 'n/a' })" #. module: purchase_requisition_proposal -#: model:mail.template,body_html:purchase_requisition_proposal.mail_template_requisition_proposal +#: model:mail.template,subject:purchase_requisition_proposal.mail_template_result_proposal +msgid "${object.company_id.name} Closed Call for Proposals (Ref ${object.name or 'n/a' })" +msgstr "${object.company_id.name} Fermeture d'Appel d'Offres (Ref ${object.name or 'n/a' })" + +#. module: purchase_requisition_proposal +#: model:mail.template,body_html:purchase_requisition_proposal.mail_template_result_proposal msgid "" "\n" "
\n" "

\n" " Dear collaborator,

\n" -" ${object.company_id.name} have a new Call for Proposals: ${object.name}.
\n" -" The Agreement Deadline is ${format_date(object.date_end)}.\n" -"

\n" -" Do not hesitate to contact us if you have any questions.\n" +" The Call ${object.name} from ${object.company_id.name} is now closed.
\n" +" Please find the selected proposals below:\n" "

\n" "

\n" -" \n" +" % for line in object.line_ids:\n" +"

${line.product_id.display_name}

\n" +"
    \n" +"
  • Schedule Date: ${format_date(line.schedule_date)}
  • \n" +"
  • Quantity: ${line.product_qty} ${line.product_uom_id.name}
  • \n" +"
  • Unit Price: ${line.price_unit}
  • \n" +"
\n" +"\n" +" % for prop in line.proposal_line_ids:\n" +"
\n" " \n" " \n" -" \n" -" \n" -" \n" -" \n" +" \n" +" \n" +" \n" +" \n" " \n" " \n" "
ProductsSchedule DateQuantityPriceProposalCompanyPlanned QuantityPlanned Date
\n" -" % for line in object.line_ids:\n" -" \n" +" % if prop.qty_planned:\n" +"
\n" " \n" -" \n" -" \n" -" \n" -" \n" -" \n" +" \n" +" \n" +" \n" +" \n" " \n" " \n" "
${line.product_id.display_name}${format_date(line.schedule_date)} ${line.product_qty} ${line.product_uom_id.name}\n" -" ${line.price_unit}\n" +"
${prop.name}${prop.partner_id.name} ${prop.qty_planned} ${prop.product_uom_id.name}\n" +" ${prop.date_planned}\n" "
\n" +"
\n" +" % endif\n" +" % endfor\n" " % endfor\n" "

\n" +" Thank you for your participation.\n" +"
\n" " Best regards,\n" " % if user.signature:\n" "
\n" @@ -78,62 +96,158 @@ msgstr "" "\n" "
\n" "

\n" -" Cher collaborateur,

\n" -" {object.company_id.name} $ a un nouvel appel d'offres : ${object.name}.
\n" -" La date limite de réponse est ${format_date(object.date_end)}.\n" +" Chers collaborateurs,

\n" +" L'appel d'offres ${object.name} de ${object.company_id.name} est maintenant fermé.
\n" +" Veuillez trouver ci-dessous les propositions retenus:\n" +"

\n" +"

\n" +" % for line in object.line_ids:\n" +"

${line.product_id.display_name}

\n" +"
    \n" +"
  • Date attendue: ${format_date(line.schedule_date)}
  • \n" +"
  • Quantité: ${line.product_qty} ${line.product_uom_id.name}
  • \n" +"
  • Prix Unitaire: ${line.price_unit}
  • \n" +"
\n" +"\n" +" % for prop in line.proposal_line_ids:\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
PropositionSociétéQuantitéDate
\n" +" % if prop.qty_planned:\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
${prop.name}${prop.partner_id.name} ${prop.qty_planned} ${prop.product_uom_id.name}\n" +" ${prop.date_planned}\n" +"
\n" +"
\n" +" % endif\n" +" % endfor\n" +" % endfor\n" +"

\n" +" Merci de votre participation.\n" +"
\n" +" Cordialement,\n" +" % if user.signature:\n" +"
\n" +" ${user.signature | safe}\n" +" % endif\n" +"
\n" +"

\n" +"
\n" +" " + +#. module: purchase_requisition_proposal +#: model:mail.template,body_html:purchase_requisition_proposal.mail_template_requisition_proposal +msgid "" +"\n" +"
\n" +"

\n" +" Dear collaborator,

\n" +" ${object.company_id.name} have a new Call for Proposals: ${object.name}.
\n" +" The Agreement Deadline is ${format_date(object.date_end)}.\n" +"

\n" +" Do not hesitate to contact us if you have any questions.\n" +"

\n" +"

\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
ProductsQuantityPriceSchedule Date
\n" +" \n" +" \n" +" % for line in object.line_ids:\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" % endfor\n" +" \n" +"
${line.product_id.display_name}${line.product_qty} ${line.product_uom_id.name}\n" +" ${line.price_unit}\n" +" ${format_date(line.schedule_date)}
\n" +"

\n" +" Best regards,\n" +" % if user.signature:\n" +"
\n" +" ${user.signature | safe}\n" +" % endif\n" +"
\n" +"

\n" +"
\n" +" " +msgstr "" +"\n" +"
\n" +"

\n" +" Cher collaborateur,

\n" +" ${object.company_id.name} a un nouvel appel d'offres: ${object.name}.
\n" +" La date limite de réponse est ${format_date(object.date_end)}.\n" "

\n" -" N'hésitez pas à nous contacter si vous avez des questions.\n" +" N'hésitez pas à nous contacter si vous avez des questions.\n" "

\n" -"

\n" -" \n" -" \n" -" \n" -" \n" -" \n" +"
\n" +"
ProduitsDate de Livraison Attendue
\n" +" \n" +" \n" +" \n" " \n" -" \n" +" \n" +" \n" " \n" " \n" "
ArticleQuantitéPrixPrixDate de Livraison Attendue
\n" -" % for line in object.line_ids :\n" -" \n" -" \n" -" \n" -"
$
\n" -"
${line.product_id." -"display_name}\n" -" ${format_date(line.schedule_date)} ${line.product_qty} $
\n" +"
{line.product_uom_id.name}\n" -" \n" -" ${line.price_unit}\n" -"
\n" +" \n" +" % for line in object.line_ids:\n" +" \n" +" \n" +" \n" +" \n" +" \n" " \n" +" % endfor\n" " \n" -" % endfor\n" "
${line.product_id.display_name}${line.product_qty} ${line.product_uom_id.name}\n" +" ${line.price_unit}\n" +" ${format_date(line.schedule_date)}
\n" "

\n" -" Cordialement\n" -" % if user.signature :\n" +" Cordialement,\n" +" % if user.signature:\n" "
\n" -" ${user.signature | safe}\n" +" ${user.signature | safe}\n" " % endif\n" "
\n" -"

\n" -"
\n" -" " +"

\n" +"
\n" +" " #. module: purchase_requisition_proposal #: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.view_purchase_requisition_no_edit_form msgid "Accept" msgstr "Accepter" -#. module: purchase_requisition_proposal -#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.view_purchase_requisition_no_edit_form -msgid "Accept and Modify" -msgstr "Accepter et Modifier" - #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition__exclusive #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_type__exclusive @@ -145,6 +259,12 @@ msgstr "Type de sélection du contrat" msgid "All Companies" msgstr "Toutes les sociétés" +#. module: purchase_requisition_proposal +#: code:addons/purchase_requisition_proposal/models/purchase_requisition.py:0 +#, python-format +msgid "All the propositions selected are already related to a purchase request." +msgstr "Toutes les propositions sont déjà reliées à une commande d'achat." + #. module: purchase_requisition_proposal #: model:ir.model.fields.selection,name:purchase_requisition_proposal.selection__purchase_requisition_type__exclusive__proposals msgid "Call for Proposals (non-exclusive)" @@ -155,6 +275,11 @@ msgstr "Appel d'Offres multi-sociétés" msgid "Category" msgstr "" +#. module: purchase_requisition_proposal +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_type__proposal_result_template_id +msgid "Closure Email Template" +msgstr "Email de clôture" + #. module: purchase_requisition_proposal #: model:ir.model,name:purchase_requisition_proposal.model_res_company msgid "Companies" @@ -171,7 +296,7 @@ msgstr "Sociétés Appelées" #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__requisition_company_id #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_type__company_id msgid "Company" -msgstr "Société" +msgstr "Société émettrice" #. module: purchase_requisition_proposal #: model:ir.model,name:purchase_requisition_proposal.model_res_config_settings @@ -181,7 +306,7 @@ msgstr "Paramètres de config" #. module: purchase_requisition_proposal #: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.requisition_proposal_wizard msgid "Confirm" -msgstr "" +msgstr "Confirmer" #. module: purchase_requisition_proposal #: model:ir.model.fields,help:purchase_requisition_proposal.field_purchase_requisition_proposal__product_uom_category_id @@ -215,17 +340,17 @@ msgstr "Vérif. date" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition__date_end msgid "Date End" -msgstr "Date Limite de Réponse" +msgstr "" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition__schedule_date msgid "Delivery Date" -msgstr "Date de livraison Attendue" +msgstr "Date de livraison" #. module: purchase_requisition_proposal #: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.requisition_proposal_wizard msgid "Discard" -msgstr "" +msgstr "Annuler" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_order__display_name @@ -241,10 +366,9 @@ msgstr "" #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_sale_order__display_name #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_sale_order_line__display_name msgid "Display Name" -msgstr "Nom" +msgstr "Nom affiché" #. module: purchase_requisition_proposal -#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.received_requisition_proposal_line_view_tree #: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.requisition_proposal_buttons_wizard msgid "Duplicate" msgstr "Dupliquer" @@ -282,11 +406,6 @@ msgstr "" msgid "Intercompany Call for Proposals" msgstr "Appel d'offre multi-sociétés" -#. module: purchase_requisition_proposal -#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_line__is_proposal_line_validate -msgid "Is Line Validate" -msgstr "" - #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_order____last_update #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_order_line____last_update @@ -315,12 +434,18 @@ msgstr "" msgid "Last Updated on" msgstr "" +#. module: purchase_requisition_proposal +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition__missing_procurment_contacts +msgid "Missing Procurment Contacts" +msgstr "" + #. module: purchase_requisition_proposal #: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.view_purchase_requisition_type_form_inherit msgid "Multi Companies" msgstr "Multi-sociétés" #. module: purchase_requisition_proposal +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition__multi_company_selection #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_type__multi_company_selection msgid "Multi Company Selection" msgstr "Sélectionner les sociétés" @@ -328,7 +453,7 @@ msgstr "Sélectionner les sociétés" #. module: purchase_requisition_proposal #: model:ir.ui.menu,name:purchase_requisition_proposal.menu_my_purchase_requisition msgid "My Requisitions" -msgstr "Mes Appels d'offre" +msgstr "Mes Appels d'offres" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__name @@ -340,6 +465,12 @@ msgstr "" msgid "No" msgstr "Non" +#. module: purchase_requisition_proposal +#: code:addons/purchase_requisition_proposal/models/purchase_requisition.py:0 +#, python-format +msgid "No contacts to send emails : %s" +msgstr "Contacts manquants pour envoyer emails : %s" + #. module: purchase_requisition_proposal #: model:ir.model.fields.selection,name:purchase_requisition_proposal.selection__purchase_requisition_information_mixin__qty_check__not_enough #: model:ir.model.fields.selection,name:purchase_requisition_proposal.selection__purchase_requisition_line__qty_check__not_enough @@ -354,6 +485,21 @@ msgstr "Non Suffisant" msgid "Not Respected" msgstr "Non Respecté" +#. module: purchase_requisition_proposal +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_line__product_description_variants +msgid "Note" +msgstr "" + +#. module: purchase_requisition_proposal +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_type__proposal_template_id +msgid "Opening Report Template" +msgstr "Template d'email de lancement" + +#. module: purchase_requisition_proposal +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition__qty_ordered +msgid "Ordered Qty" +msgstr "Qté Commandée" + #. module: purchase_requisition_proposal #: model:ir.ui.menu,name:purchase_requisition_proposal.menu_others_purchase_requisition msgid "Others Requisitions" @@ -371,14 +517,14 @@ msgstr "Date planifiée" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_line__qty_planned -#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.purchase_requisition_view_form -msgid "Planned Quantities" -msgstr "Quantités Attribuées" +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__qty_planned +msgid "Planned Qty" +msgstr "Qté plannifiée" #. module: purchase_requisition_proposal -#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__qty_planned -msgid "Planned Quantity" -msgstr "Quantité Attribuée" +#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.purchase_requisition_view_form +msgid "Planned Quantities" +msgstr "Qté Attribuée" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__product_id @@ -401,6 +547,11 @@ msgstr "Ligne Proposition" msgid "Proposal Line Count" msgstr "Nb Offres" +#. module: purchase_requisition_proposal +#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.purchase_requisition_view_form +msgid "Proposals" +msgstr "Propositions" + #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_line__date_planned #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__date_planned @@ -409,8 +560,8 @@ msgstr "Date Proposée" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__qty_proposed -msgid "Proposed Quantity" -msgstr "Quantité Proposée" +msgid "Proposed Qty" +msgstr "Qté proposée" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__purchase_id @@ -426,7 +577,7 @@ msgstr "Appel Offres" #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__requisition_line_id #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_requisition_proposal_wizard__requisition_line_id msgid "Purchase Agreement Line" -msgstr "Lignes d'Appel Offres" +msgstr "Lignes d'Appel d'Offres" #. module: purchase_requisition_proposal #: model:ir.ui.menu,name:purchase_requisition_proposal.menu_purchase_requisition_type @@ -476,6 +627,11 @@ msgstr "Type de demandes d'achat" msgid "Purchase requisitions" msgstr "Appels d'Offres" +#. module: purchase_requisition_proposal +#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition__product_qty +msgid "Qty" +msgstr "Qté" + #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_information_mixin__qty_check #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_line__qty_check @@ -484,16 +640,10 @@ msgid "Qty Check" msgstr "Vérif. Quantité" #. module: purchase_requisition_proposal -#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.received_requisition_proposal_line_view_tree #: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.requisition_proposal_buttons_wizard msgid "Remove" msgstr "Supprimer" -#. module: purchase_requisition_proposal -#: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_type__proposal_template_id -msgid "Report Template" -msgstr "Template mail Appel Offres" - #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__schedule_date msgid "Requested Date" @@ -501,8 +651,8 @@ msgstr "Date Requise" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__product_qty -msgid "Requested Quantity" -msgstr "Quantité Requise" +msgid "Requested Qty" +msgstr "Qté demandée" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_order_line__requirement_proposal_id @@ -539,14 +689,19 @@ msgstr "Respecté" #. module: purchase_requisition_proposal #: model:ir.model,name:purchase_requisition_proposal.model_sale_order -msgid "Sales Order" -msgstr "Commande" +msgid "Sale Order" +msgstr "" #. module: purchase_requisition_proposal #: model:ir.model,name:purchase_requisition_proposal.model_sale_order_line msgid "Sales Order Line" msgstr "Ligne de bon de commande" +#. module: purchase_requisition_proposal +#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.view_purchase_requisition_no_edit_form +msgid "See all proposals" +msgstr "Toutes les propositions" + #. module: purchase_requisition_proposal #: model:ir.model.fields,help:purchase_requisition_proposal.field_purchase_requisition__exclusive #: model:ir.model.fields,help:purchase_requisition_proposal.field_purchase_requisition_type__exclusive @@ -564,6 +719,22 @@ msgstr "" msgid "Selected Companies" msgstr "Sociétés Sélectionnées" +#. module: purchase_requisition_proposal +#: code:addons/purchase_requisition_proposal/models/purchase_requisition_proposal.py:0 +#, python-format +msgid "Selected Quantity can not be superior than Proposed Quantity." +msgstr "La Quantité Sélectionnée ne peut pas être supérieure à la Quantité Proposée." + +#. module: purchase_requisition_proposal +#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.purchase_requisition_view_form +msgid "Send Mails" +msgstr "Envoyer email ouverture" + +#. module: purchase_requisition_proposal +#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.purchase_requisition_view_form +msgid "Send closure email" +msgstr "Envoyer email fermeture" + #. module: purchase_requisition_proposal #: model:ir.model.fields,help:purchase_requisition_proposal.field_purchase_requisition__schedule_date #: model:ir.model.fields,help:purchase_requisition_proposal.field_purchase_requisition_proposal__schedule_date @@ -573,7 +744,7 @@ msgstr "La date de livraison prévue et planifiée où tous les produits sont re #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__price_unit msgid "Unit Price" -msgstr "" +msgstr "PU" #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_proposal__product_uom_id @@ -581,9 +752,14 @@ msgid "UoM" msgstr "" #. module: purchase_requisition_proposal -#: model_terms:ir.ui.view,arch_db:purchase_requisition_proposal.purchase_requisition_view_form -msgid "Validate and Call Companies" -msgstr "Valider et envoyer mail" +#: code:addons/purchase_requisition_proposal/models/purchase_requisition.py:0 +#, python-format +msgid "" +"You need to select at least one proposition.\n" +"To do so, select a line, click on 'Proposals' then choose a quantity to command from the available propositions." +msgstr "" +"Aucune proposition n'a été sélectionnée.\n" +"Pour cela, choisissez une ligne, cliquez sur 'Propositions' puis choisissez une quantité à commander parmis les propositions disponibles." #. module: purchase_requisition_proposal #: model:ir.model.fields,field_description:purchase_requisition_proposal.field_purchase_requisition_line__proposal_line_ids diff --git a/purchase_requisition_proposal/models/purchase_requisition.py b/purchase_requisition_proposal/models/purchase_requisition.py index 6ca4c23c5..78c1a1005 100644 --- a/purchase_requisition_proposal/models/purchase_requisition.py +++ b/purchase_requisition_proposal/models/purchase_requisition.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import _, api, fields, models -from odoo.exceptions import UserError +from odoo.exceptions import ValidationError class PurchaseRequisition(models.Model): @@ -17,6 +17,11 @@ class PurchaseRequisition(models.Model): inverse_name="requisition_id", string="Requisition proposal", ) + multi_company_selection = fields.Selection( + string="Multi Company Selection", + related="type_id.multi_company_selection", + readonly=True, + ) requisition_proposal_count = fields.Integer( compute="_compute_requisition_proposal_count" ) @@ -27,6 +32,12 @@ class PurchaseRequisition(models.Model): readonly=False, store=True, ) + qty_ordered = fields.Float( + string="Ordered Qty", + ) + product_qty = fields.Float( + string="Qty", + ) @api.depends("exclusive") def _compute_company_to_call_ids(self): @@ -44,17 +55,23 @@ def _compute_company_to_call_ids(self): else: rec.company_to_call_ids = False - def _get_destinaries_email(self): - missing_emails = [ - comp.name - for comp in self.company_to_call_ids - if not self.company_to_call_ids.requisition_intercompany_partner_ids - ] - if missing_emails: - raise UserError( - _("%s don't have contacts to send emails.") - % (", ".join(missing_emails)), + missing_procurment_contacts = fields.Html( + readonly=True, compute="_compute_missing_procurment_contacts" + ) + + @api.depends("company_to_call_ids.requisition_intercompany_partner_ids") + def _compute_missing_procurment_contacts(self): + for rec in self: + missing_emails = [comp.name for comp in rec.company_to_call_ids if not comp.requisition_intercompany_partner_ids] + message = _("No contacts to send emails : %s") % ( + "\n - ".join(missing_emails) ) + if missing_emails: + rec.missing_procurment_contacts = message + else: + rec.missing_procurment_contacts = False + + def _get_destinaries_email(self): return self.company_to_call_ids.requisition_intercompany_partner_ids.partner_id def action_call_for_proposal_send(self): @@ -154,7 +171,7 @@ def action_create_quotations(self): } po_lines.append((0, 0, proposal_line)) - self.env["purchase.order"].create( + line.purchase_id = self.env["purchase.order"].create( { "requisition_id": self.id, "partner_id": partner.id, @@ -164,9 +181,58 @@ def action_create_quotations(self): } ) + elif bool(self.requisition_proposal_ids.filtered(lambda x: x.qty_planned > 0)): + raise ValidationError( + _( + "All the propositions selected are already" + " related to a purchase request." + ) + ) + + else: + raise ValidationError( + _( + "You need to select at least one proposition.\n" + "To do so, select a line, click on 'Proposals' " + "then choose a quantity to command from the available " + "propositions." + ) + ) + def action_in_progress(self): - super().action_in_progress() + res = super().action_in_progress() if self.type_id.exclusive == "proposals": self.name = self.env["ir.sequence"].next_by_code( "purchase.requisition.purchase.call" ) + self.action_open() + return res + + def action_send_result_email(self): + self.ensure_one() + template_id = self.type_id.proposal_result_template_id.id + lang = self.env.context.get("lang") + template = self.env["mail.template"].browse(template_id) + if template.lang: + lang = template._render_lang(self.ids)[self.id] + ctx = { + "default_model": "purchase.requisition", + "default_res_id": self.id, + "default_use_template": bool(template_id), + "default_template_id": template_id, + "default_partner_ids": self._get_destinaries_email().ids, + "default_composition_mode": "comment", + "custom_layout": "mail.mail_notification_light", + "force_email": True, + "model_description": self.with_context(lang=lang).name, + } + + return { + "type": "ir.actions.act_window", + "view_mode": "form", + "res_model": "mail.compose.message", + "views": [(False, "form")], + "view_id": False, + "target": "new", + "context": ctx, + } diff --git a/purchase_requisition_proposal/models/purchase_requisition_line.py b/purchase_requisition_proposal/models/purchase_requisition_line.py index d24f7875c..35adcbbe6 100644 --- a/purchase_requisition_proposal/models/purchase_requisition_line.py +++ b/purchase_requisition_proposal/models/purchase_requisition_line.py @@ -13,14 +13,9 @@ class PurchaseRequisitionLine(models.Model): "purchase.requisition.proposal", "requisition_line_id", string="proposal Lines" ) proposal_line_count = fields.Integer(compute="_compute_proposal_line_count") - qty_planned = fields.Float( - compute="_compute_planned_qty", string="Planned Quantities" - ) + qty_planned = fields.Float(compute="_compute_planned_qty", string="Planned Qty") date_planned = fields.Date(string="Proposed Date", compute="_compute_date_planned") - is_proposal_line_validate = fields.Boolean( - string="Is Line Validate", - default=False, - ) + product_description_variants = fields.Char("Note") @api.depends("proposal_line_ids.date_planned") def _compute_date_planned(self): @@ -35,22 +30,30 @@ def _compute_date_planned(self): else: rec.date_planned = False - @api.depends("proposal_line_ids") def _compute_proposal_line_count(self): - for rec in self: - rec.proposal_line_count = len( - [line for line in rec.proposal_line_ids if line.qty_proposed] - ) + for rec in self: + # test if allowed_company_ids for test purpose + if not rec.env.context.get('allowed_company_ids', False): + current_company = self.env.user.company_id.id + else: + current_company = rec.env.context['allowed_company_ids'][0] + + if rec.company_id.id == current_company: + rec.proposal_line_count = len( + [line for line in rec.proposal_line_ids if line.qty_proposed] + ) + else: + rec.proposal_line_count = len( + [line for line in rec.proposal_line_ids if line.qty_proposed and line.company_id.id == current_company]) def proposal_validation(self): - self.sudo().write({"is_proposal_line_validate": True}) - if not self.proposal_line_ids: + if not self.proposal_line_ids.filtered(lambda x: x.partner_id == self.env.company.partner_id): self.env["purchase.requisition.proposal"].create( { "requisition_id": self.requisition_id.id, "requisition_line_id": self.id, "product_id": self.product_id.id, - "qty_proposed": self.product_qty, + "qty_proposed": 0, "date_planned": self.schedule_date, "partner_id": self.env.company.partner_id.id, } @@ -67,7 +70,7 @@ def show_requisition_proposal_line(self): else: domain = [ ("requisition_line_id", "=", self.id), - ("partner_id", "=", self.env.user.company_id.partner_id.id), + ("partner_id", "=", self.env.company.partner_id.id), ] view = self.env.ref( "purchase_requisition_proposal.requisition_proposal_buttons_wizard" @@ -92,6 +95,25 @@ def show_requisition_proposal_line(self): "context": context, } + def show_all_requisition_proposal_line(self): + domain = [("requisition_line_id", "=", self.id)] + view = self.env.ref("purchase_requisition_proposal.requisition_proposal_wizard") + wizard = self.env["requisition.proposal.wizard"].create( + { + "requisition_line_id": self.id, + "proposal_line_ids": self.proposal_line_ids.filtered_domain(domain).ids, + } + ) + return { + "type": "ir.actions.act_window", + "res_model": "requisition.proposal.wizard", + "res_id": wizard.id, + "view_mode": "form", + "view_id": view.id, + "target": "new", + "context": {"show_all_lines": True}, + } + @api.depends("proposal_line_ids.qty_planned") def _compute_planned_qty(self): for rec in self: diff --git a/purchase_requisition_proposal/models/purchase_requisition_proposal.py b/purchase_requisition_proposal/models/purchase_requisition_proposal.py index 574b5e0fa..5054e4d94 100644 --- a/purchase_requisition_proposal/models/purchase_requisition_proposal.py +++ b/purchase_requisition_proposal/models/purchase_requisition_proposal.py @@ -2,7 +2,8 @@ # @author Kévin Roche # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError class PurchaseRequisitionProposal(models.Model): @@ -19,7 +20,7 @@ class PurchaseRequisitionProposal(models.Model): "purchase.requisition", string="Purchase Agreement" ) purchase_id = fields.Many2one( - comodel_name="purchase", + comodel_name="purchase.order", string="Purchase", ) requisition_line_id = fields.Many2one( @@ -57,7 +58,7 @@ class PurchaseRequisitionProposal(models.Model): readonly=True, ) product_qty = fields.Float( - string="Requested Quantity", + string="Requested Qty", digits="Product Unit of Measure", related="requisition_line_id.product_qty", readonly=True, @@ -66,12 +67,12 @@ class PurchaseRequisitionProposal(models.Model): string="Requested Date", required=True, related="requisition_id.schedule_date" ) qty_proposed = fields.Float( - string="Proposed Quantity", + string="Proposed Qty", digits="Product Unit of Measure", default=lambda self: self.product_qty, ) qty_planned = fields.Float( - string="Planned Quantity", + string="Planned Qty", digits="Product Unit of Measure", default=lambda self: self.product_qty, ) @@ -84,6 +85,17 @@ def create(self, vals): ) return super().create(vals) + @api.constrains("qty_planned") + def _check_company_id_date_range_id(self): + for rec in self: + if rec.qty_planned > rec.qty_proposed: + raise ValidationError( + _( + "Selected Quantity can not be superior than " + "Proposed Quantity." + ) + ) + def duplicate_line(self): self.create( { diff --git a/purchase_requisition_proposal/models/purchase_requisition_type.py b/purchase_requisition_proposal/models/purchase_requisition_type.py index 320655a66..71c5e0c9d 100644 --- a/purchase_requisition_proposal/models/purchase_requisition_type.py +++ b/purchase_requisition_proposal/models/purchase_requisition_type.py @@ -46,6 +46,19 @@ def _default_proposal_template_id(self): proposal_template_id = fields.Many2one( "mail.template", default=lambda self: self._default_proposal_template_id(), - string="Report Template", + string="Opening Report Template", + required=True, + ) + + def _default_proposal_result_template_id(self): + return self.env.ref( + "purchase_requisition_proposal.mail_template_result_proposal", + raise_if_not_found=False, + ) + + proposal_result_template_id = fields.Many2one( + "mail.template", + default=lambda self: self._default_proposal_result_template_id(), + string="Closure Email Template", required=True, ) diff --git a/purchase_requisition_proposal/tests/test_purchase_requirement_proposal.py b/purchase_requisition_proposal/tests/test_purchase_requirement_proposal.py index 401124310..346a21a49 100644 --- a/purchase_requisition_proposal/tests/test_purchase_requirement_proposal.py +++ b/purchase_requisition_proposal/tests/test_purchase_requirement_proposal.py @@ -1,7 +1,7 @@ # Copyright 2023 Akretion (https://www.akretion.com). # @author Kévin Roche # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - +from odoo.exceptions import ValidationError from odoo.addons.mail.tests.common import MockEmail from odoo.addons.purchase_sale_inter_company.tests.test_inter_company_purchase_sale import ( TestPurchaseSaleInterCompany, @@ -136,10 +136,12 @@ def test_7_proposal_to_call(self): def test_8_create_rfq(self): self.call.action_call_for_proposal_send() self.call_line2.with_company(self.company_b).proposal_validation() - self.call.action_create_quotations() - self.assertFalse(self.call.purchase_ids) + with self.assertRaises(ValidationError) as m: + self.call.action_create_quotations() + self.assertIn("You need to select at least one proposition", m.exception.args[0] + ) self.proposal_1.qty_planned = 10 - self.call_line2.proposal_line_ids[0].qty_planned = 30 + self.call_line2.proposal_line_ids[0].qty_planned = 20 self.call.action_create_quotations() self.assertEqual(len(self.call.purchase_ids), 2) self.assertEqual(self.call.purchase_ids[0].partner_id, self.partner_company_a) diff --git a/purchase_requisition_proposal/views/purchase_requisition.xml b/purchase_requisition_proposal/views/purchase_requisition.xml index 3d7bcef30..f96e2c7e6 100644 --- a/purchase_requisition_proposal/views/purchase_requisition.xml +++ b/purchase_requisition_proposal/views/purchase_requisition.xml @@ -11,6 +11,16 @@ ref="purchase_requisition.view_purchase_requisition_form" /> + + + draft,open,done @@ -42,27 +52,35 @@ + + + +