From c2235f117913eb46cd23f78b3aee20b01cfe8d13 Mon Sep 17 00:00:00 2001 From: Benjamin <35699580+benj-filament@users.noreply.github.com> Date: Wed, 27 Feb 2019 14:39:17 +0100 Subject: [PATCH] modif LC --- data/data.xml | 12 ++-- models/sale.py | 99 ++++++++++++++++++------------- report/report_finacoop_layout.xml | 15 +++-- report/report_lettre_coop.xml | 2 + views/sale_views.xml | 52 +++++++++++++--- 5 files changed, 120 insertions(+), 60 deletions(-) diff --git a/data/data.xml b/data/data.xml index 91e5cce..613d29a 100644 --- a/data/data.xml +++ b/data/data.xml @@ -328,9 +328,9 @@ nos salutations distinguées.</span></p><p style="text-align:justify"><span sty <p align="center" style="text-align:center"><b style=""><span style="font-family:"Ecofont Vera Sans","sans-serif"; "> </span></b></p> <p align="center" style="text-align:center"><b style=""><span style="font-family:"Ecofont Vera Sans","sans-serif"; - "><span style="mso-spacerun:yes"> </span>${object.user_id.firstname} ${object.user_id.lastname}</span></b></p> + "><span style="mso-spacerun:yes"> </span>Mathieu CASTAINGS</span></b></p> <p align="center" style="text-align:center"><b style=""><span style="font-family:"Ecofont Vera Sans","sans-serif"; - ">Expert-comptable</span></b></p> + ">Expert comptable en charge du dossier</span></b></p> </td> </tr> </tbody> @@ -855,10 +855,10 @@ le logiciel collaboratif en ligne <a href="https://www.silaexpert.fr/">Silæx <strong></strong> </p> <p align="center"> - <strong> ${object.user_id.firstname} ${object.user_id.firstname} </strong> + <strong> Mathieu CASTAINGS </strong> </p> <p align="center"> - <strong>Expert-comptable</strong> + <strong>Expert comptable en charge du dossier</strong> </p> </td> </tr> @@ -1552,9 +1552,9 @@ mso-fareast-font-family:Rasa;mso-bidi-font-family:Rasa"><o:p> </o:p></span> <p class="MsoNormal"><b><span style="font-family:"Ecofont Vera Sans","sans-serif";mso-fareast-font-family: Rasa;mso-bidi-font-family:Rasa"><o:p> </o:p></span></b></p> <p class="MsoNormal" align="center" style="text-align:center"><b><span style="font-family:"Ecofont Vera Sans","sans-serif"; - mso-fareast-font-family:Rasa;mso-bidi-font-family:Rasa"> {{PrenomEComptable}} {{NomEComptable}} <o:p></o:p></span></b></p> + mso-fareast-font-family:Rasa;mso-bidi-font-family:Rasa"> Mathieu CASTAINGS <o:p></o:p></span></b></p> <p class="MsoNormal" align="center" style="text-align:center"><b><span style="font-family:"Ecofont Vera Sans","sans-serif"; - mso-fareast-font-family:Rasa;mso-bidi-font-family:Rasa">Expert-comptable<o:p></o:p></span></b></p> + mso-fareast-font-family:Rasa;mso-bidi-font-family:Rasa">Expert comptable en charge du dossier<o:p></o:p></span></b></p> </td> </tr> </tbody></table><p> diff --git a/models/sale.py b/models/sale.py index 3b5269e..f37b1b5 100644 --- a/models/sale.py +++ b/models/sale.py @@ -7,46 +7,65 @@ from odoo import fields, models, api from odoo.exceptions import AccessError, UserError, ValidationError class FinacoopSaleOrderLine(models.Model): - _inherit = 'sale.order.line' - - nb_rdv = fields.Integer('Nombre de Rdv') + _inherit = 'sale.order.line' + + nb_rdv = fields.Integer('Nombre de Rdv') class FinacoopSaleOrder(models.Model): - _inherit = "sale.order" - - lettre_coop = fields.Many2one('fina.lettre.coop', "Type lettre de coop") - content_html = fields.Html(string='Contenu') - periode_finance = fields.Char('Période à financer') - projet_finance = fields.Char('Projet à financer') - chiffre_affaire = fields.Char('Chiffre d affaires') - levee_financement = fields.Char('Levée de financements') - lieu_immatriculation = fields.Char('Lieu immatriculation') - nb_rdv = fields.Integer('Nombre de rdv') - orga_administrative = fields.Char('Organisation administrative') - exercice_social = fields.Integer('Exercice social') - millesime = fields.Integer('Millesime') - orga_comptable = fields.Char('Organisation comptable') - volumes_annuels = fields.Integer('Volumes annuels') - exercice_revise = fields.Integer('Exercice révisé') - tarifs_horaires = fields.Integer("Tarif horaire", default=70) - annexe1 = fields.Boolean('Annexe 1') - annexe2 = fields.Boolean('Annexe 2') - contact = fields.Many2one('res.partner', 'Contact', domain=[('is_company','=',False), ]) - lettre_coop_sale = fields.Boolean('Lettre de coopération') - ## PDF lettre signé - pdf_lettre_signe = fields.Binary("Lettre coop signé") - pdf_filename = fields.Char('Lettre signé PDF') - - @api.onchange('lettre_coop') - def onchange_lettre_coop(self): - if self.lettre_coop: - self.content_html = self.lettre_coop.body_html - - @api.multi - def action_confirm(self): - if self.lettre_coop_sale: - if self.pdf_lettre_signe == None: - return False - res = super(FinacoopSaleOrder, self).action_confirm() - return True + _inherit = "sale.order" + + # state = fields.Selection(selection_add=[("lc_ok","LC Validée")],) + state = fields.Selection([ + ('draft', 'Quotation'), + ("lc_ok","LC Validée"), + ('sent', 'Quotation Sent'), + ('sale', 'Sales Order'), + ('done', 'Locked'), + ('cancel', 'Cancelled'), + ],) + + ## Fields Lettre Coop + lettre_coop = fields.Many2one('fina.lettre.coop', "Type lettre de coop") + content_html = fields.Html(string='Contenu') + periode_finance = fields.Char('Période à financer') + projet_finance = fields.Char('Projet à financer') + chiffre_affaire = fields.Char('Chiffre d affaires') + levee_financement = fields.Char('Levée de financements') + lieu_immatriculation = fields.Char('Lieu immatriculation') + nb_rdv = fields.Integer('Nombre de rdv') + orga_administrative = fields.Char('Organisation administrative') + exercice_social = fields.Integer('Exercice social') + millesime = fields.Integer('Millesime') + orga_comptable = fields.Char('Organisation comptable') + volumes_annuels = fields.Integer('Volumes annuels') + exercice_revise = fields.Integer('Exercice révisé') + tarifs_horaires = fields.Integer("Tarif horaire", default=70) + annexe1 = fields.Boolean('Annexe 1') + annexe2 = fields.Boolean('Annexe 2') + contact = fields.Many2one('res.partner', 'Contact', domain=[('is_company','=',False), ]) + lettre_coop_sale = fields.Boolean('Lettre de coopération') + ## PDF lettre signé + pdf_lettre_signe = fields.Binary("Lettre coop signé") + pdf_filename = fields.Char('Lettre signé PDF') + + @api.onchange('lettre_coop') + def onchange_lettre_coop(self): + if self.lettre_coop: + self.content_html = self.lettre_coop.body_html + + @api.multi + def action_confirm(self): + if self.lettre_coop_sale: + if self.pdf_lettre_signe == None: + return False + res = super(FinacoopSaleOrder, self).action_confirm() + return True + + @api.multi + def print_lc(self): + return self.env['report'].get_action(self, 'finacoop_lettre_coop.qweb_finacoop_lettre_coop_pdf') + + @api.multi + def validate_lc(self): + self.filtered(lambda s: s.state == 'draft').write({'state': 'lc_ok'}) diff --git a/report/report_finacoop_layout.xml b/report/report_finacoop_layout.xml index 9e97df0..9216e17 100644 --- a/report/report_finacoop_layout.xml +++ b/report/report_finacoop_layout.xml @@ -28,16 +28,21 @@ <div class="col-xs-12 footer-formation"> <span>FINACOOP</span><br/> SCIC SAS à capital variable d'expertise comptable, juridique, financière et de révision coopérative<br/> - Enregistrement OEC n°140000226101 | Code NAF : 6920Z | SIRET : 820 273 589 00011<br/> - RCS de Paris N° 820 273 589 | TVA : FR 37 820273589<br/> - Siège social : 11 rue du Croissant 75002 PARIS + Enregistrement OEC n°140000226101 + <t t-if="docs.company_id.ape" > | Code NAF : <span t-field="docs.company_id.ape" /></t> + <t t-if="docs.company_id.siret" > | SIRET : <span t-field="docs.company_id.siret" /></t> + <br/> + <t t-if="docs.company_id.company_registry" ><span t-field="docs.company_id.company_registry" /></t> + <t t-if="docs.company_id.vat" > | TVA : <span t-field="docs.company_id.vat" /></t> + <br/> + Siège social : <span t-field="docs.company_id.street" />, <span t-field="docs.company_id.street2" /> <span t-field="docs.company_id.zip" /> <span t-field="docs.company_id.city" /> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="footer-conditions"> - <a href="www.finacoop.fr">www.finacoop.fr</a> - <a href="mailto:contact@finacoop.fr">contact@finacoop.fr</a><br/> - Twitter | Facebook | LinkedIn | Dailymotion + <a t-att-href="docs.company_id.website"><span t-field="docs.company_id.website" /></a> - <a href="mailto:contact@finacoop.fr">contact@finacoop.fr</a><br/> + <a href="http://twitter.com/finacoop_">Twitter</a> | <a href="http://facebook.com/finacoop">Facebook</a> | <a href="http://linkedin.com/company/10604965">LinkedIn</a> | <a href="http://www.dailymotion.com/FINACOOP">Dailymotion</a> </div> </div> </div> diff --git a/report/report_lettre_coop.xml b/report/report_lettre_coop.xml index b5c557c..608f9c9 100644 --- a/report/report_lettre_coop.xml +++ b/report/report_lettre_coop.xml @@ -3149,6 +3149,8 @@ color:black"></span></p> model="sale.order" string="Lettre de coopération" report_type="qweb-pdf" + attachment_use="True" + attachment='( object.partner_id.display_name + u" - Lettre de coopération " + str(object.exercice_social) + " " + object.lettre_coop.name + ".pdf")' /> </data> diff --git a/views/sale_views.xml b/views/sale_views.xml index 5e34b24..17c1e50 100644 --- a/views/sale_views.xml +++ b/views/sale_views.xml @@ -7,15 +7,42 @@ <field name="model">sale.order</field> <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> - <xpath expr="//field[@name='partner_id']" position="after"> - <field name="contact"/> - </xpath> - <xpath expr="//notebook//page//field[@name='order_line']//tree//field[@name='name']" position="after"> - <field name="nb_rdv"/> - </xpath> + <!-- HEADER FORM --> <xpath expr="//button[@name='action_cancel']" position="after"> <button name="%(finacoop_wizard_lettre_preview)d" string="Prévisualiser lettre de Coop" type="action" attrs="{'invisible': ['|',('lettre_coop_sale', '=', False),('state', '!=', 'draft')]}" /> </xpath> + <!-- Senb by email --> + <xpath expr="//button[@name='action_quotation_send']" position="attributes"> + <attribute name="states">sent,lc_ok,sale</attribute> + </xpath> + <!-- Validate LC --> + <xpath expr="//button[@name='print_quotation']" position="attributes"> + <attribute name="states">lc_ok</attribute> + <attribute name="class"></attribute> + </xpath> + <xpath expr="//button[@name='print_quotation']" position="before"> + <button name="validate_lc" string="Valider LC" type="object" states="draft" class="btn-primary"/> + </xpath> + <xpath expr="//button[@name='action_confirm'][2]" position="attributes"> + <attribute name="states">lc_ok</attribute> + </xpath> + <!-- Print LC --> + <xpath expr="//button[@name='print_quotation'][2]" position="before"> + <button name="print_lc" string="Imprimer LC" type="object" states="lc_ok,sent,sale" class="btn-primary"/> + </xpath> + <!-- Cancel --> + <xpath expr="//button[@name='action_cancel']" position="attributes"> + <attribute name="states">sent,lc_ok,sale,draft</attribute> + </xpath> + <!-- Workflow --> + <xpath expr="//field[@name='state']" position="attributes"> + <attribute name="statusbar_visible">sent,lc_ok,sale,draft</attribute> + </xpath> + + <!-- SHEET --> + <xpath expr="//field[@name='partner_id']" position="after"> + <field name="contact"/> + </xpath> <xpath expr="//field[@name='payment_term_id']" position="after"> <field name="lettre_coop_sale" attrs="{'readonly': [('state', '!=', 'draft')]}"/> <field name="lettre_coop" attrs="{'invisible': [('lettre_coop_sale', '=', False)]}"/> @@ -26,8 +53,15 @@ <label for="pdf_lettre_signe"/>: <field name="pdf_filename" invisible="1"/><field widget="binary" name="pdf_lettre_signe" filename="pdf_filename"/> </div> </xpath> - <xpath expr="//notebook"> - <page string="Infos supplémentaires"> + + <!-- NOTEBOOK SOL --> + <xpath expr="//notebook//page//field[@name='order_line']//tree//field[@name='name']" position="after"> + <field name="nb_rdv"/> + </xpath> + + <!-- NOTEBOOK LC --> + <xpath expr="//notebook/page[1]" position="after"> + <page string="Infos LC" name="lc_infos"> <group> <group attrs="{'readonly': [('state', '!=', 'draft')]}"> <field name="periode_finance"/> @@ -47,7 +81,7 @@ </group> </group> </page> - <page string="Lettre de Coop" attrs="{'invisible': [('lettre_coop_sale', '=', False)]}"> + <page string="Lettre de Coop" attrs="{'invisible': [('lettre_coop_sale', '=', False)]}" name="lc_preview"> <group> <group> <field name="annexe1"/> -- GitLab