Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0][ADD] Chinese "fapiao" Management #33

Open
wants to merge 3 commits into
base: 9.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions l10n_cn_fapiao/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.. 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

=========================
Chinese Fapiao Management
=========================

"Fapiao" is an official invoice in China, printed with a separate official
software. This module allows the users to manage all emitted and received
"fapiao" as object in Odoo. A new submenu called Fapiao is added under the
menu Accounting.

Usage
=====

The procedure to follow for the fapiao management is as below:

#. A fapiao is received or emitted.
#. The document can be scanned as image.
#. A new fapiao is created in OpenERP.
#. The scanned document is uploaded to the newly created object as attachment.
#. Fapiao allocation to invoice: Fapiao and OpenERP invoices can be
linked to each other.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/l10n-china/9.0

Known issues / Roadmap
======================

* Fapiao management has no impact on accounting books and
* It doesn't (yet) integrate with external official software.


Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/l10n-china/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.

Credits
=======

Contributors
------------

* Eric Caudal <[email protected]>
* Frank Song <[email protected]>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://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 https://odoo-community.org.
5 changes: 5 additions & 0 deletions l10n_cn_fapiao/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2017 Elico Corp (www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import fapiao
import fapiao_test
23 changes: 23 additions & 0 deletions l10n_cn_fapiao/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# © 2017 Elico Corp (www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Chinese Fapiao Management',
'version': '9.0.1.0.0',
'category': 'Accounting',
'sequence': 19,
'summary': 'Chinese Fapiao Management and link with OpenERP Invoice',
'author': 'Elico Corp, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'website': 'https://www.elico-corp.com',
'depends': ['account'],
'data': [
'fapiao_view.xml',
],
'demo': [
'fapiao_demo.xml',
],
'installable': True,
'auto_install': False,
'application': True,
}
38 changes: 38 additions & 0 deletions l10n_cn_fapiao/fapiao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# © 2017 Elico Corp (www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields


class fapiao(models.Model):
_name = "fapiao"
_inherit = 'mail.thread'
_order = "fapiao_date desc"

fapiao_type = fields.Selection(
[('customer', 'Customer'), ('supplier', 'Supplier'),
('customer_credit_note', 'Customer Credit note')],
'Fapiao Type', required=True, default='customer')
tax_type = fields.Selection(
[('13%', '13%'), ('17%', '17%'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be a comodel as there are many more cases.
Create this data as standard data in the module and adds 6% as well
To be done in v8 and v9

('normal', 'normal'), ('no_tax', 'no tax')],
'Tax Type', required=True, default='normal')
fapiao_number = fields.Integer(string="Fapiao Number", required=True)
fapiao_date = fields.Date(string="Fapiao Date", required=True)
reception_date = fields.Date(string="Reception Date")
amount_with_taxes = fields.Float('Fapiao total amount', required=True)
invoice_ids = fields.Many2many('account.invoice', string="Invoices")
tag_ids = fields.Many2many('fapiao_tag', string="Tags")
notes = fields.Text(string="Notes")


class fapiao_tag(models.Model):
_name = 'fapiao_tag'

name = fields.Char("Name")


class account_invoice(models.Model):
_inherit = 'account.invoice'

fapiao_ids = fields.One2many('fapiao', 'invoice_ids', 'Fapiao')
20 changes: 20 additions & 0 deletions l10n_cn_fapiao/fapiao_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="demo_fapiao_tag_1" model="fapiao_tag">
<field name="name">SH</field>
</record>
<record id="demo_fapiao_tag_2" model="fapiao_tag">
<field name="name">EXPORT</field>
</record>
<!-- A fapiao statement -->
<record id="demo_fapiao_1" model="fapiao">
<field name="fapiao_number" eval="'80'+time.strftime('%S')"/>
<field name="fapiao_date" eval="time.strftime('%Y-%m')+'-01'"/>
<field name="reception_date" eval="time.strftime('%Y-%m')+'-02'"/>
<field name="amount_with_taxes">2</field>
<field name="tag_ids" eval="[(6,0,
[ref('demo_fapiao_tag_1'), ref('demo_fapiao_tag_2')])]"/>
</record>
</data>
</openerp>
79 changes: 79 additions & 0 deletions l10n_cn_fapiao/fapiao_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
# © 2017 Elico Corp (www.elico-corp.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp.tests import common


class TestFapiao(common.TransactionCase):

def setUp(self):
super(TestFapiao, self).setUp()
self.fapiao_tag_1 = self.env['fapiao_tag'].create({
'name': 'FT1',
})
self.fapiao_tag_2 = self.env['fapiao_tag'].create({
'name': 'FT2',
})
inv1 = {
'name': 'i-v-1',
'type': 'in_invoice',
'number': '299048',
'comment': '299048',
'state': 'draft',
'date': '2017-02-10',
'date_invoice': '2017-02-10',
}
self.invoice_1 = self.env['account.invoice'].create(inv1)
inv2 = {
'name': 'i-v-2',
'type': 'out_invoice',
'number': '299048',
'comment': '299048',
'state': 'draft',
'date': '2017-02-10',
'date_invoice': '2017-02-10',
}
self.invoice_2 = self.env['account.invoice'].create(inv2)
fp1 = {
'fapiao_type': 'customer',
'tax_type': 'normal',
'fapiao_number': 1028787,
'fapiao_date': '2017-02-13',
'reception_date': '2017-2-14',
'amount_with_taxes': 10.0,
'notes': 'SX-19-08',
}
self.fapiao_1 = self.env['fapiao'].create(fp1)
fp2 = {
'fapiao_type': 'customer',
'tax_type': 'normal',
'fapiao_number': 1028787,
'fapiao_date': '2017-02-13',
'reception_date': '2017-2-14',
'amount_with_taxes': 10.0,
'notes': 'SX-19-08',
}
self.fapiao_2 = self.env['fapiao'].create(fp2)


