mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: property checks
This commit is contained in:
@@ -15,7 +15,6 @@ class AccountBankStatement(models.Model):
|
|||||||
copy=False,
|
copy=False,
|
||||||
check_pms_properties=True,
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
company_id = fields.Many2one(check_pms_properties=True)
|
|
||||||
journal_id = fields.Many2one(check_pms_properties=True)
|
journal_id = fields.Many2one(check_pms_properties=True)
|
||||||
|
|
||||||
@api.depends("journal_id")
|
@api.depends("journal_id")
|
||||||
@@ -23,7 +22,7 @@ class AccountBankStatement(models.Model):
|
|||||||
for record in self:
|
for record in self:
|
||||||
if len(record.journal_id.pms_property_ids) == 1:
|
if len(record.journal_id.pms_property_ids) == 1:
|
||||||
record.pms_property_id = record.journal_id.pms_property_ids[0]
|
record.pms_property_id = record.journal_id.pms_property_ids[0]
|
||||||
else:
|
elif not record.pms_property_id:
|
||||||
record.pms_property_id = False
|
record.pms_property_id = False
|
||||||
|
|
||||||
def button_post(self):
|
def button_post(self):
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from odoo import api, fields, models
|
|||||||
|
|
||||||
class AccountBankStatementLine(models.Model):
|
class AccountBankStatementLine(models.Model):
|
||||||
_inherit = "account.bank.statement.line"
|
_inherit = "account.bank.statement.line"
|
||||||
|
_check_pms_properties_auto = True
|
||||||
|
|
||||||
folio_ids = fields.Many2many(
|
folio_ids = fields.Many2many(
|
||||||
string="Folios",
|
string="Folios",
|
||||||
@@ -11,6 +12,7 @@ class AccountBankStatementLine(models.Model):
|
|||||||
relation="account_bank_statement_folio_rel",
|
relation="account_bank_statement_folio_rel",
|
||||||
column1="account_journal_id",
|
column1="account_journal_id",
|
||||||
column2="folio_id",
|
column2="folio_id",
|
||||||
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
reservation_ids = fields.Many2many(
|
reservation_ids = fields.Many2many(
|
||||||
string="Reservations",
|
string="Reservations",
|
||||||
@@ -20,6 +22,7 @@ class AccountBankStatementLine(models.Model):
|
|||||||
relation="account_bank_statement_reservation_rel",
|
relation="account_bank_statement_reservation_rel",
|
||||||
column1="account_bank_statement_id",
|
column1="account_bank_statement_id",
|
||||||
column2="reservation_id",
|
column2="reservation_id",
|
||||||
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
service_ids = fields.Many2many(
|
service_ids = fields.Many2many(
|
||||||
string="Services",
|
string="Services",
|
||||||
@@ -29,6 +32,7 @@ class AccountBankStatementLine(models.Model):
|
|||||||
relation="account_bank_statement_service_rel",
|
relation="account_bank_statement_service_rel",
|
||||||
column1="account_bank_statement_id",
|
column1="account_bank_statement_id",
|
||||||
column2="service_id",
|
column2="service_id",
|
||||||
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from odoo import fields, models
|
|||||||
|
|
||||||
class AccountJournal(models.Model):
|
class AccountJournal(models.Model):
|
||||||
_inherit = "account.journal"
|
_inherit = "account.journal"
|
||||||
|
_check_pms_properties_auto = True
|
||||||
|
|
||||||
pms_property_ids = fields.Many2many(
|
pms_property_ids = fields.Many2many(
|
||||||
string="Properties",
|
string="Properties",
|
||||||
@@ -13,10 +14,6 @@ class AccountJournal(models.Model):
|
|||||||
relation="account_journal_pms_property_rel",
|
relation="account_journal_pms_property_rel",
|
||||||
column1="account_journal_id",
|
column1="account_journal_id",
|
||||||
column2="pms_property_id",
|
column2="pms_property_id",
|
||||||
)
|
|
||||||
company_id = fields.Many2one(
|
|
||||||
string="Company",
|
|
||||||
help="The company for Account Jouarnal",
|
|
||||||
check_pms_properties=True,
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
allowed_pms_payments = fields.Boolean(
|
allowed_pms_payments = fields.Boolean(
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ from odoo.exceptions import UserError
|
|||||||
|
|
||||||
class AccountMove(models.Model):
|
class AccountMove(models.Model):
|
||||||
_inherit = "account.move"
|
_inherit = "account.move"
|
||||||
|
_check_pms_properties_auto = True
|
||||||
|
|
||||||
# Field Declarations
|
|
||||||
folio_ids = fields.Many2many(
|
folio_ids = fields.Many2many(
|
||||||
string="Folios",
|
string="Folios",
|
||||||
help="Folios where the account move are included",
|
help="Folios where the account move are included",
|
||||||
@@ -31,6 +31,12 @@ class AccountMove(models.Model):
|
|||||||
readonly=False,
|
readonly=False,
|
||||||
check_pms_properties=True,
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
|
journal_id = fields.Many2one(check_pms_properties=True)
|
||||||
|
|
||||||
|
@api.onchange("pms_property_id")
|
||||||
|
def _onchange_pms_property_id(self):
|
||||||
|
for move in self:
|
||||||
|
move.journal_id = move._get_default_journal()
|
||||||
|
|
||||||
@api.depends("journal_id", "folio_ids")
|
@api.depends("journal_id", "folio_ids")
|
||||||
def _compute_pms_property_id(self):
|
def _compute_pms_property_id(self):
|
||||||
@@ -39,7 +45,7 @@ class AccountMove(models.Model):
|
|||||||
move.pms_property_id = move.folio_ids.mapped("pms_property_id")
|
move.pms_property_id = move.folio_ids.mapped("pms_property_id")
|
||||||
elif len(move.journal_id.mapped("pms_property_ids")) == 1:
|
elif len(move.journal_id.mapped("pms_property_ids")) == 1:
|
||||||
move.pms_property_id = move.journal_id.mapped("pms_property_ids")[0]
|
move.pms_property_id = move.journal_id.mapped("pms_property_ids")[0]
|
||||||
else:
|
elif not move.pms_property_id:
|
||||||
move.pms_property_id = False
|
move.pms_property_id = False
|
||||||
|
|
||||||
@api.depends("line_ids", "line_ids.folio_ids")
|
@api.depends("line_ids", "line_ids.folio_ids")
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from odoo import api, fields, models
|
|||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
_inherit = "account.move.line"
|
_inherit = "account.move.line"
|
||||||
|
_check_pms_properties_auto = True
|
||||||
|
|
||||||
# Fields declaration
|
# Fields declaration
|
||||||
# TODO: REVIEW why not a Many2one?
|
# TODO: REVIEW why not a Many2one?
|
||||||
@@ -17,12 +18,14 @@ class AccountMoveLine(models.Model):
|
|||||||
relation="folio_sale_line_invoice_rel",
|
relation="folio_sale_line_invoice_rel",
|
||||||
column1="invoice_line_id",
|
column1="invoice_line_id",
|
||||||
column2="sale_line_id",
|
column2="sale_line_id",
|
||||||
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
folio_ids = fields.Many2many(
|
folio_ids = fields.Many2many(
|
||||||
comodel_name="pms.folio",
|
comodel_name="pms.folio",
|
||||||
string="Folios",
|
string="Folios",
|
||||||
compute="_compute_folio_ids",
|
compute="_compute_folio_ids",
|
||||||
store=True,
|
store=True,
|
||||||
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
name_changed_by_user = fields.Boolean(
|
name_changed_by_user = fields.Boolean(
|
||||||
string="Custom label",
|
string="Custom label",
|
||||||
@@ -34,9 +37,20 @@ class AccountMoveLine(models.Model):
|
|||||||
pms_property_id = fields.Many2one(
|
pms_property_id = fields.Many2one(
|
||||||
name="Property",
|
name="Property",
|
||||||
comodel_name="pms.property",
|
comodel_name="pms.property",
|
||||||
related="move_id.pms_property_id",
|
compute="_compute_pms_property_id",
|
||||||
store=True,
|
store=True,
|
||||||
|
readonly=False,
|
||||||
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
|
move_id = fields.Many2one(check_pms_properties=True)
|
||||||
|
|
||||||
|
@api.depends("move_id")
|
||||||
|
def _compute_pms_property_id(self):
|
||||||
|
for rec in self:
|
||||||
|
if rec.move_id and rec.move_id.pms_property_id:
|
||||||
|
rec.pms_property_id = rec.move_id.pms_property_id
|
||||||
|
elif not rec.pms_property_id:
|
||||||
|
rec.pms_property_id = False
|
||||||
|
|
||||||
@api.depends("name")
|
@api.depends("name")
|
||||||
def _compute_name_changed_by_user(self):
|
def _compute_name_changed_by_user(self):
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from odoo import api, fields, models
|
|||||||
class AccountPayment(models.Model):
|
class AccountPayment(models.Model):
|
||||||
_inherit = "account.payment"
|
_inherit = "account.payment"
|
||||||
|
|
||||||
# Fields declaration
|
|
||||||
folio_ids = fields.Many2many(
|
folio_ids = fields.Many2many(
|
||||||
string="Folios",
|
string="Folios",
|
||||||
comodel_name="pms.folio",
|
comodel_name="pms.folio",
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class FolioSaleLine(models.Model):
|
|||||||
_name = "folio.sale.line"
|
_name = "folio.sale.line"
|
||||||
_description = "Folio Sale Line"
|
_description = "Folio Sale Line"
|
||||||
_order = "folio_id, sequence, reservation_order desc, service_order, date_order"
|
_order = "folio_id, sequence, reservation_order desc, service_order, date_order"
|
||||||
|
|
||||||
_check_company_auto = True
|
_check_company_auto = True
|
||||||
|
|
||||||
folio_id = fields.Many2one(
|
folio_id = fields.Many2one(
|
||||||
@@ -254,7 +253,6 @@ class FolioSaleLine(models.Model):
|
|||||||
store=True,
|
store=True,
|
||||||
index=True,
|
index=True,
|
||||||
related="folio_id.company_id",
|
related="folio_id.company_id",
|
||||||
check_pms_properties=True,
|
|
||||||
)
|
)
|
||||||
folio_partner_id = fields.Many2one(
|
folio_partner_id = fields.Many2one(
|
||||||
string="Customer",
|
string="Customer",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from odoo import _, fields, models
|
|||||||
|
|
||||||
class PaymentTransaction(models.Model):
|
class PaymentTransaction(models.Model):
|
||||||
_inherit = "payment.transaction"
|
_inherit = "payment.transaction"
|
||||||
|
_check_pms_properties_auto = True
|
||||||
|
|
||||||
folio_ids = fields.Many2many(
|
folio_ids = fields.Many2many(
|
||||||
string="Folios",
|
string="Folios",
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class PmsProperty(models.Model):
|
|||||||
help="The company that owns or operates this property.",
|
help="The company that owns or operates this property.",
|
||||||
comodel_name="res.company",
|
comodel_name="res.company",
|
||||||
required=True,
|
required=True,
|
||||||
check_pms_properties=True,
|
|
||||||
)
|
)
|
||||||
user_ids = fields.Many2many(
|
user_ids = fields.Many2many(
|
||||||
string="Accepted Users",
|
string="Accepted Users",
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class ProductPricelist(models.Model):
|
|||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
string="Company",
|
string="Company",
|
||||||
help="Company to which the pricelist belongs",
|
help="Company to which the pricelist belongs",
|
||||||
check_pms_properties=True,
|
|
||||||
)
|
)
|
||||||
cancelation_rule_id = fields.Many2one(
|
cancelation_rule_id = fields.Many2one(
|
||||||
string="Cancelation Policy",
|
string="Cancelation Policy",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from odoo import fields, models
|
|||||||
|
|
||||||
class ProductTemplate(models.Model):
|
class ProductTemplate(models.Model):
|
||||||
_inherit = "product.template"
|
_inherit = "product.template"
|
||||||
|
_check_pms_properties_auto = True
|
||||||
|
|
||||||
pms_property_ids = fields.Many2many(
|
pms_property_ids = fields.Many2many(
|
||||||
string="Properties",
|
string="Properties",
|
||||||
@@ -19,9 +20,6 @@ class ProductTemplate(models.Model):
|
|||||||
ondelete="restrict",
|
ondelete="restrict",
|
||||||
check_pms_properties=True,
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
company_id = fields.Many2one(
|
|
||||||
check_pms_properties=True,
|
|
||||||
)
|
|
||||||
per_day = fields.Boolean(
|
per_day = fields.Boolean(
|
||||||
string="Unit increment per day",
|
string="Unit increment per day",
|
||||||
help="Indicates that the product is sold by days",
|
help="Indicates that the product is sold by days",
|
||||||
|
|||||||
@@ -52,9 +52,6 @@ class ResPartner(models.Model):
|
|||||||
ondelete="restrict",
|
ondelete="restrict",
|
||||||
check_pms_properties=True,
|
check_pms_properties=True,
|
||||||
)
|
)
|
||||||
company_id = fields.Many2one(
|
|
||||||
check_pms_properties=True,
|
|
||||||
)
|
|
||||||
pms_checkin_partner_ids = fields.One2many(
|
pms_checkin_partner_ids = fields.One2many(
|
||||||
string="Checkin Partners",
|
string="Checkin Partners",
|
||||||
help="Associated checkin partners",
|
help="Associated checkin partners",
|
||||||
|
|||||||
@@ -6,10 +6,15 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='invoice_date']" position="after">
|
<xpath expr="//field[@name='invoice_date']" position="after">
|
||||||
<field name="folio_ids" widget="many2many_tags" />
|
<field name="folio_ids" widget="many2many_tags" />
|
||||||
<field name="pms_property_id" invisible="1" />
|
<field name="pms_property_id" />
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//field[@name='quantity']" position="before">
|
<xpath expr="//field[@name='quantity']" position="before">
|
||||||
<field name="name_changed_by_user" invisible="1" />
|
<field name="name_changed_by_user" invisible="1" />
|
||||||
|
<field
|
||||||
|
name="pms_property_id"
|
||||||
|
attrs="{'column_invisible':[('parent.pms_property_id','!=',False)]}"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class TravellerReport(models.TransientModel):
|
|||||||
# get checkin partners info to send
|
# get checkin partners info to send
|
||||||
lines = self.env["pms.checkin.partner"].search(
|
lines = self.env["pms.checkin.partner"].search(
|
||||||
[
|
[
|
||||||
("state", "=", "onboard", "done"),
|
("state", "in", ["onboard", "done"]),
|
||||||
("arrival", ">=", str(date_target) + " 0:00:00"),
|
("arrival", ">=", str(date_target) + " 0:00:00"),
|
||||||
("arrival", "<=", str(date_target) + " 23:59:59"),
|
("arrival", "<=", str(date_target) + " 23:59:59"),
|
||||||
("pms_property_id", "=", property_id),
|
("pms_property_id", "=", property_id),
|
||||||
|
|||||||
Reference in New Issue
Block a user