mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[UPD] split contract object from AnalyticAccount
This commit is contained in:
@@ -1 +1 @@
|
||||
from . import account_analytic_account
|
||||
from . import contract
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# Copyright 2017 Tecnativa - Vicent Cubells
|
||||
# Copyright 2020 Technolibre - Carms Ng
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountAnalyticAccount(models.Model):
|
||||
|
||||
_name = 'account.analytic.account'
|
||||
_inherit = ['account.analytic.account', 'mail.thread']
|
||||
class ContractContract(models.Model):
|
||||
_inherit = ['contract.contract']
|
||||
|
||||
customer_signature = fields.Binary(
|
||||
string='Customer acceptance',
|
||||
attachment=True
|
||||
)
|
||||
signature_name = fields.Char(
|
||||
string='Signed by',
|
||||
@@ -18,7 +18,7 @@ class AccountAnalyticAccount(models.Model):
|
||||
|
||||
@api.model
|
||||
def create(self, values):
|
||||
contract = super(AccountAnalyticAccount, self).create(values)
|
||||
contract = super(ContractContract, self).create(values)
|
||||
if contract.customer_signature:
|
||||
values = {'customer_signature': contract.customer_signature}
|
||||
contract._track_signature(values, 'customer_signature')
|
||||
@@ -27,4 +27,4 @@ class AccountAnalyticAccount(models.Model):
|
||||
@api.multi
|
||||
def write(self, values):
|
||||
self._track_signature(values, 'customer_signature')
|
||||
return super(AccountAnalyticAccount, self).write(values)
|
||||
return super(ContractContract, self).write(values)
|
||||
@@ -12,7 +12,7 @@ class TestContractSignatureTracking(common.SavepointCase):
|
||||
cls.image = 'R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='
|
||||
|
||||
def test_contract_signature_tracking(self):
|
||||
self.contract = self.env['account.analytic.account'].create({
|
||||
self.contract = self.env['contract.contract'].create({
|
||||
'name': 'Test Contract',
|
||||
'customer_signature': self.image,
|
||||
})
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="account_analytic_account_recurring_form_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.invoice.recurring.form.inherit</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="inherit_id" ref="contract.account_analytic_account_recurring_form_form"/>
|
||||
<record id="contract_contract_signature_form_view" model="ir.ui.view">
|
||||
<field name="name">contract.contract form view.signature</field>
|
||||
<field name="model">contract.contract</field>
|
||||
<field name="inherit_id" ref="contract.contract_contract_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="user_id"/>
|
||||
|
||||
Reference in New Issue
Block a user