def test_company_info(self):
self.assertTrue(
self.fapiao_tag_1.exists(),
)
self.assertTrue(
self.fapiao_tag_2.exists(),
)
self.assertTrue(
self.invoice_1.exists(),
)
self.assertTrue(
self.invoice_2.exists(),
)
self.fapiao_1.invoice_ids.add(self.invoice_1)
self.fapiao_1.invoice_ids.add(self.invoice_2)
self.assertTrue(
self.fapiao_1.exists(),
)
self.assertTrue(
self.fapiao_2.exists(),
)
95 changes: 95 additions & 0 deletions l10n_cn_fapiao/fapiao_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_fapiao_tree" model="ir.ui.view">
<field name="name">fapiao.tree</field>
<field name="model">fapiao</field>
<field name="arch" type="xml">
<tree string="Fapiao Line">
<field name="fapiao_date" />
<field name="fapiao_number"/>
<field name="amount_with_taxes" />
</tree>
</field>
</record>
<record id="view_fapiao_form" model="ir.ui.view">
<field name="name">fapiao.line.form</field>
<field name="model">fapiao</field>
<field name="arch" type="xml">
<form string="Fapiao Line" version="7.0">
<sheet string="Fapiao">
<group>
<group>
<field name="fapiao_number" />
<field name="tag_ids" widget="many2many_tags"
placeholder="Tags..." />
<field name="fapiao_type" />
</group>
<group>
<field name="fapiao_date" />
<field name="amount_with_taxes" />
</group>
</group>
<field name="invoice_ids" />
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"
/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="view_fapiao_filter" model="ir.ui.view">
<field name="name">fapiao.select</field>
<field name="model">fapiao</field>
<field name="arch" type="xml">
<search string="Search Fapiao">
<field name="fapiao_number" />
<field name="fapiao_date" />
<field name="tag_ids" />
<separator/>
<group expand="0" string="Group By...">
<filter string="Fapiao Date" icon="terp-go-month"
domain="[]" context="{'group_by':'fapiao_date'}"
/>
<filter string="Fapiao Number" icon="" domain="[]"
context="{'group_by':'fapiao_number'}"
/>
</group>
</search>
</field>
</record>
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<xpath expr="//notebook/page[@string='Payments']"
position="after">
<page string="Fapiao Info">
<field name="fapiao_ids">
<tree string="Fapiao" editable="bottom">
<field name="fapiao_number" />
<field name="fapiao_date" />
<field name="amount_with_taxes" />
</tree>
</field>
</page>
</xpath>
</field>
</record>

<record id="action_fapiao_tree" model="ir.actions.act_window">
<field name="name">Customer Fapiao</field>
<field name="res_model">fapiao</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_fapiao_filter" />
</record>
<menuitem id="menu_fapiao" name="Fapiao"
parent="account.menu_finance" sequence="3"/>
<menuitem action="action_fapiao_tree" id="fapiao_tree_lines"
parent="menu_fapiao"/>
</data>
</openerp>
Binary file added l10n_cn_fapiao/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions l10n_cn_fapiao/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<section class="oe_container">
<div class="oe_row">
<h2 class="oe_slogan">l10n_cn_fapiao module</h2>
<h3 class="oe_slogan">Fapiao Management and link with Odoo Invoice<br></h3>
<h4 class="oe_slogan"><a href="http://www.elico-corp.com">By Elico Corp and OCA</a></h4>
<p>
"Fapiao" is an official invoice in China, printed with a separate official
software. This module allows the users to manage all emitted and received
"fapiao" as object in Odoo. A new submenu called Fapiao is added under the
menu Accounting.

The procedure to follow for the fapiao management is as below:<br>
<ol>
<li>1: A fapiao is received or emitted</li>
<li>2: The document can be scanned as image</li>
<li>3: A new fapiao is created in Odoo</li>
<li>4: The scanned document is uploaded to the newly created object as attachment.</li>
<li>5: Fapiao allocation to invoice: Fapiao and Odoo invoices can be linked to each other</li>
</ol>
</p>
<div class="oe_row_img oe_centered oe_mt32">
<img class="oe_picture oe_screenshot" src="l10n_cn_fapiao1.png">
</div>
</div>
<div class="oe_row oe_centeralign oe_more_space">
<a href="http://www.odoo-community.org/" class="oe_button oe_big">Odoo Community Association</a>
</div>
<h4 class="oe_slogan">or</h4>
</section>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.