Merge lp:~jean-lelievre/account-payment/account_prepayment into lp:~account-payment-team/account-payment/6.1

Proposed by Jean LELIEVRE ElicoCorp
Status: Work in progress
Proposed branch: lp:~jean-lelievre/account-payment/account_prepayment
Merge into: lp:~account-payment-team/account-payment/6.1
Diff against target: 356 lines (+328/-0)
5 files modified
account_prepayment/__init__.py (+25/-0)
account_prepayment/__openerp__.py (+50/-0)
account_prepayment/account.py (+107/-0)
account_prepayment/account_view.xml (+65/-0)
account_prepayment/i18n/zh_CN.po (+81/-0)
To merge this branch: bzr merge lp:~jean-lelievre/account-payment/account_prepayment
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Needs Fixing
Account Payment Pending
Review via email: mp+182021@code.launchpad.net

Description of the change

[ADD] Add the module account_prepayment

Prepayment Module For Opentrading
==================================================
Fine tune Prepayment addon \n
* Add Prepayment Account In Partner \n
* Add purchase_order_id and Prepayment Account in payment.

To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Hello Jean,

l117: you need an extra line to be PEP8 compliant. Running flake8 on your module will help you with that.

You made the translation in chinese but the pot file for other translations is missing.

Otherwise LGTM.

Thanks!

