Commit fa366ad4 authored by Actarus's avatar Actarus
Browse files

site model, site form view: Added address copying buttons from partner or contact

parent 54cc69cc
......@@ -116,6 +116,43 @@ class CustomerSite(models.Model):
return france_ids[0][0]
# Address copying
def _copy_address_from(self, source):
Copy address from the source. Copied fields are:
- street (Char)
- street2 (Char)
- city (Char)
- zip (Char)
- country_id (Many2one --
- state_id (Many2one -- res.state)
- department_id (Many2one -- res.department)
The fields mentionned above must exist in the source.
(Hence, the source should be a, a customer.partner or a
Both `source` is an individual records (i.e. a "singleton" recordset), while `self` may be a recordset.
for site in self:
site.country_id = source.country_id
site.state_id = source.state_id
site.department_id = source.department_id = =
site.street2 = source.street2
site.street = source.street
def action_copy_address_from_partner(self):
for site in self:
return True
def action_copy_address_from_contact(self):
for site in self:
return True
# Warnings
# TODO: Add warnings for address
......@@ -40,6 +40,12 @@
<field name="state_id" placeholder="Région" colspan="2" nolabel="1"/>
<field name="country_id" placeholder="Pays" colspan="1" nolabel="1"/>
<button string="Copier adresse du Compte"
name="action_copy_address_from_partner" type="object"/>
<button string="Copier adresse du Contact"
name="action_copy_address_from_contact" type="object"/>
<group string="Maintenance" col="4">
<field name="maintenance_partner_id" string="Société"/>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment