[REPORT] ~pos.receipt: client name and mobile
authorLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Tue, 12 May 2020 20:08:46 +0000 (22:08 +0200)
committerLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Tue, 12 May 2020 20:08:46 +0000 (22:08 +0200)
__init__.py
i18n/bikecoop_l10n_fr.pot
i18n/fr.po
report/__init__.py [new file with mode: 0644]
report/pos_receipt.py [new file with mode: 0644]
report/pos_receipt_bikecoop_l10n_fr.rml [new file with mode: 0644]
wizard/__init__.py [new file with mode: 0644]
wizard/pos_receipt.py [new file with mode: 0644]

index 17dca1b..ebfe3fa 100644 (file)
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    bikecoop l10n fr module for OpenERP, French localisation module for bike coop'
-#    Copyright (C) 2012-2016 L'Heureux Cyclage (<http://www.heureux-cyclage.org>)
+#    Copyright (C) 2012-2020 L'Heureux Cyclage (<http://www.heureux-cyclage.org>)
 #
 #    This file is a part of bikecoop_l10n_fr
 #
@@ -22,5 +22,7 @@
 ##############################################################################
 
 import bikecoop
+import report
+import wizard
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
index 444b987..a003402 100644 (file)
@@ -6,8 +6,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: OpenERP Server 7.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-09-27 09:20+0000\n"
-"PO-Revision-Date: 2015-09-27 09:20+0000\n"
+"POT-Creation-Date: 2020-05-12 15:41+0000\n"
+"PO-Revision-Date: 2020-05-12 15:41+0000\n"
 "Last-Translator: <>\n"
 "Language-Team: \n"
 "MIME-Version: 1.0\n"
@@ -40,6 +40,11 @@ msgstr ""
 msgid "Membership main informations"
 msgstr ""
 
+#. module: bikecoop_l10n_fr
+#: model:res.groups,name:bikecoop_l10n_fr.make_invisible
+msgid "Invisible"
+msgstr ""
+
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
 msgid "Associate members"
@@ -107,6 +112,12 @@ msgstr ""
 msgid "Associate member"
 msgstr ""
 
+#. module: bikecoop_l10n_fr
+#: code:addons/bikecoop_l10n_fr/point_of_sale.py:41
+#, python-format
+msgid "Your ending balance is too different from the theoretical cash closing (%.2f), the maximum allowed is: %.2f. Want you really close this cash statement?"
+msgstr ""
+
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
 msgid "CITY"
@@ -119,12 +130,13 @@ msgstr ""
 
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
-msgid "Other, Female or Male"
+msgid "All bikecoop members"
 msgstr ""
 
 #. module: bikecoop_l10n_fr
-#: view:res.partner:0
-msgid "All bikecoop members"
+#: code:addons/bikecoop_l10n_fr/point_of_sale.py:40
+#, python-format
+msgid "Warning!"
 msgstr ""
 
 #. module: bikecoop_l10n_fr
@@ -132,6 +144,11 @@ msgstr ""
 msgid "Partner"
 msgstr ""
 
+#. module: bikecoop_l10n_fr
+#: model:ir.model,name:bikecoop_l10n_fr.model_pos_receipt
+msgid "Point of sale receipt"
+msgstr ""
+
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
 msgid "Postal address"
index ea3c305..ae86eaf 100644 (file)
@@ -6,15 +6,15 @@ msgid ""
 msgstr ""
 "Project-Id-Version: OpenERP Server 7.0alpha\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-09-27 11:21+0200\n"
-"PO-Revision-Date: 2015-09-27 11:22+0200\n"
+"POT-Creation-Date: 2020-05-12 15:41+0000\n"
+"PO-Revision-Date: 2020-05-12 17:46+0200\n"
 "Last-Translator: Ludovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>\n"
 "Language-Team: \n"
 "Language: fr_FR\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 1.8.4\n"
+"X-Generator: Poedit 2.3\n"
 
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
@@ -41,6 +41,11 @@ msgstr "Rue ..."
 msgid "Membership main informations"
 msgstr "Informations principales d'adhésion"
 
+#. module: bikecoop_l10n_fr
+#: model:res.groups,name:bikecoop_l10n_fr.make_invisible
+msgid "Invisible"
+msgstr "Invisible"
+
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
 msgid "Associate members"
@@ -106,6 +111,15 @@ msgstr "Adhésions"
 msgid "Associate member"
 msgstr "Membres associé-e-s"
 
+#. module: bikecoop_l10n_fr
+#: code:addons/bikecoop_l10n_fr/point_of_sale.py:41
+#, python-format
+msgid ""
+"Your ending balance is too different from the theoretical cash closing "
+"(%.2f), the maximum allowed is: %.2f. Want you really close this cash "
+"statement?"
+msgstr ""
+
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
 msgid "CITY"
@@ -116,26 +130,35 @@ msgstr "VILLE"
 msgid "Occupations"
 msgstr "Activités"
 
-#. module: bikecoop_l10n_fr
-#: view:res.partner:0
-msgid "Other, Female or Male"
-msgstr "Autre, Féminin, Masculin"
-
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
 msgid "All bikecoop members"
 msgstr "Tous les membres de l'atelier"
 
+#. module: bikecoop_l10n_fr
+#: code:addons/bikecoop_l10n_fr/point_of_sale.py:40
+#, python-format
+msgid "Warning!"
+msgstr "Avertissement!"
+
 #. module: bikecoop_l10n_fr
 #: model:ir.model,name:bikecoop_l10n_fr.model_res_partner
 msgid "Partner"
 msgstr "Partenaire"
 
+#. module: bikecoop_l10n_fr
+#: model:ir.model,name:bikecoop_l10n_fr.model_pos_receipt
+msgid "Point of sale receipt"
+msgstr "Reçu de l'atelier\t"
+
 #. module: bikecoop_l10n_fr
 #: view:res.partner:0
 msgid "Postal address"
 msgstr "Adresse postale"
 
+#~ msgid "Other, Female or Male"
+#~ msgstr "Autre, Féminin, Masculin"
+
 #~ msgid "..."
 #~ msgstr "..."
 
@@ -143,7 +166,8 @@ msgstr "Adresse postale"
 #~ msgstr "Membres associés à ce partenaire"
 
 #~ msgid "Error ! You cannot create recursive associated members."
-#~ msgstr "Erreur! Vous ne pouvez pas créer de membres associés de façon récursive."
+#~ msgstr ""
+#~ "Erreur! Vous ne pouvez pas créer de membres associés de façon récursive."
 
 #~ msgid "Bikecoop members"
 #~ msgstr "Membres de l'atelier"
diff --git a/report/__init__.py b/report/__init__.py
new file mode 100644 (file)
index 0000000..e201b0b
--- /dev/null
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+import pos_receipt
diff --git a/report/pos_receipt.py b/report/pos_receipt.py
new file mode 100644 (file)
index 0000000..8379027
--- /dev/null
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+import time
+from openerp.report import report_sxw
+from openerp import pooler
+
+def titlize(journal_name):
+    words = journal_name.split()
+    while words.pop() != 'journal':
+        continue
+    return ' '.join(words)
+
+class order(report_sxw.rml_parse):
+
+    def __init__(self, cr, uid, name, context):
+        super(order, self).__init__(cr, uid, name, context=context)
+
+        user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
+        partner = user.company_id.partner_id
+
+        self.localcontext.update({
+            'time': time,
+            'disc': self.discount,
+            'net': self.netamount,
+            'get_journal_amt': self._get_journal_amt,
+            'address': partner or False,
+            'titlize': titlize
+        })
+
+    def netamount(self, order_line_id):
+        sql = 'select (qty*price_unit) as net_price from pos_order_line where id = %s'
+        self.cr.execute(sql, (order_line_id,))
+        res = self.cr.fetchone()
+        return res[0]
+
+    def discount(self, order_id):
+        sql = 'select discount, price_unit, qty from pos_order_line where order_id = %s '
+        self.cr.execute(sql, (order_id,))
+        res = self.cr.fetchall()
+        dsum = 0
+        for line in res:
+            if line[0] != 0:
+                dsum = dsum +(line[2] * (line[0]*line[1]/100))
+        return dsum
+
+    def _get_journal_amt(self, order_id):
+        data={}
+        sql = """ select aj.name,absl.amount as amt from account_bank_statement as abs
+                        LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
+                        LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
+                        WHERE absl.pos_statement_id =%d"""%(order_id)
+        self.cr.execute(sql)
+        data = self.cr.dictfetchall()
+        return data
+
+
+
+report_sxw.report_sxw('report.bikecoop_l10n_fr.receipt', 'pos.order', 'addons/bikecoop_l10n_fr/report/pos_receipt_bikecoop_l10n_fr.rml', parser=order, header=False)
diff --git a/report/pos_receipt_bikecoop_l10n_fr.rml b/report/pos_receipt_bikecoop_l10n_fr.rml
new file mode 100644 (file)
index 0000000..67f1667
--- /dev/null
@@ -0,0 +1,181 @@
+<?xml version="1.0"?>
+<document filename="test.pdf">
+  <template pageSize="(204.0,842.0)" title="Receipt" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
+    <pageTemplate id="first">
+      <frame id="first" x1="0.0" y1="0.0" width="204" height="800"/>
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="Standard_Outline">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table3">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="0,1"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="2,1" stop="2,1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table2">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table4">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table10">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="0,1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="2,1" stop="2,1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+    </blockTableStyle>
+    <initialize>
+      <paraStyle name="all" alignment="justify"/>
+    </initialize>
+    <paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
+    <paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10"/>
+    <paraStyle name="P3" fontName="Helvetica" fontSize="7.0" leading="9" alignment="LEFT"/>
+    <paraStyle name="P8" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="Standard" fontName="Helvetica"/>
+    <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Table Contents" fontName="Helvetica"/>
+    <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
+    <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="Index" fontName="Helvetica"/>
+    <paraStyle name="Frame contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER"/>
+    <paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Courier" fontSize="10.0" leading="13" alignment="LEFT"/>
+    <paraStyle name="terp_header_Centre" fontName="Courier-Bold" fontSize="12.0" leading="15" alignment="CENTER"/>
+    <paraStyle name="terp_default_9b" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="terp_default_Bold_9_Right1" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="terp_default_Bold_9_Right2" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P4" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="CENTER"/>
+    <paraStyle name="P5" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="LEFT"/>
+    <paraStyle name="P7" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
+    <paraStyle name="P6a" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT"/>
+    <paraStyle name="P7a" fontName="Courier" fontSize="10.0" leading="13" alignment="RIGHT"/>
+    <paraStyle name="P6" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
+    <paraStyle name="P13" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
+    <paraStyle name="Table" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
+    <images/>
+  </stylesheet>
+  <story>
+    <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
+    <para style="P5">[[ o.note ]]</para>
+    <para style="P4">
+      <font color="white"> </font>
+    </para>
+    <para style="terp_header_Centre">[[o.user_id.company_id.name]]</para>
+    <para style="terp_default_Centre_9">[[ address and display_address(address)]]</para>
+    <para style="terp_default_Centre_9">Tél : [[ address and address.phone ]]</para>
+    <para style="terp_default_Centre_9">SIRET : [[o.user_id.company_id.siret]]</para>
+    <para style="terp_default_Centre_9">Atelier : [[ o.shop_id.name ]]</para>
+    <para style="terp_default_Centre_9">Date : [[ o.date_order ]]</para>
+    <para style="P4">
+      <font color="white"> </font>
+    </para>
+    <para style="terp_header_Centre">Bénéficiaire</para>
+    <para style="terp_default_Centre_9">[[ o.partner_id.name ]]</para>
+    <para style="terp_default_Centre_9">Portable: [[ o.partner_id.mobile ]]</para>
+    <para style="P4">
+      <font color="white"> </font>
+    </para>
+    <para style="P4">
+      <font color="white"> </font>
+    </para>
+    <para style="P4">
+      <font color="white"> </font>
+    </para>
+    <para style="P4">[[ o.name ]]</para>
+    <blockTable colWidths="68.0,68.0,68.0" style="Table3">
+      <tr>
+        <td>
+          <para style="P5">Description</para>
+        </td>
+        <td>
+          <para style="P7">Qté</para>
+        </td>
+        <td>
+          <para style="P7">Prix</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P1">[[ repeatIn(o.lines,'line') ]]</para>
+          <para style="terp_default_9b">[[ line.product_id.name ]]</para>
+          <para style="terp_default_Right_9">
+            <font face="Helvetica">With a [[ line and line.discount == 0.0 and removeParentNode('font') ]] ([[ '%.2f' % line.discount ]]) % discount.</font>
+          </para>
+          <para style="terp_default_9b">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][['%.f' % line.qty ]]</para>
+        </td>
+        <td>
+          <para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][[ formatLang(net(line.id), currency_obj=company.currency_id) ]] <font face="Helvetica">[[ line and line.discount == 0.0 and removeParentNode('font') ]] ([[ formatLang(line.discount, currency_obj=company.currency_id) ]])</font></para>
+        </td>
+      </tr>
+    </blockTable>
+    <blockTable colWidths="136.0,68.0" style="Table2">
+      <tr>
+        <td>
+          <para style="P6a">Taxes :</para>
+        </td>
+        <td>
+          <para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][[formatLang(o.amount_tax, currency_obj=company.currency_id)]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <blockTable colWidths="136.0,68.0" style="Table4">
+      <tr>
+        <td>
+          <para style="P6">Total :</para>
+        </td>
+        <td>
+          <para style="terp_default_Bold_9_Right2">[[o.state=='cancel' and o.statement_ids and '-' or '']][[formatLang(o.amount_total, currency_obj=company.currency_id)]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <blockTable colWidths="102.0,34.0,68.0" style="Table10">
+      <tr>
+        <td>
+          <para style="P5">Moyen(s) de paiement</para>
+        </td>
+        <td>
+          <para style="P1">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P13">Montant</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P1">[[ repeatIn(get_journal_amt(o),'d') ]]</para>
+          <para style="P2">[[ d['name'] ]]</para>
+        </td>
+        <td>
+          <para style="P1">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P8">[[ formatLang(d['amt'] or 0, currency_obj=company.currency_id) ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+  </story>
+</document>
diff --git a/wizard/__init__.py b/wizard/__init__.py
new file mode 100644 (file)
index 0000000..e201b0b
--- /dev/null
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+import pos_receipt
diff --git a/wizard/pos_receipt.py b/wizard/pos_receipt.py
new file mode 100644 (file)
index 0000000..a1e0fc5
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+
+from openerp.osv import orm
+
+
+class print_report(orm.Model):
+    _inherit = 'pos.receipt'
+
+    def print_report(self, cr, uid, ids, context=None):
+        """
+        To get the date and print the report
+        @param self: The object pointer.
+        @param cr: A database cursor
+        @param uid: ID of the user currently logged in
+        @param context: A standard dictionary
+        @return : retrun report
+        """
+        if context is None:
+            context = {}
+        datas = {'ids': context.get('active_ids', [])}
+        return {
+            'type': 'ir.actions.report.xml',
+            'report_name': 'bikecoop_l10n_fr.receipt',
+            'datas': datas,
+        }