mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: bank_statements property compute
This commit is contained in:
@@ -1,19 +1,30 @@
|
|||||||
from odoo import fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class AccountBankStatement(models.Model):
|
class AccountBankStatement(models.Model):
|
||||||
_inherit = "account.bank.statement"
|
_inherit = "account.bank.statement"
|
||||||
|
_check_pms_properties_auto = True
|
||||||
|
|
||||||
pms_property_id = fields.Many2one(
|
pms_property_id = fields.Many2one(
|
||||||
string="Property",
|
string="Property",
|
||||||
help="Properties with access to the element",
|
help="Properties with access to the element",
|
||||||
copy=False,
|
|
||||||
comodel_name="pms.property",
|
comodel_name="pms.property",
|
||||||
|
readonly=False,
|
||||||
|
compute="_compute_pms_property_id",
|
||||||
|
store=True,
|
||||||
|
copy=False,
|
||||||
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(check_pms_properties=True)
|
||||||
string="Company",
|
journal_id = fields.Many2one(check_pms_properties=True)
|
||||||
help="The company for Account Bank Statement",
|
|
||||||
)
|
@api.depends("journal_id")
|
||||||
|
def _compute_pms_property_id(self):
|
||||||
|
for record in self:
|
||||||
|
if len(record.journal_id.pms_property_ids) == 1:
|
||||||
|
record.pms_property_id = record.journal_id.pms_property_ids[0]
|
||||||
|
else:
|
||||||
|
record.pms_property_id = False
|
||||||
|
|
||||||
def button_post(self):
|
def button_post(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -4,9 +4,16 @@
|
|||||||
<field name="model">account.bank.statement</field>
|
<field name="model">account.bank.statement</field>
|
||||||
<field name="inherit_id" ref="account.view_bank_statement_form" />
|
<field name="inherit_id" ref="account.view_bank_statement_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
<xpath expr="//field[@name='company_id']" position="after">
|
<xpath expr="//field[@name='company_id']" position="after">
|
||||||
<field name="pms_property_id" />
|
<field name="pms_property_id" />
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
|
<xpath expr="//field[@name='ref']" position="after">
|
||||||
|
<field name="pms_property_id" invisible="1" />
|
||||||
|
<field name="folio_ids" widget="many2many_tags" optional="hidden" />
|
||||||
|
</xpath>
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user