module can be installd + format
This commit is contained in:
parent
c21103cab7
commit
cd2bdd2748
@ -11,13 +11,13 @@ class AccountInvoice(models.Model):
|
|||||||
error_message = ""
|
error_message = ""
|
||||||
if any(not so.contract_annex_id.contract_id for so in sale_order_ids):
|
if any(not so.contract_annex_id.contract_id for so in sale_order_ids):
|
||||||
error_message = _("There is a Sale order without binding contract.")
|
error_message = _("There is a Sale order without binding contract.")
|
||||||
if any(not so.contract_annex_id for so in sale_order_ids):
|
if any(not so.contract_annex_id for so in sale_order_ids):
|
||||||
error_message = _("There is a Sale order without annex.")
|
error_message = _("There is a Sale order without annex.")
|
||||||
if error_message:
|
if error_message:
|
||||||
raise UserError(error_message)
|
raise UserError(error_message)
|
||||||
|
|
||||||
def action_invoice_print(self):
|
def action_invoice_print(self):
|
||||||
'''
|
"""
|
||||||
for so in self.env["sale.order"].search([]):
|
for so in self.env["sale.order"].search([]):
|
||||||
if self.id in so.invoice_ids.ids:
|
if self.id in so.invoice_ids.ids:
|
||||||
order = so
|
order = so
|
||||||
@ -32,16 +32,16 @@ class AccountInvoice(models.Model):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.sent = True
|
self.sent = True
|
||||||
'''
|
"""
|
||||||
|
|
||||||
sale_orders_ids = self.env["sale.order"].search([
|
sale_orders_ids = self.env["sale.order"].search(
|
||||||
("invoice_ids", "in", self.ids)
|
[("invoice_ids", "in", self.ids)]
|
||||||
])
|
)
|
||||||
if not sale_orders_ids:
|
if not sale_orders_ids:
|
||||||
return super().action_invoice_print()
|
return super().action_invoice_print()
|
||||||
|
|
||||||
self.check_contract_presence(sale_orders_ids)
|
self.check_contract_presence(sale_orders_ids)
|
||||||
self.filtered(lambda inv: not inv.is_move_sent).write({'is_move_sent': True})
|
self.filtered(lambda inv: not inv.is_move_sent).write({"is_move_sent": True})
|
||||||
|
|
||||||
view = self.env.ref(
|
view = self.env.ref(
|
||||||
"{}.res_partner_wizard_print_document_view".format(MODULE_NAME)
|
"{}.res_partner_wizard_print_document_view".format(MODULE_NAME)
|
||||||
|
@ -3,13 +3,19 @@ import datetime
|
|||||||
from odoo import _, fields, models
|
from odoo import _, fields, models
|
||||||
|
|
||||||
from ..utils import MODULE_NAME
|
from ..utils import MODULE_NAME
|
||||||
|
|
||||||
# from ..utils.misc import Extension, IDocument
|
# from ..utils.misc import Extension, IDocument
|
||||||
|
|
||||||
|
|
||||||
class PartnerContract(models.Model): #, IDocument, Extension):
|
class PartnerContract(models.Model): # , IDocument, Extension):
|
||||||
_name = "res.partner.contract"
|
_name = "res.partner.contract"
|
||||||
_description = "Contract"
|
_description = "Contract"
|
||||||
_inherit = ["mail.thread", "mail.activity.mixin", "mail.followers", "client_contracts.utils"]
|
_inherit = [
|
||||||
|
"mail.thread",
|
||||||
|
"mail.activity.mixin",
|
||||||
|
"mail.followers",
|
||||||
|
"client_contracts.utils",
|
||||||
|
]
|
||||||
|
|
||||||
def _get_default_name(self):
|
def _get_default_name(self):
|
||||||
"""Returns name format `№YYMM-D-N`,
|
"""Returns name format `№YYMM-D-N`,
|
||||||
|
@ -3,10 +3,11 @@ import math
|
|||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
|
|
||||||
from ..utils import MODULE_NAME
|
from ..utils import MODULE_NAME
|
||||||
|
|
||||||
# from ..utils.misc import Extension, IDocument
|
# from ..utils.misc import Extension, IDocument
|
||||||
|
|
||||||
|
|
||||||
class ContractOrderAnnex(models.Model): # , IDocument, Extension):
|
class ContractOrderAnnex(models.Model): # , IDocument, Extension):
|
||||||
_name = "res.partner.contract.annex"
|
_name = "res.partner.contract.annex"
|
||||||
_inherit = ["client_contracts.utils"]
|
_inherit = ["client_contracts.utils"]
|
||||||
_description = "Contract Annex"
|
_description = "Contract Annex"
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
# import inspect
|
# import inspect
|
||||||
|
|
||||||
from odoo import models # , fields
|
from odoo import models # , fields
|
||||||
from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
|
from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,12 +6,13 @@ from odoo.exceptions import ValidationError
|
|||||||
|
|
||||||
from ..utils import MODULE_NAME
|
from ..utils import MODULE_NAME
|
||||||
from ..utils.docxtpl import get_document_from_values_stream
|
from ..utils.docxtpl import get_document_from_values_stream
|
||||||
|
|
||||||
# from ..utils.misc import Extension
|
# from ..utils.misc import Extension
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ContractWizard(models.TransientModel): #, Extension):
|
class ContractWizard(models.TransientModel): # , Extension):
|
||||||
_name = "res.partner.contract.wizard"
|
_name = "res.partner.contract.wizard"
|
||||||
_inherit = ["client_contracts.utils"]
|
_inherit = ["client_contracts.utils"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user