Skip to content

Commit 61fcfc0

Browse files
author
Alexis de Lattre
committed
Add module purchase_partner_invoice_method
1 parent 2d3dc8d commit 61fcfc0

File tree

8 files changed

+312
-0
lines changed

8 files changed

+312
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- encoding: utf-8 -*-
2+
##############################################################################
3+
#
4+
# Purchase Partner Invoice Method for Odoo
5+
# Copyright (C) 2014 Akretion (http://www.akretion.com)
6+
# @author Alexis de Lattre <[email protected]>
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+
from . import partner
24+
from . import purchase
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# -*- encoding: utf-8 -*-
2+
##############################################################################
3+
#
4+
# Purchase Partner Invoice Method module for Odoo
5+
# Copyright (C) 2014 Akretion (http://www.akretion.com).
6+
# @author Alexis de Lattre <[email protected]>
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': 'Purchase Partner Invoice Method',
25+
'version': '1.0',
26+
'category': 'Purchase Management',
27+
'license': 'AGPL-3',
28+
'summary': "Adds supplier invoicing control on partner form",
29+
'description': """
30+
This module adds a new field on the partner form in the *Accouting* tab:
31+
*Supplier Invoicing Control*. The value of this field will be used when you
32+
create a new Purchase Order with this partner as supplier.
33+
34+
This module has been written by Alexis de Lattre
35+
36+
""",
37+
'author': 'Akretion',
38+
'website': 'http://www.akretion.com',
39+
'depends': ['purchase'],
40+
'data': ['partner_view.xml'],
41+
'demo': ['partner_demo.xml'],
42+
'installable': True,
43+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * purchase_partner_invoice_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 8.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2014-11-16 23:17+0000\n"
10+
"PO-Revision-Date: 2014-11-16 23:17+0000\n"
11+
"Last-Translator: Alexis de Lattre <[email protected]>\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: purchase_partner_invoice_method
19+
#: selection:res.partner,supplier_invoice_method:0
20+
msgid "Based on Purchase Order lines"
21+
msgstr "Basé sur les lignes de commande"
22+
23+
#. module: purchase_partner_invoice_method
24+
#: selection:res.partner,supplier_invoice_method:0
25+
msgid "Based on generated draft invoice"
26+
msgstr "Basé sur une facture brouillon générée"
27+
28+
#. module: purchase_partner_invoice_method
29+
#: selection:res.partner,supplier_invoice_method:0
30+
msgid "Based on incoming shipments"
31+
msgstr "Basé sur les réceptions"
32+
33+
#. module: purchase_partner_invoice_method
34+
#: model:ir.model,name:purchase_partner_invoice_method.model_res_partner
35+
msgid "Partner"
36+
msgstr "Partenaire"
37+
38+
#. module: purchase_partner_invoice_method
39+
#: model:ir.model,name:purchase_partner_invoice_method.model_purchase_order
40+
msgid "Purchase Order"
41+
msgstr "Bon de commande"
42+
43+
#. module: purchase_partner_invoice_method
44+
#: help:res.partner,supplier_invoice_method:0
45+
msgid "Select the default invoicing control for the purchase orders of this supplier"
46+
msgstr "Sélectionnez la méthode de contrôle facturation par défaut des bons de commande de ce fournisseur"
47+
48+
#. module: purchase_partner_invoice_method
49+
#: field:res.partner,supplier_invoice_method:0
50+
msgid "Supplier Invoicing Control"
51+
msgstr "Contrôle facturation fournisseur"
52+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * purchase_partner_invoice_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 8.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2014-11-16 23:16+0000\n"
10+
"PO-Revision-Date: 2014-11-16 23:16+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: purchase_partner_invoice_method
19+
#: selection:res.partner,supplier_invoice_method:0
20+
msgid "Based on Purchase Order lines"
21+
msgstr ""
22+
23+
#. module: purchase_partner_invoice_method
24+
#: selection:res.partner,supplier_invoice_method:0
25+
msgid "Based on generated draft invoice"
26+
msgstr ""
27+
28+
#. module: purchase_partner_invoice_method
29+
#: selection:res.partner,supplier_invoice_method:0
30+
msgid "Based on incoming shipments"
31+
msgstr ""
32+
33+
#. module: purchase_partner_invoice_method
34+
#: model:ir.model,name:purchase_partner_invoice_method.model_res_partner
35+
msgid "Partner"
36+
msgstr ""
37+
38+
#. module: purchase_partner_invoice_method
39+
#: model:ir.model,name:purchase_partner_invoice_method.model_purchase_order
40+
msgid "Purchase Order"
41+
msgstr ""
42+
43+
#. module: purchase_partner_invoice_method
44+
#: help:res.partner,supplier_invoice_method:0
45+
msgid "Select the default invoicing control for the purchase orders of this supplier"
46+
msgstr ""
47+
48+
#. module: purchase_partner_invoice_method
49+
#: field:res.partner,supplier_invoice_method:0
50+
msgid "Supplier Invoicing Control"
51+
msgstr ""
52+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- encoding: utf-8 -*-
2+
##############################################################################
3+
#
4+
# Purchase Partner Invoice Method for Odoo
5+
# Copyright (C) 2014 Akretion (http://www.akretion.com)
6+
# @author Alexis de Lattre <[email protected]>
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+
from openerp import models, fields, api
24+
25+
26+
class ResPartner(models.Model):
27+
_inherit = 'res.partner'
28+
29+
supplier_invoice_method = fields.Selection([
30+
('manual', 'Based on Purchase Order lines'),
31+
('order', 'Based on generated draft invoice'),
32+
('picking', 'Based on incoming shipments')
33+
],
34+
string='Supplier Invoicing Control', company_dependent=True,
35+
help='Select the default invoicing control for the purchase orders '
36+
'of this supplier')
37+
38+
@api.model
39+
def _commercial_fields(self):
40+
res = super(ResPartner, self)._commercial_fields()
41+
res += ['supplier_invoice_method']
42+
return res
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!--
4+
Copyright (C) 2014 Akretion (http://www.akretion.com/)
5+
@author Alexis de Lattre <[email protected]>
6+
The licence is in the file __openerp__.py
7+
-->
8+
9+
<openerp>
10+
<data noupdate="1">
11+
12+
13+
<record id="base.res_partner_1" model="res.partner"> <!-- Asustek -->
14+
<field name="supplier_invoice_method">picking</field>
15+
</record>
16+
17+
<record id="base.res_partner_3" model="res.partner"> <!-- China Export -->
18+
<field name="supplier_invoice_method">manual</field>
19+
</record>
20+
21+
<record id="base.res_partner_4" model="res.partner"> <!-- Delta PC -->
22+
<field name="supplier_invoice_method">picking</field>
23+
</record>
24+
25+
<record id="base.res_partner_12" model="res.partner"> <!-- C2C -->
26+
<field name="supplier_invoice_method">manual</field>
27+
</record>
28+
29+
<record id="base.res_partner_23" model="res.partner"> <!-- Vauxoo -->
30+
<field name="supplier_invoice_method">order</field>
31+
</record>
32+
33+
34+
</data>
35+
</openerp>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!--
4+
Copyright (C) 2014 Akretion (http://www.akretion.com/)
5+
@author Alexis de Lattre <[email protected]>
6+
The licence is in the file __openerp__.py
7+
-->
8+
9+
<openerp>
10+
<data>
11+
12+
13+
<record id="view_partner_property_form" model="ir.ui.view">
14+
<field name="name">purchase_partner_invoice_method.partner_form</field>
15+
<field name="model">res.partner</field>
16+
<field name="inherit_id" ref="account.view_partner_property_form"/>
17+
<field name="arch" type="xml">
18+
<field name="property_supplier_payment_term" position="after">
19+
<field name="supplier_invoice_method"/>
20+
</field>
21+
</field>
22+
</record>
23+
24+
25+
</data>
26+
</openerp>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- encoding: utf-8 -*-
2+
##############################################################################
3+
#
4+
# Purchase Partner Invoice Method for Odoo
5+
# Copyright (C) 2014 Akretion (http://www.akretion.com)
6+
# @author Alexis de Lattre <[email protected]>
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+
from openerp.osv import orm
24+
25+
26+
class PurchaseOrder(orm.Model):
27+
_inherit = 'purchase.order'
28+
29+
def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
30+
res = super(PurchaseOrder, self).onchange_partner_id(
31+
cr, uid, ids, partner_id, context=context)
32+
if partner_id:
33+
partner = self.pool['res.partner'].browse(
34+
cr, uid, partner_id, context=context)
35+
if partner.supplier_invoice_method:
36+
res['value']['invoice_method'] = \
37+
partner.supplier_invoice_method
38+
return res

0 commit comments

Comments
 (0)