review: Needs Fixing (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

No changes since 2013-11-10 after Need Fixing request -> I set this in WIP

@Jean LELIEVRE

Please do the required changes then set it in Needs Review again

Cheers,
Yannick

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/account-payment. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

Unmerged revisions

105. By Jean LELIEVRE ElicoCorp

[ADD] Add the module 'account_prepayment'

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'account_prepayment'
=== added file 'account_prepayment/__init__.py'
--- account_prepayment/__init__.py 1970-01-01 00:00:00 +0000
+++ account_prepayment/__init__.py 2013-08-26 03:48:18 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Andy Lu <andy.lu@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import account
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file26\ No newline at end of file
127
=== added file 'account_prepayment/__openerp__.py'
--- account_prepayment/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_prepayment/__openerp__.py 2013-08-26 03:48:18 +0000
@@ -0,0 +1,50 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Andy Lu <andy.lu@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Prepayment',
25 'version': '1.0',
26 'category': 'Account',
27 'sequence': 20,
28 'summary': 'Account Prepayment',
29 'description': """
30Prepayment Module For Opentrading
31==================================================
32Fine tune Prepayment addon \n
33* Add Prepayment Account In Partner \n
34* Add purchase_order_id and Prepayment Account in payment.
35 """,
36 'author': 'Elico Corp',
37 'website': 'http://www.elico-corp.com',
38 'images' : [],
39 'depends': ['account', 'account_voucher', 'purchase'],
40 'data': [
41 'account_view.xml',
42 ],
43 'test': [],
44 'demo': [],
45 'installable': True,
46 'auto_install': False,
47 'application': False,
48}
49
50# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file51\ No newline at end of file
152
=== added file 'account_prepayment/account.py'
--- account_prepayment/account.py 1970-01-01 00:00:00 +0000
+++ account_prepayment/account.py 2013-08-26 03:48:18 +0000
@@ -0,0 +1,107 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Andy Lu <andy.lu@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from osv import osv, fields
24from tools.translate import _
25
26class res_partner(osv.osv):
27 _inherit = 'res.partner'
28
29 _columns = {
30 'property_account_prepayable': fields.property(
31 'account.account',
32 type='many2one',
33 relation='account.account',
34 string="Account payable (Prepayment)",
35 view_load=True,
36 domain="[('type', '=', 'payable')]",
37 help="This account will be used instead of the default one as the Prepayment payable account for the current partner",
38 required=True),
39 'property_account_prereceivable': fields.property(
40 'account.account',
41 type='many2one',
42 relation='account.account',
43 string="Account Receivable (Prepayment)",
44 view_load=True,
45 domain="[('type', '=', 'receivable')]",
46 help="This account will be used instead of the default one as the Prepayment receivable account for the current partner",
47 required=True),
48 }
49
50class account_voucher(osv.osv):
51 _inherit = "account.voucher"
52
53 _columns = {
54 'purchase_id': fields.many2one('purchase.order', 'Purchase Order', domain=[('invoiced','=', False)], ondelete='set null'),
55 'use_prepayment_account': fields.boolean('Use Prepayment account', help="Check this if you want to input a prepayment on the prepayment accounts."),
56 }
57 _defaults = {
58 'use_prepayment_account': False,
59 }
60
61 def onchange_purchase_id(self, cr, uid, ids, purchase_id):
62 res = {}
63 if not purchase_id:
64 return res
65
66 amount = 0
67 po_obj = self.pool.get('purchase.order')
68 po = po_obj.browse(cr, uid, purchase_id)
69 if po.invoiced:
70 res['warning'] = {'title': _('Warning!'), 'message': _('Selected Purchase Order was paid.')}
71 for invoice in po.invoice_ids:
72 if invoice.state in ('paid'):
73 amount += invoice.amount_total
74 res['value'] = {'partner_id': po.partner_id.id, 'amount': po.amount_total - amount}
75 return res
76
77 def onchange_prepayment_account(self, cr, uid, ids, use_prepayment_account):
78 res = {}
79 if not use_prepayment_account:
80 return res
81
82 res['value'] = {'line_cr_ids': [],'line_dr_ids': [],'line_ids': []}
83 return res
84
85 def writeoff_move_line_get(self, cr, uid, voucher_id, line_total, move_id, name, company_currency, current_currency, context=None):
86 line_vals = super(account_voucher, self).writeoff_move_line_get(cr, uid, voucher_id, line_total, move_id, name, company_currency, current_currency, context=context)
87 if line_vals:
88 account_id = False
89 voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context)
90 if voucher_brw.use_prepayment_account:
91 if voucher_brw.payment_option == 'with_writeoff':
92 account_id = voucher_brw.writeoff_acc_id.id
93 elif voucher_brw.type in ('sale', 'receipt'):
94 if not voucher_brw.partner_id.property_account_prereceivable:
95 raise osv.except_osv(_('Unable to validate payment !'), _('Please configure the partner Prereceivable Account at first!'))
96 account_id = voucher_brw.partner_id.property_account_prereceivable.id
97 else:
98 if not voucher_brw.partner_id.property_account_prepayable:
99 raise osv.except_osv(_('Unable to validate payment !'), _('Please configure the partner Prepayable Account at first!'))
100 account_id = voucher_brw.partner_id.property_account_prepayable.id
101 if account_id:
102 line_vals['account_id'] = account_id
103 return line_vals
104account_voucher()
105
106
107# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0108
=== added file 'account_prepayment/account_view.xml'
--- account_prepayment/account_view.xml 1970-01-01 00:00:00 +0000
+++ account_prepayment/account_view.xml 2013-08-26 03:48:18 +0000
@@ -0,0 +1,65 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<openerp>
3 <data>
4
5 <!--
6 Partners Extension
7 -->
8 <record id="view_partner_preaccount_property_form" model="ir.ui.view">
9 <field name="name">res.partner.preaccount.property.form.inherit</field>
10 <field name="model">res.partner</field>
11 <field name="priority">3</field>
12 <field name="inherit_id" ref="account.view_partner_property_form"/>
13 <field name="arch" type="xml">
14 <xpath expr="//field[@name='property_account_receivable']" position="after">
15 <field name="property_account_prereceivable" groups="account.group_account_invoice" />
16 </xpath>
17 <xpath expr="//field[@name='property_account_payable']" position="after">
18 <field name="property_account_prepayable" groups="account.group_account_invoice" />
19 </xpath>
20 </field>
21 </record>
22
23 <record model="ir.ui.view" id="view_vendor_prepayment_form">
24 <field name="name">account.voucher.prepayment.form</field>
25 <field name="model">account.voucher</field>
26 <field name="inherit_id" ref="account_voucher.view_vendor_payment_form" />
27 <field name="arch" type="xml">
28 <xpath expr="//field[@name='partner_id']" position="before">
29 <field name="purchase_id" on_change="onchange_purchase_id(purchase_id)" />
30 </xpath>
31 <xpath expr="//field[@name='journal_id']" position="after">
32 <field name="use_prepayment_account" on_change="onchange_prepayment_account(use_prepayment_account)"/>
33 </xpath>
34 </field>
35 </record>
36
37 <record model="ir.ui.view" id="view_vendor_prereceipt_form">
38 <field name="name">account.voucher.prereceipt.form</field>
39 <field name="model">account.voucher</field>
40 <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form" />
41 <field name="arch" type="xml">
42 <xpath expr="//field[@name='journal_id']" position="after">
43 <field name="use_prepayment_account"/>
44 </xpath>
45 </field>
46 </record>
47
48 </data>
49
50 <!-- data noupdate="True">
51 <record id="prepayable_account_property" model="ir.property">
52 <field name="name">property_account_prepayable</field>
53 <field name="fields_id" ref="fc_account_prepayment.field_res_partner_property_account_prepayable"/>
54 <field name="company_id" ref="base.main_company"/>
55 <field eval="'account.account,'+str(ref('l10n_cn.chart1123'))" model="account.account" name="value"/>
56 </record>
57 <record id="prereceivable_account_property" model="ir.property">
58 <field name="name">property_account_prereceivable</field>
59 <field name="fields_id" ref="fc_account_prepayment.field_res_partner_property_account_prereceivable"/>
60 <field name="company_id" ref="base.main_company"/>
61 <field eval="'account.account,'+str(ref('l10n_cn.chart2205'))" model="account.account" name="value"/>
62 </record>
63 </data -->
64
65</openerp>
066
=== added directory 'account_prepayment/i18n'
=== added file 'account_prepayment/i18n/zh_CN.po'
--- account_prepayment/i18n/zh_CN.po 1970-01-01 00:00:00 +0000
+++ account_prepayment/i18n/zh_CN.po 2013-08-26 03:48:18 +0000
@@ -0,0 +1,81 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * fc_account_prepayment
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0alpha\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-03-13 06:33+0000\n"
10"PO-Revision-Date: 2013-03-13 06:33+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: fc_account_prepayment
19#: field:res.partner,property_account_prepayable:0
20msgid "Account Prepayable"
21msgstr "预付科目"
22
23#. module: fc_account_prepayment
24#: code:addons/fc_account_prepayment/account.py:70
25#, python-format
26msgid "Please configure the partner Prereceivable Account at first!"
27msgstr "请先配置客户预收账款科目!"
28
29#. module: fc_account_prepayment
30#: model:ir.model,name:fc_account_prepayment.model_account_voucher
31msgid "Accounting Voucher"
32msgstr "手工凭证"
33
34#. module: fc_account_prepayment
35#: code:addons/fc_account_prepayment/account.py:74
36#, python-format
37msgid "Please configure the partner Prepayable Account at first!"
38msgstr "请先配置供应商预付账款科目!"
39
40#. module: fc_account_prepayment
41#: help:res.partner,property_account_prereceivable:0
42msgid "This account will be used instead of the default one as the prereceivable account for the current partner"
43msgstr "当前客户的预收账款科目"
44
45#. module: fc_account_prepayment
46#: help:account.voucher,use_prepayment_account:0
47msgid "Check this if you receive or pay amounts in advance."
48msgstr "如果你要创建预收或者预付凭证,请选择此项."
49
50#. module: fc_account_prepayment
51#: code:addons/fc_account_prepayment/account.py:70
52#: code:addons/fc_account_prepayment/account.py:74
53#, python-format
54msgid "Unable to validate payment !"
55msgstr "不能审核该笔支付 !"
56
57#. module: fc_account_prepayment
58#: field:account.voucher,purchase_id:0
59msgid "Use Prepayment account"
60msgstr "采购订单"
61
62#. module: fc_account_prepayment
63#: field:account.voucher,use_prepayment_account:0
64msgid "Use Prepayment account"
65msgstr "使用预付/预收科目"
66
67#. module: fc_account_prepayment
68#: help:res.partner,property_account_prepayable:0
69msgid "This account will be used instead of the default one as the prepayable account for the current partner"
70msgstr "当前供应商的预付账款科目"
71
72#. module: fc_account_prepayment
73#: model:ir.model,name:fc_account_prepayment.model_res_partner
74msgid "Partner"
75msgstr "业务伙伴"
76
77#. module: fc_account_prepayment
78#: field:res.partner,property_account_prereceivable:0
79msgid "Account Prereceivable"
80msgstr "预收科目"
81

Subscribers

People subscribed via source and target branches