Skip to content
Snippets Groups Projects
Commit d2b6ee33 authored by Luciano Rossi's avatar Luciano Rossi
Browse files

Add customer code for suppliers at party

Added a field customer_code into a new tab Supplier at Party model.
Also, added the customer_code at the purchase report.

issue5812
review34361002
parent 95953e54
No related branches found
No related tags found
No related merge requests found
* Add customer code for supplier on party
Version 5.2.0 - 2019-05-06
* Bug fixes (see mercurial logs for details)
* Remove purchase fields from stock move
......
......@@ -34,6 +34,8 @@
Invoice,
InvoiceLine,
Location,
party.Party,
party.CustomerCode,
module='purchase', type_='model')
Pool.register(
PurchaseReport,
......
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.i18n import gettext
from trytond.model import fields, ModelSQL
from trytond.pool import PoolMeta, Pool
......@@ -4,4 +5,6 @@
from trytond.pool import PoolMeta, Pool
from trytond.modules.company.model import (
CompanyMultiValueMixin, CompanyValueMixin)
from trytond.modules.party.exceptions import EraseError
......@@ -5,7 +8,29 @@
from trytond.modules.party.exceptions import EraseError
__all__ = ['PartyReplace', 'PartyErase']
class Party(CompanyMultiValueMixin, metaclass=PoolMeta):
__name__ = 'party.party'
customer_code = fields.MultiValue(fields.Char('Customer Code',
help="The code the party as supplier has assigned to the company"
" as customer."))
customer_codes = fields.One2Many(
'party.party.customer_code', 'party', "Customer Codes")
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field == 'customer_code':
return pool.get('party.party.customer_code')
return super().multivalue_model(field)
class CustomerCode(ModelSQL, CompanyValueMixin):
"Party Customer Code"
__name__ = 'party.party.customer_code'
party = fields.Many2One(
'party.party', "Party", ondelete='CASCADE', select=True)
customer_code = fields.Char('Customer Code')
class PartyReplace(metaclass=PoolMeta):
......
......@@ -3,6 +3,11 @@
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="party_view_form">
<field name="model">party.party</field>
<field name="inherit" ref="party.party_view_form"/>
<field name="name">party_form</field>
</record>
<record model="ir.action.act_window" id="act_purchase_form2">
<field name="name">Purchases</field>
<field name="res_model">purchase.purchase</field>
......
This diff is collapsed.
......@@ -61,6 +61,7 @@
>>> Party = Model.get('party.party')
>>> supplier = Party(name='Supplier')
>>> supplier.customer_code = '1234'
>>> supplier.save()
>>> customer = Party(name='Customer')
>>> customer.save()
......
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook/page[@id='general']" position="after">
<page string="Supplier" id="supplier">
<label name="customer_code"/>
<field name="customer_code"/>
</page>
</xpath>
</data>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment