Move sale_carrier from depends to extras_depend.
This commit is contained in:
parent
3e4bbede0a
commit
d6cafac021
10
__init__.py
10
__init__.py
|
@ -2,7 +2,7 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from . import configuration
|
||||
from . import carrier
|
||||
from . import invoice
|
||||
from . import sale
|
||||
from . import party
|
||||
|
@ -10,8 +10,12 @@ from . import party
|
|||
def register():
|
||||
Pool.register(
|
||||
invoice.Invoice,
|
||||
configuration.Configuration,
|
||||
configuration.ConfigurationCarrier,
|
||||
sale.Sale,
|
||||
party.Party,
|
||||
module='sale_invoice_grouping_shipment_party', type_='model')
|
||||
Pool.register(
|
||||
carrier.Sale,
|
||||
carrier.Configuration,
|
||||
carrier.ConfigurationCarrier,
|
||||
depends=['sale_carrier'],
|
||||
module='sale_invoice_grouping_shipment_party', type_='model')
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
# 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, ModelSQL
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin)
|
||||
|
||||
__all__ = ['Configuration', 'ConfigurationCarrier']
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
|
||||
sale_default_party_carrier = fields.Selection([
|
||||
(None, 'Party (default)'),
|
||||
|
@ -28,3 +22,18 @@ class Configuration(metaclass=PoolMeta):
|
|||
class ConfigurationCarrier(metaclass=PoolMeta):
|
||||
__name__ = 'sale.configuration.sale_carrier'
|
||||
sale_default_party_carrier = sale_default_party_carrier
|
||||
|
||||
|
||||
class Sale(metaclass=PoolMeta):
|
||||
__name__ = 'sale.sale'
|
||||
|
||||
@fields.depends('carrier')
|
||||
def on_change_party(self):
|
||||
super(Sale, self).on_change_party()
|
||||
Config = Pool().get('sale.configuration')
|
||||
config = Config(1)
|
||||
if config:
|
||||
config = config.sale_default_party_carrier
|
||||
if config == 'shipment_party' and self.shipment_party:
|
||||
if self.shipment_party.carrier:
|
||||
self.carrier = self.shipment_party.carrier
|
|
@ -0,0 +1,13 @@
|
|||
<?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 depends="sale_carrier">
|
||||
<!-- configuration -->
|
||||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<?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>
|
||||
<!-- configuration -->
|
||||
<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>
|
2
party.py
2
party.py
|
@ -1,6 +1,6 @@
|
|||
# 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.pool import PoolMeta, Pool
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.model import fields
|
||||
|
||||
__all__ = ['Party']
|
||||
|
|
21
sale.py
21
sale.py
|
@ -1,7 +1,6 @@
|
|||
# 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.pool import PoolMeta, Pool
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.i18n import gettext
|
||||
from trytond.exceptions import UserError
|
||||
|
||||
|
@ -19,10 +18,8 @@ class Sale(metaclass=PoolMeta):
|
|||
|
||||
def check_shipment_party(self):
|
||||
if self.party.party_sale_payer:
|
||||
raise UserError(
|
||||
gettext('sale_invoice_grouping_shipment_party.msg_error_party_payer',
|
||||
name=self.party.rec_name,
|
||||
))
|
||||
raise UserError(gettext('sale_invoice_grouping_shipment_party.'
|
||||
'msg_error_party_payer', name=self.party.rec_name))
|
||||
|
||||
@property
|
||||
def _invoice_grouping_fields(self):
|
||||
|
@ -54,15 +51,3 @@ class Sale(metaclass=PoolMeta):
|
|||
else:
|
||||
self.party = self.shipment_party
|
||||
self.on_change_party()
|
||||
|
||||
|
||||
@fields.depends('carrier')
|
||||
def on_change_party(self):
|
||||
super(Sale, self).on_change_party()
|
||||
Config = Pool().get('sale.configuration')
|
||||
config = Config(1)
|
||||
if config:
|
||||
config = config.sale_default_party_carrier
|
||||
if config == 'shipment_party' and self.shipment_party:
|
||||
if self.shipment_party.carrier:
|
||||
self.carrier = self.shipment_party.carrier
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
version=5.5.0
|
||||
depends:
|
||||
ir
|
||||
sale_carrier
|
||||
sale_invoice_grouping
|
||||
extras_depend:
|
||||
sale_carrier
|
||||
account_invoice_discount_global
|
||||
sale_invoice_grouping_by_address
|
||||
xml:
|
||||
configuration.xml
|
||||
carrier.xml
|
||||
invoice.xml
|
||||
party.xml
|
||||
sale.xml
|
||||
|
|
Loading…
Reference in New Issue