Add default invoice grouping method
issue6125 review35571003
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
* Add default invoice grouping method
|
||||
|
||||
Version 4.4.0 - 2017-05-01
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
@@ -21,4 +23,4 @@ Version 3.2.0 - 2014-04-21
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
Version 3.0.0 - 2013-10-21
|
||||
* Initial release
|
||||
* Initial release
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from trytond.pool import Pool
|
||||
from .party import *
|
||||
from .sale import *
|
||||
from . import configuration
|
||||
|
||||
|
||||
def register():
|
||||
@@ -11,4 +12,6 @@ def register():
|
||||
Sale,
|
||||
Party,
|
||||
PartySaleInvoiceGroupingMethod,
|
||||
configuration.Configuration,
|
||||
configuration.ConfigurationSaleMethod,
|
||||
module='sale_invoice_grouping', type_='model')
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# 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.model import fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
|
||||
__all__ = ['Configuration', 'ConfigurationSaleMethod']
|
||||
|
||||
|
||||
sale_invoice_grouping_method = fields.Selection(
|
||||
'get_sale_invoice_grouping_methods', "Sale Invoice Grouping Method",
|
||||
help="The default invoice grouping method for new customers.")
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_sale_invoice_grouping_methods(cls):
|
||||
pool = Pool()
|
||||
Party = pool.get('party.party')
|
||||
field_name = 'sale_invoice_grouping_method'
|
||||
return Party.fields_get([field_name])[field_name]['selection']
|
||||
|
||||
|
||||
class Configuration:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'sale.configuration'
|
||||
|
||||
sale_invoice_grouping_method = fields.MultiValue(
|
||||
sale_invoice_grouping_method)
|
||||
get_sale_invoice_grouping_methods = get_sale_invoice_grouping_methods
|
||||
|
||||
@classmethod
|
||||
def multivalue_model(cls, field):
|
||||
pool = Pool()
|
||||
if field == 'sale_invoice_grouping_method':
|
||||
return pool.get('sale.configuration.sale_method')
|
||||
return super(Configuration, cls).multivalue_model(field)
|
||||
|
||||
@classmethod
|
||||
def get_sale_invoice_grouping_methods(cls):
|
||||
pool = Pool()
|
||||
Party = pool.get('party.party')
|
||||
field_name = 'sale_invoice_grouping_method'
|
||||
return Party.fields_get([field_name])[field_name]['selection']
|
||||
|
||||
|
||||
class ConfigurationSaleMethod():
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'sale.configuration.sale_method'
|
||||
|
||||
sale_invoice_grouping_method = sale_invoice_grouping_method
|
||||
get_sale_invoice_grouping_methods = get_sale_invoice_grouping_methods
|
||||
|
||||
@classmethod
|
||||
def get_sale_invoice_grouping_methods(cls):
|
||||
pool = Pool()
|
||||
Party = pool.get('party.party')
|
||||
field_name = 'sale_invoice_grouping_method'
|
||||
return Party.fields_get([field_name])[field_name]['selection']
|
||||
@@ -0,0 +1,12 @@
|
||||
<?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. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="sale_configuration_view_form">
|
||||
<field name="model">sale.configuration</field>
|
||||
<field name="inherit" ref="sale.sale_configuration_view_form"/>
|
||||
<field name="name">configuration_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
@@ -21,6 +21,13 @@ class Party:
|
||||
'party.party.sale_invoice_grouping_method', 'party',
|
||||
"Sale Invoice Grouping Methods")
|
||||
|
||||
@classmethod
|
||||
def default_sale_invoice_grouping_method(cls, **pattern):
|
||||
pool = Pool()
|
||||
Configuration = pool.get('sale.configuration')
|
||||
return Configuration(1).get_multivalue(
|
||||
'sale_invoice_grouping_method', **pattern)
|
||||
|
||||
|
||||
class PartySaleInvoiceGroupingMethod(ModelSQL, ValueMixin):
|
||||
"Party Sale Invoice Grouping Method"
|
||||
|
||||
@@ -8,3 +8,4 @@ depends:
|
||||
sale
|
||||
xml:
|
||||
party.xml
|
||||
configuration.xml
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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/field[@name='sale_shipment_method']" position="after">
|
||||
<label name="sale_invoice_grouping_method"/>
|
||||
<field name="sale_invoice_grouping_method"/>
|
||||
</xpath>
|
||||
</data>
|
||||
Reference in New Issue
Block a user