[IMP] point_of_sale: create a partner with empty fields

When creating a partner, the fields where the information is not specified were
filled with an empty string value.
The empty string value is not ideal as prevents to use filters like "email not
set" and forces to use more complexe domain "... or email = ''"

Instead, set the value false for the fields were nothing is provided (same
behaviour as backend web client).

Remove the fields.barcode overwrite to empty string as it is probably an
unintentional side effect of 3b33e5c3.

opw-684902
This commit is contained in:
Martin Trigaux
2016-08-09 15:32:23 +02:00
parent 08d51a7c79
commit fe34db34bc
2 changed files with 16 additions and 7 deletions
@@ -1182,7 +1182,7 @@ var ClientListScreenWidget = ScreenWidget.extend({
var fields = {};
this.$('.client-details-contents .detail').each(function(idx,el){
fields[el.name] = el.value;
fields[el.name] = el.value || false;
});
if (!fields.name) {
@@ -1196,7 +1196,6 @@ var ClientListScreenWidget = ScreenWidget.extend({
fields.id = partner.id || false;
fields.country_id = fields.country_id || false;
fields.barcode = fields.barcode || '';
new Model('res.partner').call('create_from_ui',[fields]).then(function(partner_id){
self.saved_client_details(partner_id);
+15 -5
View File
@@ -316,15 +316,15 @@
<div class='client-details-left'>
<div class='client-detail'>
<span class='label'>Street</span>
<input class='detail client-address-street' name='street' t-att-value='partner.street' placeholder='Street'></input>
<input class='detail client-address-street' name='street' t-att-value='partner.street || ""' placeholder='Street'></input>
</div>
<div class='client-detail'>
<span class='label'>City</span>
<input class='detail client-address-city' name='city' t-att-value='partner.city' placeholder='City'></input>
<input class='detail client-address-city' name='city' t-att-value='partner.city || ""' placeholder='City'></input>
</div>
<div class='client-detail'>
<span class='label'>Postcode</span>
<input class='detail client-address-zip' name='zip' t-att-value='partner.zip' placeholder='ZIP'></input>
<input class='detail client-address-zip' name='zip' t-att-value='partner.zip || ""' placeholder='ZIP'></input>
</div>
<div class='client-detail'>
<span class='label'>Country</span>
@@ -372,11 +372,21 @@
<div class='client-details-left'>
<div class='client-detail'>
<span class='label'>Address</span>
<span class='detail client-address'><t t-esc='partner.address' /></span>
<t t-if='partner.address'>
<span class='detail client-address'><t t-esc='partner.address' /></span>
</t>
<t t-if='!partner.address'>
<span class='detail client-address empty'>N/A</span>
</t>
</div>
<div class='client-detail'>
<span class='label'>Email</span>
<span class='detail client-email'><t t-esc='partner.email' /></span>
<t t-if='partner.email'>
<span class='detail client-email'><t t-esc='partner.email' /></span>
</t>
<t t-if='!partner.email'>
<span class='detail client-email empty'>N/A</span>
</t>
</div>
<div class='client-detail'>
<span class='label'>Phone</span>