Wire partner display name to Odoo
This commit is contained in:
parent
dcb5f364c2
commit
808765ef5a
2 changed files with 9 additions and 2 deletions
|
@ -7,13 +7,14 @@ defmodule RecycledCloud.Billing.Partner do
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
|
|
||||||
@address_fields [:street, :city, :zip]
|
@address_fields [:display_name, :street, :city, :zip]
|
||||||
|
|
||||||
# Note: Odoo stores partner's country under 'country_id'. We do not support
|
# Note: Odoo stores partner's country under 'country_id'. We do not support
|
||||||
# editing it at the moment.
|
# editing it at the moment.
|
||||||
|
|
||||||
embedded_schema do
|
embedded_schema do
|
||||||
field :name, :string
|
field :name, :string
|
||||||
|
field :display_name, :string
|
||||||
field :email, :string
|
field :email, :string
|
||||||
field :street, :string
|
field :street, :string
|
||||||
field :city, :string
|
field :city, :string
|
||||||
|
@ -47,11 +48,12 @@ defmodule RecycledCloud.Billing.Partner do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id) do
|
def get(id) do
|
||||||
|
fields = ["id", "name", "email", "country_id", "display_name"] ++ @address_fields
|
||||||
result = Odoo.query([
|
result = Odoo.query([
|
||||||
"res.partner",
|
"res.partner",
|
||||||
"search_read",
|
"search_read",
|
||||||
[[["id", "=", id]]],
|
[[["id", "=", id]]],
|
||||||
%{"fields" => ["id", "name", "email", "country_id"] ++ @address_fields}
|
%{"fields" => fields}
|
||||||
])
|
])
|
||||||
|
|
||||||
format_fields = fn p ->
|
format_fields = fn p ->
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= text_input f, :display_name, placeholder: "Display name" %>
|
||||||
|
<%= error_tag f, :display_name %>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
<%= text_input f, :street, placeholder: "Street" %>
|
<%= text_input f, :street, placeholder: "Street" %>
|
||||||
<%= error_tag f, :street %>
|
<%= error_tag f, :street %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue