Browse Source

[8.0][ADD]account_debtor_card

pull/379/head
kiplangatdan 7 years ago
parent
commit
5a8218ded0
  1. 47
      account_debtor_card/README.rst
  2. 5
      account_debtor_card/__init__.py
  3. 23
      account_debtor_card/__openerp__.py
  4. 126
      account_debtor_card/i18n/nl.po
  5. 5
      account_debtor_card/models/__init__.py
  6. 15
      account_debtor_card/models/res_partner.py
  7. 191
      account_debtor_card/report/report_debtor_card.xml
  8. BIN
      account_debtor_card/static/description/icon.png
  9. 32
      account_debtor_card/views/res_partner.xml

47
account_debtor_card/README.rst

@ -0,0 +1,47 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
===================
Account Debtor Card
===================
This module creates Debtor cards common in all accounting packages.
It prints all the customer's sale orders and the corresponding invoices.
Usage
=====
To use this module, you need to:
* Go to *Customers* Tree/Form *Print Debtor Card*.
* In *Customers* Form View *Sales Order* tab.
* In Tree View you can select one or more and *Print*
Credits
=======
Contributors
------------
* Dan Kiplangat <dan@sunflowerweb.nl>
* Tom Blauwendraat <tom@sunflowerweb.nl>
Icon
----
* Icon made by Freepik from http://flaticon.com.
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.

5
account_debtor_card/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2018 Sunflower IT (http://sunflowerweb.nl)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

23
account_debtor_card/__openerp__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# © 2018 Sunflower IT (http://sunflowerweb.nl)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Debtor Card",
"summary": "Adds an option to print sale orders and related invoices",
"version": "8.0.1.0.0",
"category": "Accounting",
"website": "https://sunflowerweb.nl",
"author": "Sunflower IT, Therp BV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale",
"account",
],
"data": [
"views/res_partner.xml",
"report/report_debtor_card.xml",
],
}

126
account_debtor_card/i18n/nl.po

@ -0,0 +1,126 @@
# This file contains the translation of the following modules:
# * account_debtor_card
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-26 09:52+0000\n"
"PO-Revision-Date: 2017-08-18 16:51+0000\n"
"Last-Translator: Tom Blauwendraat <info@sunflowerweb.nl>\n"
"Language-Team: Dutch (http://www.transifex.com/odoo/odoo-8/language/nl/)\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "---- Printed:"
msgstr "---- Afgedrukt:"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Customer:"
msgstr "Klant:"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Date"
msgstr "Datum"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Date Ordered:"
msgstr "Besteldatum:"
#. module: account_debtor_card
#: model:ir.actions.report.xml,name:account_debtor_card.action_report_debtor_card
msgid "Debtor Card"
msgstr "Debiteurenkaart"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Description"
msgstr "Omschrijving"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "No Invoices for this order"
msgstr "Geen fakturen voor deze verkooporder"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Order N°:"
msgstr "Ordernr:"
#. module: account_debtor_card
#: model:ir.model,name:account_debtor_card.model_res_partner
msgid "Partner"
msgstr "Relatie"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Payment Term:"
msgstr "Betaalconditie:"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Pending"
msgstr "In afwachting"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Price"
msgstr "Bedrag"
#. module: account_debtor_card
#: view:res.partner:account_debtor_card.view_partner_form_inherit
msgid "Print Debtor Card"
msgstr "Debiteurenkaart"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Quantity"
msgstr "Hoeveelheid"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Related Invoices"
msgstr "Bijbehorende fakturen"
#. module: account_debtor_card
#: view:res.partner:account_debtor_card.view_partner_form_inherit
msgid "Sale Orders"
msgstr "Verkooporders"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Salesperson:"
msgstr "Verkoper:"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Status"
msgstr "Status"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Status:"
msgstr "Status:"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Total"
msgstr "Totaal"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Unit Price"
msgstr "Prijs"
#. module: account_debtor_card
#: view:website:account_debtor_card.report_debtor_card
msgid "Your Reference:"
msgstr "Uw referentie:"

5
account_debtor_card/models/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2018 Sunflower IT (http://sunflowerweb.nl)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import res_partner

15
account_debtor_card/models/res_partner.py

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# © 2018 Sunflower IT (http://sunflowerweb.nl)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, api
class ResPartner(models.Model):
_inherit = "res.partner"
@api.multi
def print_debtor_card(self):
"""Button to print the sale orders and related invoices"""
return self.env['report'].get_action(
self, 'account_debtor_card.report_debtor_card')

191
account_debtor_card/report/report_debtor_card.xml

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_debtor_card">
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<div class="page">
<t t-foreach="docs" t-as="o">
<div class="oe_structure"/>
<div class="row">
<div class="col-xs-6" style="margin-top:30px;">
<h2>
<span>Customer:</span>
<span t-field="o.name"/>
</h2>
</div>
</div>
<t t-foreach="o.sale_order_ids" t-as="so">
<t t-set="state_name" t-value="dict(so.fields_get(allfields=['state'])['state']['selection'])[so.state]"/>
<h3>
<span>Order N°:</span>
<t t-esc="so.name"/>&#160;&#160;<span>Status:</span>
<t t-esc="state_name"/>
</h3>
<div class="row mt32 mb32" id="informations">
<div t-if="so.client_order_ref"
class="col-xs-3">
<strong>Your Reference:</strong>
<p t-field="so.client_order_ref"/>
</div>
<div t-if="so.date_order" class="col-xs-3">
<strong>Date Ordered:</strong>
<p t-field="so.date_order" t-options='{"format": "d MMMM y"}'/>
</div>
<div t-if="so.user_id.name"
class="col-xs-3">
<strong>Salesperson:</strong>
<p t-field="so.user_id.name"/>
</div>
<div t-if="so.payment_term"
class="col-xs-3">
<strong>Payment Term:</strong>
<p t-field="so.payment_term"/>
</div>
</div>
<!--<table class="table table-condensed">-->
<table class="table table-condensed">
<thead>
<tr>
<th>Description</th>
<th class="text-right">Quantity</th>
<th class="text-right">Unit Price
</th>
<th class="text-right">Price</th>
</tr>
</thead>
<tbody class="sale_tbody">
<tr t-foreach="so.order_line" t-as="l">
<td>
<span t-field="l.name"/>
</td>
<td class="text-right">
<span t-esc="'%.1f'%(l.product_uom_qty)"/>
<span groups="product.group_uom"
t-field="l.product_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal"/>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span t-field="so.amount_total"
t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;so.pricelist_id.currency_id&quot;}"/>
</td>
</tr>
</table>
</div>
</div>
<!-- Related Invoices -->
<t t-if="so.invoice_ids">
<table class="table table-condensed"
style="font-size:120%;">
<tr>
<th style="text-align:center;">Related Invoices</th>
</tr>
</table>
<table class="table table-striped table-condensed"
style="font-size:90%;">
<tr>
<th>Date</th>
<th>Description</th>
<th>Status</th>
<th>Quantity</th>
<th class="text-right">Unit Price
</th>
<th class="text-right">Total</th>
</tr>
<t t-foreach="so.invoice_ids" t-as="i">
<t t-set="state_name" t-value="dict(i.fields_get(allfields=['state'])['state']['selection'])[i.state]"/>
<tr t-foreach="i.invoice_line"
t-as="il">
<td>
<span t-esc="i.date_invoice"/>
</td>
<td>
<span t-esc="il.name"/>
</td>
<td>
<span t-esc="state_name"/>
</td>
<td>
<span t-esc="il.quantity"/>
</td>
<td class="text-right">
<span t-esc="il.price_unit"/>
</td>
<td class="text-right">
<span t-esc="il.price_subtotal "/>
</td>
</tr>
</t>
</table>
<t t-set="total"
t-value="sum(so.mapped('invoice_ids.amount_total'))"/>
<t t-set="pending"
t-value="so.amount_total - total"/>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span t-esc="total"/>
</td>
</tr>
<tr>
<td>
<strong>Pending</strong>
</td>
<td class="text-right">
<span t-esc="pending"/>
</td>
</tr>
</table>
</div>
</div>
<hr style="border-top: dotted 1px;"/>
</t>
<t t-if="not so.invoice_ids">
<table class="table table-condensed"
style="font-size:120%;">
<tr>
<th style="text-align:center;">No Invoices for this order</th>
</tr>
</table>
<hr style="border-top: dotted 1px;"/>
</t>
</t>
<p style="text-align: center;">---- Printed:
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%A, %B %d, %Y')"/>
----
</p>
</t>
</div>
</t>
</t>
</template>
</data>
</openerp>

BIN
account_debtor_card/static/description/icon.png

After

Width: 512  |  Height: 512  |  Size: 6.0 KiB

32
account_debtor_card/views/res_partner.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
id="action_report_debtor_card"
model="res.partner"
string="Debtor Card"
report_type="qweb-pdf"
file="account_debtor_card.report_debtor_card"
name="account_debtor_card.report_debtor_card"
/>
<record id="view_partner_form_inherit" model="ir.ui.view">
<field name="name">view.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet" position="before">
<header>
<button type="object" name="print_debtor_card"
string="Print Debtor Card"
attrs="{'invisible':[('sale_order_ids','=',[])]}"/>
</header>
</xpath>
<notebook position="inside">
<page name="sale_orders" string="Sale Orders">
<field name="sale_order_ids"/>
</page>
</notebook>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save