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
|
||||
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
|
||||
# editing it at the moment.
|
||||
|
||||
embedded_schema do
|
||||
field :name, :string
|
||||
field :display_name, :string
|
||||
field :email, :string
|
||||
field :street, :string
|
||||
field :city, :string
|
||||
|
@ -47,11 +48,12 @@ defmodule RecycledCloud.Billing.Partner do
|
|||
end
|
||||
|
||||
def get(id) do
|
||||
fields = ["id", "name", "email", "country_id", "display_name"] ++ @address_fields
|
||||
result = Odoo.query([
|
||||
"res.partner",
|
||||
"search_read",
|
||||
[[["id", "=", id]]],
|
||||
%{"fields" => ["id", "name", "email", "country_id"] ++ @address_fields}
|
||||
%{"fields" => fields}
|
||||
])
|
||||
|
||||
format_fields = fn p ->
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= text_input f, :display_name, placeholder: "Display name" %>
|
||||
<%= error_tag f, :display_name %>
|
||||
|
||||
<br />
|
||||
|
||||
<%= text_input f, :street, placeholder: "Street" %>
|
||||
<%= error_tag f, :street %>
|
||||
|
||||
|
|
Loading…
Reference in a new issue