mirror of
https://github.com/NaN-tic/trytond-account_invoice_facturae.git
synced 2023-12-14 03:32:59 +01:00
Compare commits
No commits in common. "2aa95124086912ac4f87f16066949f315f154e39" and "840b1c5e74792b57737810afbaabef699624ac99" have entirely different histories.
2aa9512408
...
840b1c5e74
2 changed files with 5 additions and 8 deletions
10
account.py
10
account.py
|
@ -50,20 +50,18 @@ class Configuration(metaclass=PoolMeta):
|
|||
fields.Selection('get_facturae_service', "Factura-e Service",
|
||||
help='Service to be used when post the invoice'))
|
||||
invoice_facturae_after = fields.TimeDelta("Send Factura-e after",
|
||||
help="Grace period after which the invoice will be sent to the "
|
||||
"facturae service. Applies only if a worker queue is activated.")
|
||||
help="Grace period after which the invoice will be sent to the facturae "
|
||||
"service. Applies only if a worker queue is activated.")
|
||||
|
||||
@classmethod
|
||||
def default_facturae_service(cls, **pattern):
|
||||
return cls.multivalue_model(
|
||||
'facturae_service').default_facturae_service()
|
||||
return cls.multivalue_model('facturae_service').default_facturae_service()
|
||||
|
||||
@classmethod
|
||||
def get_facturae_service(cls):
|
||||
pool = Pool()
|
||||
ConfigurationFacturae = pool.get('account.configuration.facturae')
|
||||
return ConfigurationFacturae.fields_get(['facturae_service'])[
|
||||
'facturae_service']['selection']
|
||||
return ConfigurationFacturae.fields_get(['facturae_service'])['facturae_service']['selection']
|
||||
|
||||
@classmethod
|
||||
def multivalue_model(cls, field):
|
||||
|
|
|
@ -260,7 +260,6 @@ class Invoice(metaclass=PoolMeta):
|
|||
# send facturae to service
|
||||
if not service and config.facturae_service:
|
||||
service = config.facturae_service
|
||||
if service:
|
||||
if not self.invoice_facturae:
|
||||
facturae_content = self.get_facturae()
|
||||
self._validate_facturae(facturae_content)
|
||||
|
@ -272,7 +271,7 @@ class Invoice(metaclass=PoolMeta):
|
|||
self.invoice_facturae = invoice_facturae
|
||||
self.save()
|
||||
|
||||
if self.invoice_facturae and service != 'only_file':
|
||||
if self.invoice_facturae and service and service != 'only_file':
|
||||
with transaction.set_context(
|
||||
queue_scheduled_at=config.invoice_facturae_after):
|
||||
Invoice.__queue__.send_facturae(self, service)
|
||||
|
|
Loading…
Reference in a new issue