Compare commits
2 Commits
09f904195d
...
a1d546e11a
Author | SHA1 | Date |
---|---|---|
Bernat Brunet | a1d546e11a | |
Bernat Brunet | c786b8c3aa |
|
@ -77,7 +77,8 @@ class ConfigurationFacturae(ModelSQL, CompanyValueMixin):
|
||||||
facturae_certificate = fields.Many2One('certificate', "Factura-e Certificate",
|
facturae_certificate = fields.Many2One('certificate', "Factura-e Certificate",
|
||||||
help='Certificate to sign Factura-e')
|
help='Certificate to sign Factura-e')
|
||||||
facturae_service = fields.Selection([
|
facturae_service = fields.Selection([
|
||||||
(None, 'Only Generate Facturae'),
|
(None, 'None'),
|
||||||
|
('only_file', 'Only Generate Facturae'),
|
||||||
], "Factura-e Service")
|
], "Factura-e Service")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
33
invoice.py
33
invoice.py
|
@ -255,24 +255,24 @@ class Invoice(metaclass=PoolMeta):
|
||||||
config = Configuration(1)
|
config = Configuration(1)
|
||||||
transaction = Transaction()
|
transaction = Transaction()
|
||||||
|
|
||||||
if not self.invoice_facturae:
|
|
||||||
facturae_content = self.get_facturae()
|
|
||||||
self._validate_facturae(facturae_content)
|
|
||||||
if backend.name != 'sqlite':
|
|
||||||
invoice_facturae = self._sign_facturae(facturae_content,
|
|
||||||
'default', certificate)
|
|
||||||
else:
|
|
||||||
invoice_facturae = facturae_content
|
|
||||||
self.invoice_facturae = invoice_facturae
|
|
||||||
self.save()
|
|
||||||
|
|
||||||
# send facturae to service
|
# send facturae to service
|
||||||
if not service and config.facturae_service:
|
if not service and config.facturae_service:
|
||||||
service = config.facturae_service
|
service = config.facturae_service
|
||||||
if self.invoice_facturae and service:
|
if not self.invoice_facturae:
|
||||||
with transaction.set_context(
|
facturae_content = self.get_facturae()
|
||||||
queue_scheduled_at=config.invoice_facturae_after):
|
self._validate_facturae(facturae_content)
|
||||||
Invoice.__queue__.send_facturae(self, service)
|
if backend.name != 'sqlite':
|
||||||
|
invoice_facturae = self._sign_facturae(facturae_content,
|
||||||
|
'default', certificate)
|
||||||
|
else:
|
||||||
|
invoice_facturae = facturae_content
|
||||||
|
self.invoice_facturae = invoice_facturae
|
||||||
|
self.save()
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
def send_facturae(self, service):
|
def send_facturae(self, service):
|
||||||
Invoice = Pool().get('account.invoice')
|
Invoice = Pool().get('account.invoice')
|
||||||
|
@ -816,7 +816,8 @@ class GenerateFacturaeStart(ModelView):
|
||||||
'Generate Factura-e file - Start'
|
'Generate Factura-e file - Start'
|
||||||
__name__ = 'account.invoice.generate_facturae.start'
|
__name__ = 'account.invoice.generate_facturae.start'
|
||||||
service = fields.Selection([
|
service = fields.Selection([
|
||||||
(None, 'Only generate facturae'),
|
(None, 'None'),
|
||||||
|
('only_file', 'Only Generate Facturae'),
|
||||||
], 'Factura-e Service')
|
], 'Factura-e Service')
|
||||||
certificate = fields.Many2One('certificate',
|
certificate = fields.Many2One('certificate',
|
||||||
'Factura-e Certificate', depends=['service'])
|
'Factura-e Certificate', depends=['service'])
|
||||||
|
|
|
@ -895,6 +895,14 @@ msgctxt "selection:account.configuration.facturae,facturae_service:"
|
||||||
msgid "Only Generate Facturae"
|
msgid "Only Generate Facturae"
|
||||||
msgstr "Només genera la Factura-e"
|
msgstr "Només genera la Factura-e"
|
||||||
|
|
||||||
|
msgctxt "selection:account.configuration.facturae,facturae_service:"
|
||||||
|
msgid "None"
|
||||||
|
msgstr "Cap"
|
||||||
|
|
||||||
msgctxt "selection:account.invoice.generate_facturae.start,service:"
|
msgctxt "selection:account.invoice.generate_facturae.start,service:"
|
||||||
msgid "Only Generate Facturae"
|
msgid "Only Generate Facturae"
|
||||||
msgstr "Només genera la Factura-e"
|
msgstr "Només genera la Factura-e"
|
||||||
|
|
||||||
|
msgctxt "selection:account.invoice.generate_facturae.start,service:"
|
||||||
|
msgid "None"
|
||||||
|
msgstr "Cap"
|
||||||
|
|
10
locale/es.po
10
locale/es.po
|
@ -885,10 +885,18 @@ msgctxt "wizard_button:account.invoice.generate_facturae,start,generate:"
|
||||||
msgid "Generate"
|
msgid "Generate"
|
||||||
msgstr "Generar"
|
msgstr "Generar"
|
||||||
|
|
||||||
msgctxt "selection:account.configuration.facturae,service:"
|
msgctxt "selection:account.configuration.facturae,facturae_service:"
|
||||||
msgid "Only Generate Facturae"
|
msgid "Only Generate Facturae"
|
||||||
msgstr "Solo genera la Factura-e"
|
msgstr "Solo genera la Factura-e"
|
||||||
|
|
||||||
|
msgctxt "selection:account.configuration.facturae,facturae_service:"
|
||||||
|
msgid "None"
|
||||||
|
msgstr "Ninguno"
|
||||||
|
|
||||||
msgctxt "selection:account.invoice.generate_facturae.start,service:"
|
msgctxt "selection:account.invoice.generate_facturae.start,service:"
|
||||||
msgid "Only Generate Facturae"
|
msgid "Only Generate Facturae"
|
||||||
msgstr "Solo genera la Factura-e"
|
msgstr "Solo genera la Factura-e"
|
||||||
|
|
||||||
|
msgctxt "selection:account.invoice.generate_facturae.start,service:"
|
||||||
|
msgid "None"
|
||||||
|
msgstr "Ninguno"
|
||||||
|
|
Loading…
Reference in New Issue