[IMP] point_of_sale: automatically set customer fiscal position
This makes it so that when you set a customer in the POS frontend it will automatically apply the fiscal position associated to the customer on the order. If the customer has no set fiscal position or if the fiscal position is not available in the POS nothing will happen. opw-668155
This commit is contained in:
@@ -182,7 +182,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
}
|
||||
},{
|
||||
model: 'res.partner',
|
||||
fields: ['name','street','city','state_id','country_id','vat','phone','zip','mobile','email','barcode','write_date'],
|
||||
fields: ['name','street','city','state_id','country_id','vat','phone','zip','mobile','email','barcode','write_date','property_account_position_id'],
|
||||
domain: [['customer','=',true]],
|
||||
loaded: function(self,partners){
|
||||
self.partners = partners;
|
||||
|
||||
@@ -1070,8 +1070,18 @@ var ClientListScreenWidget = ScreenWidget.extend({
|
||||
}
|
||||
},
|
||||
save_changes: function(){
|
||||
var self = this;
|
||||
var order = this.pos.get_order();
|
||||
if( this.has_client_changed() ){
|
||||
this.pos.get_order().set_client(this.new_client);
|
||||
if ( this.new_client ) {
|
||||
order.fiscal_position = _.find(this.pos.fiscal_positions, function (fp) {
|
||||
return fp.id === self.new_client.property_account_position_id[0];
|
||||
});
|
||||
} else {
|
||||
order.fiscal_position = undefined;
|
||||
}
|
||||
|
||||
order.set_client(this.new_client);
|
||||
}
|
||||
},
|
||||
has_client_changed: function(){
|
||||
|
||||
Reference in New Issue
Block a user