Merge pull request !1079 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-01-03 07:41:19 +00:00
committed by Gitee
3 changed files with 15 additions and 1 deletions
@@ -274,6 +274,13 @@ class YuthonProperty(models.Model):
"target": "new",
}
def trigger_company_id(self):
property_ids = self.env["yuthon.property"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in property_ids:
company_id = record.lease_ids[0].address_id.company_id.id if record.lease_ids else ''
record.company_id = company_id
class YuthonPropertyWater(models.Model):
_name = 'yuthon.property.water'
_description = '水表'
@@ -357,4 +357,11 @@
<field name="state">code</field>
<field name="code">action = model.action_yuthon_property_wizard()</field>
</record>
<record id="all_data_update_property_company" model="ir.actions.server">
<field name="name">更新公司</field>
<field name="model_id" ref="yuthon_property.model_yuthon_property"/>
<field name="binding_model_id" ref="yuthon_property.model_yuthon_property"/>
<field name="state">code</field>
<field name="code">action = model.trigger_company_id()</field>
</record>
</odoo>
@@ -488,7 +488,7 @@ class PropertyLeaseContract(models.Model):
property_ids = self.env["property.lease.contract"].browse(self._context.get('active_ids', self._context.get('active_id')))
for record in property_ids:
company_id = record.lease_ids[0].address_id.company_id.id if record.lease_ids else ''
record.company_id = company_id
record.write({'company_id': company_id})
def action_yuthon_property_contract_wizard(self):
return {